Created
January 19, 2010 17:23
-
-
Save chuckremes/281102 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> contracts.find({full_name: /CLE/}) | |
{ "_id" : ObjectId("4b55c962870d490f80000001"), "month" : "F", "exchange_name" : "NYMEX on Globex", "expiration_date" : "2010/12/20 00:00:00", "exchange_id" : 67, "symbol" : "F.US.CLEF11", "scale" : 2, "type" : "future", "description" : "Crude Light (Globex), Jan 11", "year" : "2011", "tick_size" : 0.01, "tick_value" : 10, "contract_id" : 265126, "full_name" : "F.US.CLEF11", "currency" : "USD" } | |
{ "_id" : ObjectId("4b55c963870d490f80000002"), "month" : "F", "exchange_name" : "NYMEX on Globex", "expiration_date" : "2011/12/20 00:00:00", "exchange_id" : 67, "symbol" : "F.US.CLEF12", "scale" : 2, "type" : "future", "description" : "Crude Light (Globex), Jan 12", "year" : "2012", "tick_size" : 0.01, "tick_value" : 10, "contract_id" : 284201, "full_name" : "F.US.CLEF12", "currency" : "USD" } | |
{ "_id" : ObjectId("4b55c964870d490f80000003"), "month" : "F", "exchange_name" : "NYMEX on Globex", "expiration_date" : "2012/12/19 00:00:00", "exchange_id" : 67, "symbol" : "F.US.CLEF13", "scale" : 2, "type" : "future", "description" : "Crude Light (Globex), Jan 13", "year" : "2013", "tick_size" : 0.01, "tick_value" : 10, "contract_id" : 324765, "full_name" : "F.US.CLEF13", "currency" : "USD" } | |
# and now the ruby... | |
>> def ts symbol | |
>> @mongo = Mongo::Connection.new("10.126.128.23").db("market_data") | |
>> | |
?> @contract_collection = @mongo.collection "contracts" | |
>> @contracts = @contract_collection.find({'symbol' => /symbol/}).to_a | |
>> p @contracts | |
>> end | |
=> nil | |
>> ts 'F.US.CLE' | |
[] | |
=> nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment