{ "name": "strategy_management", "kind": "management", "domain": "strategy", "description": "当用户想创建、查看、修改、删除、激活或复制策略模板时调用。策略模板不能直接启动运行;只有绑定了该策略的交易员可以启动。", "field_constraints": { "name": { "type": "string", "required": true, "max_length": 50, "description": "策略模板名称,必填,最多 50 个字符。" }, "description": { "type": "string", "description": "策略描述,可选。" }, "is_public": { "type": "bool", "default": false, "description": "是否发布到策略市场。" }, "config_visible": { "type": "bool", "default": true, "description": "发布到市场后,是否允许别人查看策略配置。" }, "lang": { "type": "enum", "values": ["zh", "en"], "default": "zh", "description": "策略语言,zh 或 en,影响 AI 决策时使用的语言。" }, "strategy_type": { "type": "enum", "values": ["ai_trading", "grid_trading"], "default": "ai_trading", "description": "策略类型:ai_trading(AI 量化)或 grid_trading(网格策略)。" }, "symbol": { "type": "string", "description": "网格策略的交易对,例如 BTCUSDT。" }, "source_type": { "type": "enum", "values": ["static", "ai500", "oi_top", "oi_low", "mixed"], "description": "选币来源类型。static=用户指定静态币池,ai500=AI500榜单,oi_top=持仓量增长,oi_low=持仓量下降,mixed=混合。" }, "static_coins": { "type": "string_array", "description": "静态币池,例如 [\"BTCUSDT\", \"ETHUSDT\"],source_type=static 时使用。" }, "excluded_coins": { "type": "string_array", "description": "排除币列表,所有来源均会排除这些币。" }, "primary_timeframe": { "type": "string", "values": ["1m", "3m", "5m", "15m", "30m", "1h", "2h", "4h", "6h", "8h", "12h", "1d", "3d", "1w"], "description": "主 K 线周期,例如 5m、15m、1h。" }, "selected_timeframes": { "type": "string_array", "description": "多周期分析时间框架列表,例如 [\"5m\",\"15m\",\"1h\"]。" }, "btceth_max_leverage": { "type": "int", "min": 1, "max": 20, "description": "BTC/ETH 最大杠杆倍数,范围 1~20。" }, "altcoin_max_leverage": { "type": "int", "min": 1, "max": 20, "description": "山寨币最大杠杆倍数,范围 1~20。" }, "max_positions": { "type": "int", "min": 1, "description": "最大同时持仓数量,最小 1。" }, "min_confidence": { "type": "int", "min": 0, "max": 100, "description": "最小开仓置信度,范围 0~100,数值越高开单越谨慎。" }, "min_risk_reward_ratio": { "type": "float", "min": 0.1, "description": "最小盈亏比,例如 1.5 表示每笔交易至少 1.5 倍风险收益比。" }, "custom_prompt": { "type": "text", "description": "自定义 AI 提示词,追加到策略基础提示词之后。" }, "role_definition": { "type": "text", "description": "AI 角色定义,描述 AI 的交易风格和定位。" }, "trading_frequency": { "type": "text", "description": "交易频率描述,例如:每天最多开 3 笔。" }, "entry_standards": { "type": "text", "description": "入场标准描述,例如:只在趋势明确时开仓。" }, "decision_process": { "type": "text", "description": "决策流程描述,例如:先看大周期趋势,再看小周期入场点。" }, "grid_count": { "type": "int", "min": 2, "description": "网格数量,grid_trading 类型专用,最小 2。" }, "total_investment": { "type": "float", "min": 0, "description": "网格总投入金额,grid_trading 类型专用。" }, "leverage": { "type": "int", "min": 1, "max": 5, "description": "网格策略杠杆倍数,手动页面当前范围 1~5。" }, "upper_price": { "type": "float", "description": "网格上边界价格,grid_trading 类型专用。" }, "lower_price": { "type": "float", "description": "网格下边界价格,grid_trading 类型专用,必须小于 upper_price。" }, "distribution": { "type": "enum", "values": ["uniform", "gaussian", "pyramid"], "description": "网格分布方式:uniform=均匀,gaussian=正态,pyramid=金字塔。" }, "use_atr_bounds": { "type": "bool", "default": false, "description": "网格边界是否改为按 ATR 动态计算。" }, "atr_multiplier": { "type": "float", "min": 0, "description": "ATR 边界倍数,use_atr_bounds=true 时使用。" }, "enable_direction_adjust": { "type": "bool", "default": false, "description": "是否启用方向偏置调整。" }, "direction_bias_ratio": { "type": "float", "min": 0, "description": "方向偏置比例,决定多空倾向强弱。" }, "max_drawdown_pct": { "type": "float", "min": 0, "max": 100, "description": "最大回撤百分比止损,范围 0~100。" }, "stop_loss_pct": { "type": "float", "min": 0, "max": 100, "description": "止损百分比,范围 0~100。" }, "daily_loss_limit_pct": { "type": "float", "min": 0, "max": 100, "description": "每日最大亏损比例,达到后当天停止新开仓。" }, "use_maker_only": { "type": "bool", "default": false, "description": "是否优先只挂 maker 单。" }, "use_ai500": { "type": "bool", "default": false, "description": "是否启用 AI500 榜单作为候选币来源。" }, "ai500_limit": { "type": "int", "min": 1, "description": "AI500 榜单选取数量。" }, "use_oi_top": { "type": "bool", "default": false, "description": "是否启用 OI Top 作为候选币来源。" }, "oi_top_limit": { "type": "int", "min": 1, "description": "OI Top 选取数量。" }, "use_oi_low": { "type": "bool", "default": false, "description": "是否启用 OI Low 作为候选币来源。" }, "oi_low_limit": { "type": "int", "min": 1, "description": "OI Low 选取数量。" }, "primary_count": { "type": "int", "min": 1, "description": "主周期样本数量。" }, "enable_ema": { "type": "bool", "default": false, "description": "是否启用 EMA 指标。" }, "enable_macd": { "type": "bool", "default": false, "description": "是否启用 MACD 指标。" }, "enable_rsi": { "type": "bool", "default": false, "description": "是否启用 RSI 指标。" }, "enable_atr": { "type": "bool", "default": false, "description": "是否启用 ATR 指标。" }, "enable_boll": { "type": "bool", "default": false, "description": "是否启用布林带指标。" }, "enable_volume": { "type": "bool", "default": false, "description": "是否启用成交量指标。" }, "enable_oi": { "type": "bool", "default": false, "description": "是否启用持仓量指标。" }, "enable_funding_rate": { "type": "bool", "default": false, "description": "是否启用资金费率指标。" }, "ema_periods": { "type": "int_array", "description": "EMA 周期列表,例如 [9,21,55]。" }, "rsi_periods": { "type": "int_array", "description": "RSI 周期列表。" }, "atr_periods": { "type": "int_array", "description": "ATR 周期列表。" }, "boll_periods": { "type": "int_array", "description": "布林带周期列表。" }, "nofxos_api_key": { "type": "credential", "description": "量化数据 API Key。" }, "enable_quant_data": { "type": "bool", "default": false, "description": "是否启用量化数据增强。" }, "enable_quant_oi": { "type": "bool", "default": false, "description": "是否启用量化持仓量数据。" }, "enable_quant_netflow": { "type": "bool", "default": false, "description": "是否启用量化净流入数据。" }, "enable_oi_ranking": { "type": "bool", "default": false, "description": "是否启用 OI 排行榜。" }, "oi_ranking_duration": { "type": "string", "description": "OI 排行榜统计周期。" }, "oi_ranking_limit": { "type": "int", "min": 1, "description": "OI 排行榜返回数量。" }, "enable_netflow_ranking": { "type": "bool", "default": false, "description": "是否启用净流入排行榜。" }, "netflow_ranking_duration": { "type": "string", "description": "净流入排行榜统计周期。" }, "netflow_ranking_limit": { "type": "int", "min": 1, "description": "净流入排行榜返回数量。" }, "enable_price_ranking": { "type": "bool", "default": false, "description": "是否启用价格波动排行榜。" }, "price_ranking_duration": { "type": "string", "description": "价格排行榜统计周期。" }, "price_ranking_limit": { "type": "int", "min": 1, "description": "价格排行榜返回数量。" }, "btceth_max_position_value_ratio": { "type": "float", "min": 0, "description": "BTC/ETH 单仓最大仓位价值占比。" }, "altcoin_max_position_value_ratio": { "type": "float", "min": 0, "description": "山寨币单仓最大仓位价值占比。" }, "max_margin_usage": { "type": "float", "min": 0, "description": "最大保证金占用比例。" } }, "validation_rules": [ "btceth_max_leverage 和 altcoin_max_leverage 范围均为 1~20,超出时自动收敛并告知用户。", "grid_trading 的 leverage 需与手动页面一致,范围 1~5,超出时自动收敛并告知用户。", "min_confidence 范围 0~100,超出时自动收敛并告知用户。", "grid_trading 类型时,lower_price 必须小于 upper_price,否则提示用户修正。", "grid_count 最小为 2,低于 2 时提示用户修正。", "策略模板不能直接启动运行,只有绑定了该策略的交易员才能启动。", "删除操作不可逆,必须先向用户确认再执行。", "激活(activate)操作将该策略设为默认模板,不是启动运行。", "scan_interval_minutes、initial_balance、lighter_api_key_index 这类交易员/交易所边界值不属于策略本身,若用户在改策略时提到,应引导去对应 trader 或 exchange 配置。", "btceth_max_position_value_ratio、altcoin_max_position_value_ratio、max_margin_usage 等风控字段若越界,应先自动收敛或提示用户确认修正后的值。", "最小开仓金额是系统固定值 12 USDT,Agent 不能修改;若用户要求改这个值,应直接说明这是手动面板中的 System enforced 固定项。", "启用量化数据相关开关时,若需要 nofxos_api_key,应主动提醒用户补齐。", "启用排行榜相关能力时,只修改用户明确提到的 enable_*、duration、limit 字段,不要偷偷打开其他排行榜。" ], "actions": { "create": { "description": "创建策略模板。至少需要名称,其他配置可按需追问或按默认值补齐。", "required_slots": ["name"], "optional_slots": ["description", "is_public", "config_visible", "lang", "strategy_type", "symbol", "source_type", "static_coins", "excluded_coins", "primary_timeframe", "selected_timeframes", "btceth_max_leverage", "altcoin_max_leverage", "max_positions", "min_confidence", "min_risk_reward_ratio", "custom_prompt", "role_definition", "trading_frequency", "entry_standards", "decision_process", "use_atr_bounds", "atr_multiplier", "enable_direction_adjust", "direction_bias_ratio", "grid_count", "total_investment", "leverage", "upper_price", "lower_price", "distribution", "max_drawdown_pct", "stop_loss_pct", "daily_loss_limit_pct", "use_maker_only", "use_ai500", "ai500_limit", "use_oi_top", "oi_top_limit", "use_oi_low", "oi_low_limit", "primary_count", "enable_ema", "enable_macd", "enable_rsi", "enable_atr", "enable_boll", "enable_volume", "enable_oi", "enable_funding_rate", "ema_periods", "rsi_periods", "atr_periods", "boll_periods", "nofxos_api_key", "enable_quant_data", "enable_quant_oi", "enable_quant_netflow", "enable_oi_ranking", "oi_ranking_duration", "oi_ranking_limit", "enable_netflow_ranking", "netflow_ranking_duration", "netflow_ranking_limit", "enable_price_ranking", "price_ranking_duration", "price_ranking_limit", "btceth_max_position_value_ratio", "altcoin_max_position_value_ratio", "max_margin_usage"], "goal": "创建一个可供 trader 绑定使用的策略模板。", "dynamic_rules": [ "若用户只是要给 trader 绑定现有策略,应优先在父任务里补 strategy 槽位,而不是误开新的 create。", "若用户明确要求新建策略,至少先收齐名称;其他配置可继续追问或按默认值协助补齐。", "策略模板不能直接启动运行;本动作成功后通常返回 strategy_id 供后续 trader 绑定使用。", "杠杆超出 1~20 范围时,自动收敛并告知用户。" ], "success_output": "返回 strategy_id 和新策略摘要(名称、类型、主要配置)。", "failure_output": "明确指出仍缺哪些核心参数,或说明需要先确认的风控收敛结果。" }, "update": { "description": "更新策略模板的任意可编辑字段。", "required_slots": ["target_ref"], "optional_slots": ["name", "description", "is_public", "config_visible", "symbol", "source_type", "static_coins", "excluded_coins", "primary_timeframe", "selected_timeframes", "btceth_max_leverage", "altcoin_max_leverage", "max_positions", "min_confidence", "min_risk_reward_ratio", "custom_prompt", "role_definition", "trading_frequency", "entry_standards", "decision_process", "grid_count", "total_investment", "leverage", "upper_price", "lower_price", "distribution", "use_atr_bounds", "atr_multiplier", "enable_direction_adjust", "direction_bias_ratio", "max_drawdown_pct", "stop_loss_pct", "daily_loss_limit_pct", "use_maker_only", "use_ai500", "ai500_limit", "use_oi_top", "oi_top_limit", "use_oi_low", "oi_low_limit", "primary_count", "enable_ema", "enable_macd", "enable_rsi", "enable_atr", "enable_boll", "enable_volume", "enable_oi", "enable_funding_rate", "ema_periods", "rsi_periods", "atr_periods", "boll_periods", "nofxos_api_key", "enable_quant_data", "enable_quant_oi", "enable_quant_netflow", "enable_oi_ranking", "oi_ranking_duration", "oi_ranking_limit", "enable_netflow_ranking", "netflow_ranking_duration", "netflow_ranking_limit", "enable_price_ranking", "price_ranking_duration", "price_ranking_limit", "btceth_max_position_value_ratio", "altcoin_max_position_value_ratio", "max_margin_usage"], "goal": "更新一个已有策略模板的指定配置,而不覆盖未提及字段。", "dynamic_rules": [ "只更新用户明确提到的字段,不要覆盖未提及的字段。", "杠杆超出 1~20 范围时,自动收敛并告知用户。", "grid_trading 类型时,lower_price 必须小于 upper_price。" ], "success_output": "返回 strategy_id 和更新后的策略摘要。", "failure_output": "明确指出目标策略不存在、参数非法,或仍缺哪个关键字段。" }, "update_name": { "description": "仅修改策略模板名称。", "required_slots": ["target_ref", "name"], "goal": "仅修改策略模板名称。", "dynamic_rules": [ "若输入里还包含其他配置项,应优先转去更通用的 update 或 update_config。" ], "success_output": "返回 strategy_id,并明确告知新的策略名称。", "failure_output": "明确指出目标策略不存在,或新的名称仍未收齐。" }, "update_prompt": { "description": "仅修改策略的 custom_prompt 或 prompt_sections(role_definition、trading_frequency、entry_standards、decision_process)。", "required_slots": ["target_ref"], "optional_slots": ["custom_prompt", "role_definition", "trading_frequency", "entry_standards", "decision_process"], "goal": "更新策略模板的提示词相关内容,而不改动其他配置。", "dynamic_rules": [ "若用户一次修改多个 prompt section,应整体应用并在结果里清楚说明。", "若用户实际是在改纯配置项,应转去 update_config。", "当需要收集 custom_prompt 或 prompt_sections 等长文本槽位,而用户表达了“交给你”“你帮我写”“你自己设计”等委托生成意图时,严禁再次机械索要原文。", "此时你必须直接以量化专家身份先拟出一版高质量文本,将生成内容写入对应字段,并在回复里展示草稿让用户确认是否直接采用。" ], "success_output": "返回 strategy_id,并明确告知哪些 prompt 字段已更新。", "failure_output": "明确指出目标策略不存在,或新的 prompt 内容仍不完整。" }, "update_config": { "description": "修改策略的某个具体配置参数(选币来源、指标、风控参数等)。", "required_slots": ["target_ref", "config_field", "config_value"], "goal": "修改策略模板中的一个或一组具体配置参数。", "dynamic_rules": [ "配置值超出手动面板边界时,应先自动收敛并明确告知用户。", "若用户一次提到多个配置 patch,可在同一轮内整体应用,但要明确说明最终修改了哪些字段。", "当配置更新涉及 custom_prompt、role_definition、trading_frequency、entry_standards、decision_process、description、name 等文本槽位,且用户表达了“交给你”“你帮我写”“你自己设计”等委托生成意图时,严禁再次向用户索要正文。", "此时你必须直接生成一版可用文本,写入对应 extracted 字段,并用确认式问题向用户展示:“我先为你拟了一版……,要直接按这版更新吗?”" ], "success_output": "返回 strategy_id,并明确告知已修改的配置字段及其最终值。", "failure_output": "明确指出目标策略不存在、配置字段非法,或值仍需用户澄清。" }, "activate": { "description": "将策略模板设为默认模板(激活)。注意:这不是启动运行,只是设为默认。", "required_slots": ["target_ref"], "goal": "将某个策略模板设为默认模板,而不是直接运行它。", "dynamic_rules": [ "必须明确区分“激活模板”和“启动交易员运行”,不要把 activate 解释成运行。" ], "success_output": "返回 strategy_id,并明确告知该策略已被设为默认模板。", "failure_output": "明确指出目标策略不存在,或激活失败原因。" }, "duplicate": { "description": "复制策略模板,生成一个新的同配置模板。", "required_slots": ["target_ref", "name"], "goal": "复制一个现有策略模板并生成新的模板名称。", "dynamic_rules": [ "新名称必须单独收齐;若名称有歧义或为空,应先继续追问。" ], "success_output": "返回新的 strategy_id,并明确告知复制后的策略名称。", "failure_output": "明确指出目标策略不存在,或新名称仍未收齐。" }, "delete": { "description": "删除策略模板,不可逆操作,必须确认。", "required_slots": ["target_ref"], "needs_confirmation": true, "goal": "删除一个策略模板。", "dynamic_rules": [ "必须在确认后执行,并明确提醒删除不可逆。", "若策略是默认模板或受系统保护,应向用户解释限制。" ], "success_output": "返回删除成功结果,并明确告知该策略模板已被移除。", "failure_output": "明确指出缺少确认、目标策略不存在,或删除失败原因。" }, "query_list": { "description": "查询所有策略模板列表,包含名称、类型、是否为默认模板。", "goal": "列出当前用户可见的策略模板,便于后续选择或绑定。", "dynamic_rules": [ "优先返回名称、类型、默认状态,不必展开全部详细配置。" ], "success_output": "返回策略模板列表摘要。", "failure_output": "若列表为空,应明确告知当前没有策略模板。" }, "query_detail": { "description": "查询某个策略模板的详细配置,包括选币来源、指标、风控参数、提示词等。", "required_slots": ["target_ref"], "goal": "读取一个策略模板的详细配置。", "dynamic_rules": [ "若目标有歧义,应先澄清再返回详情。" ], "success_output": "返回目标策略模板的详细配置摘要。", "failure_output": "明确指出目标策略不存在,或当前引用已经失效。" } }, "tool_mapping": { "create": "manage_strategy:create", "update": "manage_strategy:update", "update_name": "manage_strategy:update", "update_prompt": "manage_strategy:update", "update_config": "manage_strategy:update", "activate": "manage_strategy:activate", "duplicate": "manage_strategy:duplicate", "delete": "manage_strategy:delete", "query_list": "get_strategies", "query_detail": "get_strategies" } }