更新ios
This commit is contained in:
14
app.py
14
app.py
@@ -7128,6 +7128,18 @@ def get_watchlist_realtime():
|
||||
change = latest['close'] - prev_close
|
||||
change_percent = (change / prev_close * 100) if prev_close > 0 else 0.0
|
||||
|
||||
# 处理 timestamp:可能是 datetime 对象或 ISO 字符串
|
||||
ts = latest['timestamp']
|
||||
if ts:
|
||||
if isinstance(ts, str):
|
||||
# 从缓存获取的是 ISO 字符串,提取时间部分
|
||||
update_time = ts.split('T')[1][:8] if 'T' in ts else ts[:8]
|
||||
else:
|
||||
# 从 ClickHouse 获取的是 datetime 对象
|
||||
update_time = ts.strftime('%H:%M:%S')
|
||||
else:
|
||||
update_time = '--:--:--'
|
||||
|
||||
quotes_data[code6] = {
|
||||
'price': latest['close'],
|
||||
'prev_close': prev_close,
|
||||
@@ -7137,7 +7149,7 @@ def get_watchlist_realtime():
|
||||
'low': latest['low'],
|
||||
'volume': latest['volume'],
|
||||
'amount': latest['amount'],
|
||||
'update_time': latest['timestamp'].strftime('%H:%M:%S')
|
||||
'update_time': update_time
|
||||
}
|
||||
|
||||
# 如果分钟数据为空,从 ea_trade 获取最新日线数据作为 fallback
|
||||
|
||||
Reference in New Issue
Block a user