hbdmapi / huobi_futures_Python

An Asynchronous Event-driven High-frequency Trading System,huobi future,huobi coin margined swap, huobi usdt margined swap included.
MIT License
267 stars 113 forks source link

如何修改huobi_swap demo中 控制台的打印内容 #49

Closed 18728476237 closed 3 years ago

18728476237 commented 3 years ago

我想修改huobi_swap demo运行时的打印内容,请问应该修改哪个文件夹中哪个文件的哪个函数?非常感谢

foonsun commented 3 years ago

您好,修改config.json 里的level级别,比如“DEBUG”,“INFO”,“WARN”,“ERROR”

"SERVER_ID": "future_maker_strategy",
    "LOG": {
        "console": true,
        "level": "DEBUG",
        "path": "/data/logs/servers/future_maker_strategy",
        "name": "future_maker_strategy.log",
        "clear": true,
        "backup_count": 5
    },
18728476237 commented 3 years ago

我没有表达清楚,我是说怎么修改Demo打印的实时行情的内容,我希望前后两个open值变化超过1个usdt才打印

---原始邮件--- 发件人: "foonsun"<notifications@github.com> 发送时间: 2021年2月4日(周四) 晚上6:29 收件人: "hbdmapi/huobi_futures_Python"<huobi_futures_Python@noreply.github.com>; 抄送: "18728476237"<525082270@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [hbdmapi/huobi_futures_Python] 如何修改huobi_swap demo中 控制台的打印内容 (#49)

您好,修改config.json 里的debug级别,比如“DEBUG”,“INFO”,“WARN”,“ERROR” "SERVER_ID": "future_maker_strategy", "LOG": { "console": true, "level": "DEBUG", "path": "/data/logs/servers/future_maker_strategy", "name": "future_maker_strategy.log", "clear": true, "backup_count": 5 },
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

foonsun commented 3 years ago

可以通过这个函数去打印:logger.info(self.strategy, "create future orders success:", order_nos, caller=self) 里面填写需要打印的变量就可以

18728476237 commented 3 years ago

谢谢

---原始邮件--- 发件人: "foonsun"<notifications@github.com> 发送时间: 2021年2月4日(周四) 晚上9:40 收件人: "hbdmapi/huobi_futures_Python"<huobi_futures_Python@noreply.github.com>; 抄送: "18728476237"<525082270@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [hbdmapi/huobi_futures_Python] 如何修改huobi_swap demo中 控制台的打印内容 (#49)

可以通过这个函数去打印:logger.info(self.strategy, "create future orders success:", order_nos, caller=self) 里面填写需要打印的变量就可以

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

18728476237 commented 3 years ago

你好。我直接运行你的huobi_swap DEMO,实时打印了三种类型的信息: [2021-02-05 09:08:51,968] [-] [MyStrategy] orderbook: {"platform": "huobi_swap", "symbol": "BTC-USD", "asks": [["37181.40000000", "2997.00000000"], ["37181.50000000", "7.00000000"], D [2021-02-05 09:08:52,004] [-] [HuobiSwapMarket] data: {"ch": "market.BTC-USD.depth.step6", "ts": 1612487411159, "tick": {"mrid": 73870283258, "id": 1612487411, "bids": [[37181.3, 3845], [37181.2, 1], D [2021-02-05 09:08:52,004] [-] [HuobiSwapMarket] symbol: BTC-USD orderbook: {"platform": "huobi_swap", "symbol": "BTC-USD", "asks": [["37181.40000000", "3999.00000000"], 我想只打印1min的kline实时行情,而不是打印前面的3中类型的实时信息,我应该修改哪个函数。你前一封邮件说的logger.info()我确实看不懂怎么就打印了前述3种实时信息,谢谢

18728476237 commented 3 years ago

我不是说通过test里边的websocket_test.py去打印,那个我知道怎么打印。我现在是在这个huobi-swap 中想获取Kline数据,我该怎么做

foonsun commented 3 years ago

Kline打印在这里:https://github.com/hbdmapi/huobi_futures_Python/blob/master/examples/huobi_usdt_swap/strategy.py#L183 有kline数据就会在这里打印每次推送的kline,目前默认是1MIN K线;

配置config.json里kline为订阅kline 1MIN:https://github.com/hbdmapi/huobi_futures_Python/blob/master/examples/huobi_usdt_swap/config.json#L25