Skip to content

Commit

Permalink
log
Browse files Browse the repository at this point in the history
  • Loading branch information
foolcage committed Jul 9, 2018
1 parent b8fed34 commit 4757a5c
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 11 deletions.
3 changes: 3 additions & 0 deletions fooltrader/bot/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from email.mime.text import MIMEText

import requests
import schedule

from fooltrader.settings import SMTP_HOST, SMTP_PORT, EMAIL_PASSWORD, EMAIL_USER_NAME, WEIXIN_APP_ID, WEIXIN_APP_SECRECT

Expand Down Expand Up @@ -56,6 +57,8 @@ class WeixinAction(Action):
def __init__(self) -> None:
self.refresh_token()

schedule.every(10).minutes.do(self.refresh_token())

def refresh_token(self):
resp = requests.get(self.GET_TOKEN_URL)
self.logger.info("refresh_token resp.status_code:{}, resp.text:{}".format(resp.status_code, resp.text))
Expand Down
2 changes: 1 addition & 1 deletion fooltrader/botsamples/notify_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def handle_trigger(self, trigger_flag, sub_id, subscription, current_price, chan

triggered = True

self.logger.info(
self.logger.debug(
"send msg to user:{},price:{},change_pct:{}".format(subscription['userId'], current_price,
change_pct))

Expand Down
2 changes: 1 addition & 1 deletion fooltrader/connector/kafka_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def cryptocurrency_tick_to_kafka(exchange, pairs=None):
bytes(json.dumps(tick), encoding='utf8'),
timestamp_ms=tick['timestamp'])

logger.info("tick_to_kafka {}".format(tick))
logger.debug("tick_to_kafka {}".format(tick))


if __name__ == '__main__':
Expand Down
8 changes: 4 additions & 4 deletions fooltrader/domain/subscription_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class PriceSubscription(BaseDocType):
"code": "BTC-USDT",
"upPct": 1,
"downPct": 2,
"upTo": 7000,
"downTo": 6000,
"up": 7000,
"down": 6000,
"actions": ["weixin", "email", "shortMsg"],
"repeat": False
}
Expand All @@ -29,8 +29,8 @@ class PriceSubscription(BaseDocType):
code = Keyword()
upPct = Float()
downPct = Float()
upTo = Float()
downTo = Float()
up = Float()
down = Float()

repeat = Boolean()
actions = Keyword()
Expand Down
8 changes: 4 additions & 4 deletions fooltrader/domain/subscription_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class PriceSubscriptionSchema(Schema):
"code": "BTC-USDT",
"upPct": 1,
"downPct": 2,
"upTo": 7000,
"downTo": 6000,
"up": 7000,
"down": 6000,
"actions": ["weixin", "email", "shortMsg"],
"repeat": False
}
Expand All @@ -28,8 +28,8 @@ class PriceSubscriptionSchema(Schema):
code = fields.Str()
upPct = fields.Float()
downPct = fields.Float()
upTo = fields.Float()
downTo = fields.Float()
up = fields.Float()
down = fields.Float()

repeat = fields.Boolean(missing=False)
actions = fields.List(fields.String)
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,6 @@ ccxt == 1.14.224

Flask == 1.0

marshmallow
marshmallow

schedule

0 comments on commit 4757a5c

Please sign in to comment.