Created
March 9, 2019 15:23
-
-
Save solalatus/9baa2238d656bc0b232245256a2781c3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
from orderbook import OrderBook | |
contract_ids = [111,2222,3333,4444]#df...contractId.unique() | |
orderbooks={} | |
for contract_id in contract_ids: | |
orderbooks[contract_id]=OrderBook() | |
print(orderbooks) | |
data = {'type' : 'limit', | |
'side' : 'ask', | |
'quantity' : 5, | |
'price' : 101, | |
'trade_id' : 1113333, #Have no clue why, but this is mandatory. Absurd. | |
#I typically duplicate order_id. Dunno why. | |
'order_id' : 1113334444, | |
'timestamp': 1544662383280000000} | |
orderbooks[contract_ids[0]].process_order(data,True,False) | |
#I was lame enough to use the first contractId availabel from the list, but you get my point... | |
print(orderbooks[contract_ids[0]]) | |
print("Same as:",orderbooks[111]) | |
print(orderbooks[contract_ids[0]].get_best_ask()) | |
orderbooks[contract_ids[0]].cancel_order("ask",1113334444) | |
print(orderbooks[contract_ids[0]]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment