From e37e4924393ae1d25f526d1d4f62b1d82b32f7f8 Mon Sep 17 00:00:00 2001 From: Giulio De Pasquale Date: Thu, 24 Dec 2020 13:48:41 +0000 Subject: [PATCH] implemented get/put_profit_loss api with frontend --- main.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/main.py b/main.py index 45bfd33..906f24e 100755 --- a/main.py +++ b/main.py @@ -87,6 +87,18 @@ def on_connect(): }) +@socketio.on('get_profit_loss') +def on_get_profit_loss(message): + start = message['start'] + end = message['end'] + + profit_loss = loop.run_until_complete(bot.get_profit_loss(start, end)) + + socketio.emit("put_profit_loss", { + "pl" : profit_loss[0], + "pl_perc": profit_loss[1] + }) + ################################### # Bot callbacks ###################################