a
This commit is contained in:
parent
1d25b3cb79
commit
fb04f69965
|
|
@ -755,12 +755,10 @@ class ConfigManager:
|
|||
|
||||
if key in percent_keys:
|
||||
# 如果值>1,认为是百分比形式(旧数据),转换为比例形式
|
||||
# 数据迁移完成后,所有值都应该<=1,此逻辑可以移除
|
||||
# 静默转换,不输出警告(用户已确认数据库应存储小数形式)
|
||||
if value > 1:
|
||||
old_value = value
|
||||
value = value / 100.0
|
||||
logger.warning(f"配置值格式转换(临时兼容): {key} = {value*100:.2f}% (从百分比形式{old_value}转换为比例形式,建议执行数据迁移)")
|
||||
# ⚠️ 关键修复:转换后立即更新Redis缓存,避免下次读取时再次触发转换
|
||||
# 静默更新Redis缓存,避免下次读取时再次触发转换
|
||||
try:
|
||||
if key in RISK_KNOBS_KEYS:
|
||||
# 风险旋钮:更新当前账号的Redis缓存
|
||||
|
|
@ -774,18 +772,6 @@ class ConfigManager:
|
|||
global_config_mgr._cache[key] = value
|
||||
except Exception as e:
|
||||
logger.debug(f"更新Redis缓存失败(不影响使用): {key} = {e}")
|
||||
# ⚠️ 关键修复:转换后立即更新Redis缓存,避免下次读取时再次触发转换
|
||||
try:
|
||||
if key in RISK_KNOBS_KEYS:
|
||||
# 风险旋钮:更新当前账号的Redis缓存
|
||||
self._set_to_redis(key, value)
|
||||
else:
|
||||
# 全局配置:更新全局配置的Redis缓存
|
||||
global_config_mgr._set_to_redis(key, value)
|
||||
# 同时更新本地缓存
|
||||
global_config_mgr._cache[key] = value
|
||||
except Exception as e:
|
||||
logger.debug(f"更新Redis缓存失败(不影响使用): {key} = {e}")
|
||||
|
||||
return value
|
||||
|
||||
|
|
|
|||
|
|
@ -2861,15 +2861,15 @@ class PositionManager:
|
|||
logger.warning(f"{symbol} [实时监控] ⚠️ 异常:盈利单触发止损但未激活移动止损,标记为移动止损")
|
||||
else:
|
||||
# 正常止损逻辑
|
||||
should_close_due_to_sl = True
|
||||
# ⚠️ 2026-01-27优化:如果已部分止盈,细分状态
|
||||
if partial_profit_taken:
|
||||
if position_info.get('trailingStopActivated'):
|
||||
exit_reason_sl = 'take_profit_partial_then_trailing_stop'
|
||||
should_close_due_to_sl = True
|
||||
# ⚠️ 2026-01-27优化:如果已部分止盈,细分状态
|
||||
if partial_profit_taken:
|
||||
if position_info.get('trailingStopActivated'):
|
||||
exit_reason_sl = 'take_profit_partial_then_trailing_stop'
|
||||
else:
|
||||
exit_reason_sl = 'take_profit_partial_then_stop'
|
||||
else:
|
||||
exit_reason_sl = 'take_profit_partial_then_stop'
|
||||
else:
|
||||
exit_reason_sl = 'trailing_stop' if position_info.get('trailingStopActivated') else 'stop_loss'
|
||||
exit_reason_sl = 'trailing_stop' if position_info.get('trailingStopActivated') else 'stop_loss'
|
||||
|
||||
# 计算持仓时间
|
||||
entry_time = position_info.get('entryTime')
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user