fix critical
This commit is contained in:
12
bot.py
12
bot.py
@@ -62,15 +62,13 @@ def main():
|
||||
def on_book(message: dict, state: StateManager):
|
||||
symbol = message["symbol"]
|
||||
|
||||
def best_price(side) -> int:
|
||||
def best_price(side) -> int | None:
|
||||
if message[side]:
|
||||
return message[side][0][0]
|
||||
|
||||
bid_price = int(best_price("buy"))
|
||||
ask_price = int(best_price("sell"))
|
||||
print(message)
|
||||
|
||||
state.update_bid_ask_price(symbol, bid_price, ask_price)
|
||||
else:
|
||||
return None
|
||||
|
||||
state.update_bid_ask_price(symbol, best_price("buy"), best_price("sell"))
|
||||
|
||||
def on_fill(message: dict, orderman: OrderManager, state: StateManager):
|
||||
symbol = message["symbol"]
|
||||
|
||||
Reference in New Issue
Block a user