From db315bf80e31514c3905443eccaef2d5b46882ff Mon Sep 17 00:00:00 2001 From: foolcage <5533061@qq.com> Date: Mon, 9 Jul 2018 11:30:02 +0800 Subject: [PATCH] improve --- fooltrader/bot/strategy.py | 7 +++++++ fooltrader/botsamples/notify_bot.py | 2 +- fooltrader/domain/subscription_model.py | 4 ++-- fooltrader/domain/subscription_schema.py | 4 ++-- fooltrader/rest/rest.py | 2 +- 5 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 fooltrader/bot/strategy.py diff --git a/fooltrader/bot/strategy.py b/fooltrader/bot/strategy.py new file mode 100644 index 0000000..4cb9ab8 --- /dev/null +++ b/fooltrader/bot/strategy.py @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +class Strategy(object): + # open_long_condition + # close_long_condition + # open_short_condition + # close_short_condition + pass \ No newline at end of file diff --git a/fooltrader/botsamples/notify_bot.py b/fooltrader/botsamples/notify_bot.py index 7f11ba9..4a00768 100644 --- a/fooltrader/botsamples/notify_bot.py +++ b/fooltrader/botsamples/notify_bot.py @@ -103,7 +103,7 @@ def handle_trigger(self, trigger_flag, sub_id, subscription, current_price, chan if 'weixin' in subscription['actions']: self.weixin_action.send_message(subscription['userId'], title="价格条件触发", body=None, name=self.security_item['name'], price=current_price, - change_pct=change_pct) + change_pct='{:.2%}'.format(change_pct)) if triggered: self.has_triggered[trigger_flag] = sub_triggerd.to_dict() diff --git a/fooltrader/domain/subscription_model.py b/fooltrader/domain/subscription_model.py index e3bc112..57f7c5d 100644 --- a/fooltrader/domain/subscription_model.py +++ b/fooltrader/domain/subscription_model.py @@ -15,8 +15,8 @@ class PriceSubscription(BaseDocType): "code": "BTC-USDT", "upPct": 1, "downPct": 2, - "up": 7000, - "down": 6000, + "upTo": 7000, + "downTo": 6000, "actions": ["weixin", "email", "shortMsg"], "repeat": False } diff --git a/fooltrader/domain/subscription_schema.py b/fooltrader/domain/subscription_schema.py index be787eb..e77a6ab 100644 --- a/fooltrader/domain/subscription_schema.py +++ b/fooltrader/domain/subscription_schema.py @@ -13,8 +13,8 @@ class PriceSubscriptionSchema(Schema): "code": "BTC-USDT", "upPct": 1, "downPct": 2, - "up": 7000, - "down": 6000, + "upTo": 7000, + "downTo": 6000, "actions": ["weixin", "email", "shortMsg"], "repeat": False } diff --git a/fooltrader/rest/rest.py b/fooltrader/rest/rest.py index 28f4155..4b5c95b 100644 --- a/fooltrader/rest/rest.py +++ b/fooltrader/rest/rest.py @@ -3,4 +3,4 @@ from fooltrader.rest import app if __name__ == '__main__': - app.run() + app.run(host='0.0.0.0')