{% extends "base.html" %} {% load static %} {% block title %}{{ strategy.name }} - 策略详情 - AgomTradePro{% endblock %} {% block content %}

{{ strategy.name }}

{% if strategy.strategy_type == 'rule_based' %}规则驱动 {% elif strategy.strategy_type == 'script_based' %}脚本驱动 {% elif strategy.strategy_type == 'hybrid' %}混合模式 {% elif strategy.strategy_type == 'ai_driven' %}AI驱动{% endif %} v{{ strategy.version }} {% if strategy.is_active %}激活中{% else %}已停用{% endif %}
基本信息
规则配置
执行测试
执行日志

📋 基本信息

{{ strategy.description|default:"暂无描述" }}
创建者
{{ strategy.created_by.username }}
创建时间
{{ strategy.created_at|date:"Y-m-d H:i" }}
更新时间
{{ strategy.updated_at|date:"Y-m-d H:i" }}

🛡️ 风控参数

单资产最大持仓
{{ strategy.max_position_pct }}%
总持仓上限
{{ strategy.max_total_position_pct }}%
止损比例
{{ strategy.stop_loss_pct|default:"未设置" }}%
{% if strategy.strategy_type == 'rule_based' or strategy.strategy_type == 'hybrid' %}

📐 规则配置

{{ rules|length }} 条规则
{% if rules %}
{% for rule in rules %}
{{ rule.rule_name }}
{{ rule.get_rule_type_display }} {{ rule.get_action_display }}
{{ rule.condition_json }}
{% endfor %}
{% else %}
暂无规则
{% endif %}
{% else %}
此策略类型不使用规则配置
{% endif %} {% if position_rule %}

🎯 仓位规则

{% if position_rule.is_active %}启用{% else %}停用{% endif %}
{{ position_rule.description|default:"暂无描述" }}
规则名称
{{ position_rule.name }}
价格精度
{{ position_rule.price_precision }}
更新时间
{{ position_rule.updated_at|date:"Y-m-d H:i" }}
买入条件
{{ position_rule.buy_condition_expr|default:"-" }}
卖出条件
{{ position_rule.sell_condition_expr|default:"-" }}
买入价
{{ position_rule.buy_price_expr }}
卖出价
{{ position_rule.sell_price_expr }}
止损价
{{ position_rule.stop_loss_expr }}
止盈价
{{ position_rule.take_profit_expr }}
仓位计算
{{ position_rule.position_size_expr }}
{% else %}
暂无仓位规则,编辑策略后可配置买卖价格、止损止盈和仓位表达式
{% endif %} {% if strategy.strategy_type == 'ai_driven' %}

🤖 AI 配置

{% if ai_config %}
Prompt 模板
{{ ai_config.prompt_template|default:"系统默认" }}
Chain 配置
{{ ai_config.chain_config|default:"未配置" }}
AI 服务商
{{ ai_config.ai_provider|default:"系统路由" }}
审核模式
{{ ai_config.get_approval_mode_display }}
温度 / Token
{{ ai_config.temperature }} / {{ ai_config.max_tokens }}
置信度阈值
{{ ai_config.confidence_threshold }}
{% else %}
暂无 AI 配置,编辑策略后可配置模型路由、审核模式和执行阈值
{% endif %}
{% endif %}

测试配置

提示:
测试功能使用模拟数据运行策略,不会实际执行交易。

测试结果

点击"运行测试"开始

执行评估(M3)

点击“执行评估”调用 `/api/strategy/execution/evaluate/`
暂无结果

📊 执行日志

{% if execution_logs %} {% for log in execution_logs %}
{{ log.execution_time|date:"Y-m-d H:i:s" }} {% if log.is_success %}成功{% else %}失败{% endif %}
{{ log.portfolio.account_name }} | 生成 {{ log.signals_generated|length }} 个信号 | 耗时 {{ log.execution_duration_ms }}ms
{% if log.error_message %}
错误:{{ log.error_message }} {% if log.error_traceback %}
查看堆栈跟踪
{{ log.error_traceback }}
{% endif %}
{% endif %}
{% endfor %} {% else %}
暂无执行记录
{% endif %}
{% if execution_logs|length >= 20 %}
{% endif %}
{% endblock %}