Add some info logs around paper fills
parent
30bce42c0b
commit
cf835b97ca
|
@ -207,9 +207,10 @@ class PaperBoi(Struct):
|
||||||
remaining: float = 0,
|
remaining: float = 0,
|
||||||
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Pretend to fill a broker order @ price and size.
|
'''
|
||||||
|
Pretend to fill a broker order @ price and size.
|
||||||
|
|
||||||
"""
|
'''
|
||||||
# TODO: net latency model
|
# TODO: net latency model
|
||||||
await trio.sleep(0.05)
|
await trio.sleep(0.05)
|
||||||
fill_time_ns = time.time_ns()
|
fill_time_ns = time.time_ns()
|
||||||
|
@ -230,6 +231,7 @@ class PaperBoi(Struct):
|
||||||
'name': self.broker + '_paper',
|
'name': self.broker + '_paper',
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
log.info(f'Fake filling order:\n{fill_msg}')
|
||||||
await self.ems_trades_stream.send(fill_msg)
|
await self.ems_trades_stream.send(fill_msg)
|
||||||
|
|
||||||
self._trade_ledger.update(fill_msg.to_dict())
|
self._trade_ledger.update(fill_msg.to_dict())
|
||||||
|
@ -407,6 +409,7 @@ async def simulate_fills(
|
||||||
for order_info, pred in iter_entries:
|
for order_info, pred in iter_entries:
|
||||||
(our_price, size, reqid, action) = order_info
|
(our_price, size, reqid, action) = order_info
|
||||||
|
|
||||||
|
# print(order_info)
|
||||||
clearable = pred(our_price)
|
clearable = pred(our_price)
|
||||||
if clearable:
|
if clearable:
|
||||||
# pop and retreive order info
|
# pop and retreive order info
|
||||||
|
@ -481,8 +484,8 @@ async def handle_order_requests(
|
||||||
# counter - collision prone..)
|
# counter - collision prone..)
|
||||||
reqid=reqid,
|
reqid=reqid,
|
||||||
)
|
)
|
||||||
|
log.info(f'Submitted paper LIMIT {reqid}:\n{order}')
|
||||||
|
|
||||||
# elif action == 'cancel':
|
|
||||||
case {'action': 'cancel'}:
|
case {'action': 'cancel'}:
|
||||||
msg = BrokerdCancel(**request_msg)
|
msg = BrokerdCancel(**request_msg)
|
||||||
await client.submit_cancel(
|
await client.submit_cancel(
|
||||||
|
|
Loading…
Reference in New Issue