Skip to content

Instantly share code, notes, and snippets.

@ChuaCheowHuan
Created October 30, 2019 07:44
Show Gist options
  • Save ChuaCheowHuan/ff5a4fa81a7bc9bf55aaeae0ba59a14c to your computer and use it in GitHub Desktop.
Save ChuaCheowHuan/ff5a4fa81a7bc9bf55aaeae0ba59a14c to your computer and use it in GitHub Desktop.
test modify orders
#! /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