added on_close event handler

This commit is contained in:
Giulio De Pasquale 2020-12-16 13:30:24 +00:00
parent 7bbd99ba97
commit 912c4db2e2

View File

@ -87,6 +87,11 @@ def on_connect():
# Bot callbacks # Bot callbacks
################################### ###################################
@btc_eh.on_event(EventKind.CLOSE_POSITION)
def on_close_position(event: Event, _):
loop.run_until_complete(bot.close_position(event.metadata.position_id))
@btc_eh.on_event(EventKind.NEW_TICK) @btc_eh.on_event(EventKind.NEW_TICK)
def on_new_tick(event: Event, status: SymbolStatus): def on_new_tick(event: Event, status: SymbolStatus):
tick = event.tick tick = event.tick