Pass symbol with broker suffix to `.submit_limit()`; fix clearing
parent
c5447fda06
commit
ecd93cb05a
piker/clearing
|
@ -325,10 +325,10 @@ async def simulate_fills(
|
||||||
# dark order price filter(s)
|
# dark order price filter(s)
|
||||||
types=('ask', 'bid', 'trade', 'last')
|
types=('ask', 'bid', 'trade', 'last')
|
||||||
):
|
):
|
||||||
# print(tick)
|
|
||||||
match tick:
|
match tick:
|
||||||
case {
|
case {
|
||||||
'price': tick_price,
|
'price': tick_price,
|
||||||
|
# 'type': ('ask' | 'trade' | 'last'),
|
||||||
'type': 'ask',
|
'type': 'ask',
|
||||||
}:
|
}:
|
||||||
client.last_ask = (
|
client.last_ask = (
|
||||||
|
@ -345,6 +345,7 @@ async def simulate_fills(
|
||||||
|
|
||||||
case {
|
case {
|
||||||
'price': tick_price,
|
'price': tick_price,
|
||||||
|
# 'type': ('bid' | 'trade' | 'last'),
|
||||||
'type': 'bid',
|
'type': 'bid',
|
||||||
}:
|
}:
|
||||||
client.last_bid = (
|
client.last_bid = (
|
||||||
|
@ -364,14 +365,17 @@ async def simulate_fills(
|
||||||
'price': tick_price,
|
'price': tick_price,
|
||||||
'type': ('trade' | 'last'),
|
'type': ('trade' | 'last'),
|
||||||
}:
|
}:
|
||||||
# TODO: simulate actual book queues and our orders
|
# TODO: simulate actual book queues and our
|
||||||
# place in it, might require full L2 data?
|
# orders place in it, might require full L2
|
||||||
|
# data?
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# iterate book prices descending
|
# iterate book prices descending
|
||||||
for oid, our_price in book_sequence:
|
for oid, our_price in book_sequence:
|
||||||
if pred(our_price):
|
# print(tick)
|
||||||
|
# print((sym, list(book_sequence), client._buys, client._sells))
|
||||||
|
clearable = pred(our_price)
|
||||||
|
if clearable:
|
||||||
# retreive order info
|
# retreive order info
|
||||||
(size, reqid, action) = orders.pop((oid, our_price))
|
(size, reqid, action) = orders.pop((oid, our_price))
|
||||||
|
|
||||||
|
@ -428,7 +432,7 @@ async def handle_order_requests(
|
||||||
# call our client api to submit the order
|
# call our client api to submit the order
|
||||||
reqid = await client.submit_limit(
|
reqid = await client.submit_limit(
|
||||||
oid=order.oid,
|
oid=order.oid,
|
||||||
symbol=order.symbol,
|
symbol=f'{order.symbol}.{client.broker}',
|
||||||
price=order.price,
|
price=order.price,
|
||||||
action=order.action,
|
action=order.action,
|
||||||
size=order.size,
|
size=order.size,
|
||||||
|
|
Loading…
Reference in New Issue