Created
October 30, 2019 07:44
-
-
Save ChuaCheowHuan/ff5a4fa81a7bc9bf55aaeae0ba59a14c to your computer and use it in GitHub Desktop.
test modify orders
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
#! /usr/bin/python | |
from __future__ import print_function | |
from random import * | |
import sys | |
sys.path.append('..') | |
from orderbook import OrderBook | |
order_book = OrderBook() | |
order_0 = {'type' : 'limit', | |
'side' : 'bid', | |
'quantity' : 10, | |
'price' : 1, | |
'trade_id' : 0} | |
order_1 = {'type' : 'limit', | |
'side' : 'bid', | |
'quantity' : 20, | |
'price' : 1, | |
'trade_id' : 1} | |
order_2 = {'type' : 'limit', | |
'side' : 'bid', | |
'quantity' : 30, | |
'price' : 1, | |
'trade_id' : 2} | |
trades,neworder = order_book.process_order(order_0, False, False) | |
trades,neworder = order_book.process_order(order_1, False, False) | |
trades,neworder = order_book.process_order(order_2, False, False) | |
print(order_book) | |
order_mod = {'type' : 'limit', | |
'side' : 'bid', | |
'quantity' : 100, | |
'price' : 1, | |
'trade_id' : 0} | |
order_id = 1 | |
order_book.modify_order(order_id, order_mod) | |
print(order_book) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment