feat(config): Add staggered scanning configuration for multi-account setups
Introduced new configuration options for staggered scanning in multi-account scenarios to reduce concurrency pressure. This includes settings for enabling staggered scanning, random delay intervals, and minimum/maximum delay times. Updated frontend components to reflect these new configurations and their descriptions, enhancing user awareness and control over scanning behavior.
This commit is contained in:
parent
78007040f1
commit
849b550910
|
|
@ -593,6 +593,37 @@ async def get_global_configs(
|
|||
"category": "strategy",
|
||||
"description": "做空时 24h 涨跌幅超过此值则不做空(24h 仍大涨时不做空)。单位:百分比数值。2026-01-31新增。",
|
||||
},
|
||||
# 多账号错峰启动扫描(避免多个账号同时扫同时下单)
|
||||
"SCAN_STAGGER_BY_ACCOUNT": {
|
||||
"value": False,
|
||||
"type": "boolean",
|
||||
"category": "scan",
|
||||
"description": "多账号错峰扫描总开关:True=不同账号在首次扫描前随机/按账号ID延迟一段时间,减少并发压力;单账号可保持 False。",
|
||||
},
|
||||
"SCAN_STAGGER_RANDOM": {
|
||||
"value": True,
|
||||
"type": "boolean",
|
||||
"category": "scan",
|
||||
"description": "错峰方式:True=在区间 [SCAN_STAGGER_MIN_SEC, SCAN_STAGGER_MAX_SEC] 内随机延迟;False=按账号ID固定间隔延迟 (account_id-1)*SCAN_STAGGER_SEC。",
|
||||
},
|
||||
"SCAN_STAGGER_MIN_SEC": {
|
||||
"value": 10,
|
||||
"type": "number",
|
||||
"category": "scan",
|
||||
"description": "随机错峰模式下的最小延迟秒数(含)。例如 10 表示至少延迟 10 秒。",
|
||||
},
|
||||
"SCAN_STAGGER_MAX_SEC": {
|
||||
"value": 120,
|
||||
"type": "number",
|
||||
"category": "scan",
|
||||
"description": "随机错峰模式下的最大延迟秒数(含)。例如 120 表示至多延迟 120 秒。",
|
||||
},
|
||||
"SCAN_STAGGER_SEC": {
|
||||
"value": 60,
|
||||
"type": "number",
|
||||
"category": "scan",
|
||||
"description": "固定错峰模式下每个账号之间的步长秒数:延迟 = (account_id-1)*SCAN_STAGGER_SEC。",
|
||||
},
|
||||
}
|
||||
for k, meta in ADDITIONAL_STRATEGY_DEFAULTS.items():
|
||||
if k not in result:
|
||||
|
|
|
|||
|
|
@ -35,6 +35,11 @@ const KEY_LABELS = {
|
|||
SYNC_RECOVER_MISSING_POSITIONS: '同步时补建缺失持仓',
|
||||
SYNC_RECOVER_ONLY_WHEN_HAS_SLTP: '仅当有止损/止盈单时补建',
|
||||
SYSTEM_ORDER_ID_PREFIX: '系统单 clientOrderId 前缀',
|
||||
SCAN_STAGGER_BY_ACCOUNT: '多账号错峰扫描',
|
||||
SCAN_STAGGER_RANDOM: '错峰随机模式',
|
||||
SCAN_STAGGER_MIN_SEC: '错峰最小延迟(秒)',
|
||||
SCAN_STAGGER_MAX_SEC: '错峰最大延迟(秒)',
|
||||
SCAN_STAGGER_SEC: '固定错峰步长(秒)',
|
||||
}
|
||||
|
||||
// 配置项详细说明(用于导出的策略配置分析,含建议与参数说明)
|
||||
|
|
@ -95,6 +100,11 @@ const CONFIG_GUIDE_DETAILS = {
|
|||
SYMBOL_LOSS_COOLDOWN_ENABLED: '连续亏损冷却开关。开启后,同一交易对连续亏损达到阈值则禁止交易一段时间,避免连续亏损。',
|
||||
SYMBOL_MAX_CONSECUTIVE_LOSSES: '最大允许连续亏损次数。超过后触发该交易对的冷却。',
|
||||
SYMBOL_LOSS_COOLDOWN_SEC: '连续亏损后的冷却时间(秒),默认 3600(1小时)。',
|
||||
SCAN_STAGGER_BY_ACCOUNT: '多账号错峰扫描总开关。开启后,每个账号在首次启动扫描前会延迟一段时间,避免多个账号同时对币安扫行情/下单,减少并发与限频风险;单账号可以关闭。',
|
||||
SCAN_STAGGER_RANDOM: '错峰模式选择:True=在 [SCAN_STAGGER_MIN_SEC, SCAN_STAGGER_MAX_SEC] 区间内随机延迟(更分散且不规则);False=按账号ID固定间隔延迟 (account_id-1)*SCAN_STAGGER_SEC(可预测)。',
|
||||
SCAN_STAGGER_MIN_SEC: '随机错峰模式下的最小延迟秒数。例如 10 表示至少延迟 10 秒。建议:多账号时可设 10-30。',
|
||||
SCAN_STAGGER_MAX_SEC: '随机错峰模式下的最大延迟秒数。例如 120 表示至多延迟 120 秒。建议:多账号时可设 60-300,根据你能接受的最大启动等待时间调整。',
|
||||
SCAN_STAGGER_SEC: '固定错峰模式下每个账号之间的步长(秒)。实际延迟 = (account_id-1)*SCAN_STAGGER_SEC。例如 account_id=3 且步长 60,则延迟 120 秒后开始扫描。',
|
||||
}
|
||||
|
||||
const ConfigItem = ({ label, config, onUpdate, disabled }) => {
|
||||
|
|
@ -571,6 +581,12 @@ const GlobalConfig = () => {
|
|||
// 基于7天统计自动生成的全局过滤结果(仅展示,自动更新)
|
||||
STATS_SYMBOL_FILTERS: { value: {}, type: 'json', category: 'stats', description: '基于最近 N 天交易统计自动生成的 symbol 白/黑名单(软降权),由脚本 aggregate_trade_stats.py 自动更新,请勿手动修改。' },
|
||||
STATS_HOUR_FILTERS: { value: {}, type: 'json', category: 'stats', description: '基于最近 N 天交易统计自动生成的按小时过滤建议,用于差时段减仓/提门槛,由脚本 aggregate_trade_stats.py 自动更新,请勿手动修改。' },
|
||||
// 多账号错峰扫描配置
|
||||
SCAN_STAGGER_BY_ACCOUNT: { value: false, type: 'boolean', category: 'scan', description: '多账号错峰扫描总开关。开启后,不同账号会在首次扫描前延迟一段时间,避免同时扫行情与下单;单账号可保持关闭。' },
|
||||
SCAN_STAGGER_RANDOM: { value: true, type: 'boolean', category: 'scan', description: '错峰方式:True=在区间 [SCAN_STAGGER_MIN_SEC, SCAN_STAGGER_MAX_SEC] 内随机延迟;False=按账号ID固定间隔延迟 (account_id-1)*SCAN_STAGGER_SEC。' },
|
||||
SCAN_STAGGER_MIN_SEC: { value: 10, type: 'number', category: 'scan', description: '随机错峰模式下的最小延迟秒数。例如 10 表示至少延迟 10 秒。' },
|
||||
SCAN_STAGGER_MAX_SEC: { value: 120, type: 'number', category: 'scan', description: '随机错峰模式下的最大延迟秒数。例如 120 表示至多延迟 120 秒。' },
|
||||
SCAN_STAGGER_SEC: { value: 60, type: 'number', category: 'scan', description: '固定错峰模式下每个账号之间的步长(秒)。延迟 = (account_id-1)*SCAN_STAGGER_SEC。' },
|
||||
}
|
||||
|
||||
const loadConfigs = async () => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user