Loading...
We'll focus on the order placement + matching + streaming path:
9
output: stream of [(tick_id, serial_no, asset_id, op_type, amt, market_id)]
Authentication: Bearer
body: market_id, asset_id (stock_id/etc.), op_type (buy/sell), amt
pseudo-code:
if order.isBuy():
if order.amt >= margin[order.user_id]:
buyheaps[asset_id].push(order)
else:
return fail(order)
else:
if order.asset_amt >= assets[user_id][asset_id]:
sellheaps[asset_id].push(order)
else:
return fail(order)
execute(buyheaps[asset_id].pop(), sellheaps[asset_id].pop())