From 912c4db2e2367be2e9ea2c52742f12cc12a979f7 Mon Sep 17 00:00:00 2001 From: Giulio De Pasquale Date: Wed, 16 Dec 2020 13:30:24 +0000 Subject: [PATCH] added on_close event handler --- main.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main.py b/main.py index c77f8ab..4fc22d5 100755 --- a/main.py +++ b/main.py @@ -87,6 +87,11 @@ def on_connect(): # 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) def on_new_tick(event: Event, status: SymbolStatus): tick = event.tick