Closed Lxtluck closed 4 years ago
可以开启Debug模式,原始log也打印下提供方便排查呢
如何开启Debug模式
我pull了一下代码 发现现在log打印的特别多 是改变了log级别吗
I [2020-08-14 01:30:34,968] [-] [MyStrategy] position update: [platform: huobi_future, account: account, strategy: my_test_strategy, symbol: ETH/quarter, short_quantity: None, short_avg_price: None, long_quantity: 1600, long_avg_price: 438.2935461256214, liquid_price: None, utime: 1597368634798]
是的,默认开启Debug模式了,这边也看下。
爆仓价格也不显示 为None
还有就是 我要取实时的成交价格 怎么取?self属性里没找到
@Lxtluck 目前强平价等数据属性是预留,目前还没做实现,后续会做下补充。
on_event_trade_update 是最新公开成交记录的回调,这里可以去拿最新成交价格。
[MyStrategy] trade update: {"platform": "huobi_future", "symbol": "ETH_CQ", "action": "SELL", "price": "434.07100000", "quantity": "4.00000000", "timestamp": 1597374506535} 假如我要取这个price怎么取?
In position from on_event_position_update, [platform: huobi_future, account: account, strategy: my_test_strategy, symbol: ETH/quarter, short_quantity: None, short_avg_price: None, long_quantity: 1600, long_avg_price: 438.2935461256214, liquid_price: None, utime: 1597368634798]
[platform: huobi_future, account: 13938898680, strategy: my_test_strategy, symbol: BTC/quarter, short_quantity: 202, short_avg_price: 11834.813543485521, long_quantity: 0, long_avg_price: 0, liquid_price: None, utime: 1597368542798]
Sometimes position reports short_quantity: 0 short_avg_price: 0 instead of None. How the system decides to report None or zero in position?
[MyStrategy] trade update: {"platform": "huobi_future", "symbol": "ETH_CQ", "action": "SELL", "price": "434.07100000", "quantity": "4.00000000", "timestamp": 1597374506535} 假如我要取这个price怎么取?
上面是标准的class属性的获取方式,可以参考python class属性如何获取。
In position from on_event_position_update, [platform: huobi_future, account: account, strategy: my_test_strategy, symbol: ETH/quarter, short_quantity: None, short_avg_price: None, long_quantity: 1600, long_avg_price: 438.2935461256214, liquid_price: None, utime: 1597368634798]
[platform: huobi_future, account: 13938898680, strategy: my_test_strategy, symbol: BTC/quarter, short_quantity: 202, short_avg_price: 11834.813543485521, long_quantity: 0, long_avg_price: 0, liquid_price: None, utime: 1597368542798]
Sometimes position reports short_quantity: 0 short_avg_price: 0 instead of None. How the system decides to report None or zero in position?
Hi,@igkoh, The position is None when your account has never opened the long or short position.Once your account has opened the long or short position,the position will be zero.
@foonsun Once you kindly explained as: since position is not created at all, quantity and price are not existent up to that moment, thus None. Afterward, quantity and position have numerical values of zero.
yes.@igkoh.
以上属性 只有long_quantity与long_avg_price有值,其余均为None,是什么原因