OKX: 设置ohlcv_partial_candle=False,因为OKX返回的candle都是已close的;改进数据新鲜度日志,同时显示UTC和UTC+8时间
This commit is contained in:
parent
1875f2e1fb
commit
cf508dfa24
@ -28,7 +28,7 @@ class Okx(Exchange):
|
||||
|
||||
_ft_has: FtHas = {
|
||||
"ohlcv_candle_limit": 100, # Warning, special case with data prior to X months
|
||||
"ohlcv_partial_candle": False, # 不删除最后一根蜡烛,使用最新数据
|
||||
"ohlcv_partial_candle": False, # OKX返回的candle都是已close的,不需要删除最后一根
|
||||
"stoploss_order_types": {"limit": "limit"},
|
||||
"stoploss_on_exchange": True,
|
||||
"stoploss_query_requires_stop_flag": True,
|
||||
|
||||
@ -1120,8 +1120,10 @@ class FreqaiPrimer(IStrategy):
|
||||
display_latest = latest_data_date
|
||||
if display_latest.tzinfo is None:
|
||||
display_latest = display_latest.replace(tzinfo=timezone.utc)
|
||||
display_latest = display_latest.astimezone(UTC_PLUS_8)
|
||||
latest_time_str = display_latest.strftime('%H:%M:%S')
|
||||
# 同时显示 UTC 和 UTC+8 时间,方便排查时区问题
|
||||
latest_time_utc = display_latest.strftime('%H:%M:%S UTC')
|
||||
display_latest_cn = display_latest.astimezone(UTC_PLUS_8)
|
||||
latest_time_cn = display_latest_cn.strftime('%H:%M:%S UTC+8')
|
||||
# 计算数据新鲜度(使用统一函数)
|
||||
data_freshness = self.calculate_data_freshness(latest_data_date, metadata['pair'], dataframe)
|
||||
|
||||
@ -1134,7 +1136,7 @@ class FreqaiPrimer(IStrategy):
|
||||
fresh_icon = "❌"
|
||||
self.strategy_log(
|
||||
f"[{metadata['pair']}] 数据新鲜度: {fresh_icon} {data_freshness:.1f}min | "
|
||||
f"最新K线: {latest_time_str} | 总行数: {len(dataframe)}"
|
||||
f"最新K线: {latest_time_utc} / {latest_time_cn} | 总行数: {len(dataframe)}"
|
||||
)
|
||||
else:
|
||||
from pandas import Timestamp
|
||||
@ -1142,9 +1144,11 @@ class FreqaiPrimer(IStrategy):
|
||||
display_latest = latest_data_date.to_pydatetime()
|
||||
if display_latest.tzinfo is None:
|
||||
display_latest = display_latest.replace(tzinfo=timezone.utc)
|
||||
display_latest = display_latest.astimezone(UTC_PLUS_8)
|
||||
latest_time_str = display_latest.strftime('%H:%M:%S')
|
||||
latest_naive = display_latest.replace(tzinfo=None)
|
||||
# 同时显示 UTC 和 UTC+8 时间,方便排查时区问题
|
||||
latest_time_utc = display_latest.strftime('%H:%M:%S UTC')
|
||||
display_latest_cn = display_latest.astimezone(UTC_PLUS_8)
|
||||
latest_time_cn = display_latest_cn.strftime('%H:%M:%S UTC+8')
|
||||
latest_naive = display_latest_cn.replace(tzinfo=None)
|
||||
|
||||
# 计算数据新鲜度(使用统一函数)
|
||||
data_freshness = self.calculate_data_freshness(latest_data_date, metadata['pair'], dataframe)
|
||||
@ -1158,7 +1162,7 @@ class FreqaiPrimer(IStrategy):
|
||||
fresh_icon = "❌"
|
||||
self.strategy_log(
|
||||
f"[{metadata['pair']}] 数据新鲜度: {fresh_icon} {data_freshness:.1f}min | "
|
||||
f"最新K线: {latest_time_str} | 总行数: {len(dataframe)}"
|
||||
f"最新K线: {latest_time_utc} / {latest_time_cn} | 总行数: {len(dataframe)}"
|
||||
)
|
||||
except Exception as e:
|
||||
self.strategy_log(f"[{metadata['pair']}] 数据新鲜度计算异常: {e}")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user