增加策略交易
This commit is contained in:
@@ -0,0 +1,106 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>顺势加仓 · {{ exchange_display }}</title>
|
||||
<style>
|
||||
body{font-family:system-ui,sans-serif;background:#0f1117;color:#e6e8ef;margin:0;padding:16px}
|
||||
.container{max-width:1100px;margin:0 auto}
|
||||
.top-nav{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:12px}
|
||||
.top-nav a{padding:6px 10px;border:1px solid #304164;border-radius:8px;background:#151a2a;color:#8fc8ff;text-decoration:none}
|
||||
.top-nav a.active{background:#2a3f6c;color:#dbe4ff}
|
||||
.card{background:#151a2a;border:1px solid #2a3150;border-radius:10px;padding:14px;margin-bottom:12px}
|
||||
.form-row{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:8px}
|
||||
.form-row input,.form-row select{padding:8px 10px;border-radius:6px;border:1px solid #3a4a66;background:#0f1420;color:#eee;min-width:120px}
|
||||
.form-row button{padding:8px 14px;border-radius:8px;border:none;background:#2d6a4f;color:#fff;cursor:pointer}
|
||||
.rule-tip{font-size:.8rem;color:#8892b0;line-height:1.5;margin-bottom:10px}
|
||||
.flash{background:#1f2a44;border:1px solid #3a5a8a;padding:10px;border-radius:8px;margin-bottom:12px}
|
||||
table{width:100%;border-collapse:collapse;font-size:.82rem}
|
||||
th,td{border-bottom:1px solid #2a3150;padding:6px 8px;text-align:left}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>策略交易 · 顺势加仓 <span style="font-size:.85rem;color:#8fc8ff">{{ exchange_display }}</span></h1>
|
||||
<div class="top-nav">
|
||||
<a href="/trade">实盘下单</a>
|
||||
<a href="/strategy/trend">趋势回调</a>
|
||||
<a href="/strategy/roll" class="active">顺势加仓</a>
|
||||
<a href="/records">交易复盘</a>
|
||||
</div>
|
||||
{% with messages = get_flashed_messages() %}{% if messages %}<div class="flash">{{ messages[0] }}</div>{% endif %}{% endwith %}
|
||||
|
||||
<div class="card">
|
||||
<h2 style="margin:0 0 8px">规则说明</h2>
|
||||
<div class="rule-tip">
|
||||
<strong>仅人工加仓</strong>,程序不会自动触发。须先在「实盘下单」有同向持仓。<br>
|
||||
做多最多滚仓 <strong>3</strong> 次;止盈<strong>锁定首仓</strong>不变;每次填写<strong>新统一止损</strong>,总风险%按「合并持仓打到新止损≈账户风险」反推张数。<br>
|
||||
斐波限价:上沿 H、下沿 L 仅用于算 0.618/0.786 加仓价(多:下沿=止损侧;空:上沿=止损侧)。<br>
|
||||
{% if trend_active %}<span style="color:#ff8f8f">当前有运行中的趋势回调计划,请先结束后再滚仓。</span>{% endif %}
|
||||
</div>
|
||||
<form action="{{ url_for('strategy_roll_execute') }}" method="post" class="form-row">
|
||||
<select name="symbol" required>
|
||||
<option value="">选择持仓币种</option>
|
||||
{% for o in monitors %}
|
||||
<option value="{{ o.symbol }}">{{ o.symbol }} {{ '多' if o.direction=='long' else '空' }} #{{ o.id }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<select name="direction">
|
||||
<option value="long">做多</option>
|
||||
<option value="short">做空</option>
|
||||
</select>
|
||||
<select name="add_mode">
|
||||
<option value="market">市价加仓</option>
|
||||
<option value="fib_618">限价 斐波0.618</option>
|
||||
<option value="fib_786">限价 斐波0.786</option>
|
||||
</select>
|
||||
<input name="fib_upper" step="any" placeholder="上沿 H">
|
||||
<input name="fib_lower" step="any" placeholder="下沿 L">
|
||||
<input name="new_stop_loss" step="any" placeholder="新统一止损" required>
|
||||
<input name="risk_percent" type="number" min="0.1" step="0.1" value="{{ default_risk_percent }}" placeholder="总风险%">
|
||||
<button type="submit" {% if trend_active %}disabled{% endif %} onclick="return confirm('确认按预览逻辑实盘加仓并更新止损?')">执行滚仓</button>
|
||||
</form>
|
||||
<p class="rule-tip">建议执行前用浏览器开发者工具 POST <code>/strategy/roll/preview</code> 查看 JSON 预览(或将加入页面内预览按钮)。</p>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h3>活跃滚仓组</h3>
|
||||
<table>
|
||||
<tr><th>ID</th><th>币种</th><th>方向</th><th>腿数</th><th>首仓TP</th><th>当前SL</th></tr>
|
||||
{% for g in roll_groups %}
|
||||
<tr>
|
||||
<td>{{ g.id }}</td>
|
||||
<td>{{ g.symbol }}</td>
|
||||
<td>{{ g.direction }}</td>
|
||||
<td>{{ g.leg_count }}</td>
|
||||
<td>{% if price_fmt %}{{ price_fmt(g.symbol, g.initial_take_profit) }}{% else %}{{ g.initial_take_profit }}{% endif %}</td>
|
||||
<td>{% if price_fmt %}{{ price_fmt(g.symbol, g.current_stop_loss) }}{% else %}{{ g.current_stop_loss }}{% endif %}</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr><td colspan="6" style="color:#8892b0">暂无</td></tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h3>最近滚仓腿</h3>
|
||||
<table>
|
||||
<tr><th>#</th><th>组</th><th>方式</th><th>张数</th><th>新SL</th><th>状态</th></tr>
|
||||
{% for leg in roll_legs %}
|
||||
<tr>
|
||||
<td>{{ leg.leg_index }}</td>
|
||||
<td>{{ leg.roll_group_id }}</td>
|
||||
<td>{{ leg.add_mode }}</td>
|
||||
<td>{{ leg.amount }}</td>
|
||||
<td>{{ leg.new_stop_loss }}</td>
|
||||
<td>{{ leg.status }}</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr><td colspan="6" style="color:#8892b0">暂无</td></tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>趋势回调 · {{ exchange_display }}</title>
|
||||
<style>
|
||||
body{font-family:system-ui,sans-serif;background:#0f1117;color:#e6e8ef;padding:24px}
|
||||
a{color:#8fc8ff;margin-right:10px}
|
||||
.box{max-width:640px;background:#151a2a;border:1px solid #2a3150;padding:20px;border-radius:10px}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<p><a href="/trade">← 实盘下单</a> <a href="/strategy/roll">顺势加仓</a></p>
|
||||
<div class="box">
|
||||
<h1>趋势回调</h1>
|
||||
<p>{{ trend_note }}</p>
|
||||
<p style="color:#8892b0;font-size:.9rem">趋势回调含自动补仓档位,仅在 Gate 趋势机器人(crypto_monitor_gate_bot)实例中运行。</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user