更新bot前端显示
This commit is contained in:
@@ -339,12 +339,12 @@
|
||||
<h2 style="margin-bottom:8px">趋势回调策略</h2>
|
||||
<div class="rule-tip">
|
||||
① <strong>生成预览</strong>:读取合约 USDT <strong>可用余额快照</strong>并计算计划(不下单)。预览有效期 <strong>{{ trend_pullback_preview_ttl }} 秒</strong>。<br>
|
||||
② <strong>确认执行</strong>:市价首仓 50% + 挂交易所止损;剩余 50% 在止损与补仓上沿之间共 {{ trend_pullback_dca_legs }} 档(程序可能因最小张数自动减档)市价补仓;<strong>止盈由程序监控</strong>。<br>
|
||||
② <strong>确认执行</strong>:市价首仓 50% + 挂交易所止损;剩余 50% 在止损与补仓区间之间共 {{ trend_pullback_dca_legs }} 档(做多为<strong>上沿</strong>、做空为<strong>下沿</strong>;程序可能因最小张数自动减档)市价补仓;<strong>止盈由程序监控</strong>。<br>
|
||||
确认执行时若当前可用余额与预览快照相对偏差 > <strong>{{ trend_preview_max_drift_pct }}%</strong> 会拒绝并要求重新预览。
|
||||
</div>
|
||||
<form action="{{ url_for('preview_trend_pullback') }}" method="post" class="form-row">
|
||||
<form id="trend-pullback-form" action="{{ url_for('preview_trend_pullback') }}" method="post" class="form-row">
|
||||
<input name="symbol" placeholder="BTC 或 ETH/USDT" required>
|
||||
<select name="direction" required>
|
||||
<select name="direction" id="trend-direction" required>
|
||||
<option value="">方向</option>
|
||||
<option value="long">做多</option>
|
||||
<option value="short">做空</option>
|
||||
@@ -352,10 +352,25 @@
|
||||
<input name="leverage" type="number" min="1" step="1" placeholder="杠杆(必填)" required>
|
||||
<input name="risk_percent" type="number" min="0.1" step="0.1" value="5" placeholder="风险%相对可用快照" title="默认5:最坏亏损约≤可用余额×5%">
|
||||
<input name="sl" step="any" placeholder="止损价" required>
|
||||
<input name="add_upper" step="any" placeholder="补仓上沿价" required>
|
||||
<input name="add_upper" id="trend-add-upper" step="any" placeholder="补仓上沿价" required>
|
||||
<input name="take_profit" step="any" placeholder="止盈价(固定)" required>
|
||||
<button type="submit" {% if not can_trade %}disabled style="opacity:.5;cursor:not-allowed"{% endif %}>生成预览</button>
|
||||
</form>
|
||||
<script>
|
||||
(function(){
|
||||
const dirSel = document.getElementById("trend-direction");
|
||||
const addInp = document.getElementById("trend-add-upper");
|
||||
function syncAddUpperPlaceholder(){
|
||||
if(!addInp || !dirSel) return;
|
||||
const d = (dirSel.value || "long").toLowerCase();
|
||||
addInp.placeholder = d === "short" ? "补仓下沿价" : "补仓上沿价";
|
||||
}
|
||||
if(dirSel){
|
||||
dirSel.addEventListener("change", syncAddUpperPlaceholder);
|
||||
syncAddUpperPlaceholder();
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
|
||||
{% if trend_preview %}
|
||||
<div style="margin-top:14px;padding:12px;background:#141a2e;border:1px solid #2a3150;border-radius:8px">
|
||||
@@ -367,7 +382,7 @@
|
||||
{{ trend_preview.symbol }} {{ '做多' if trend_preview.direction == 'long' else '做空' }} {{ trend_preview.leverage }}x |
|
||||
预览可用快照 <strong>{{ money_fmt(trend_preview.snapshot_available_usdt) }}</strong> U | 参考价 {{ price_fmt(trend_preview.symbol, trend_preview.live_price_ref) }} |
|
||||
计划保证金≈{{ money_fmt(trend_preview.plan_margin_capital) }} U | 总张≈{{ amt_fmt(trend_preview.symbol, trend_preview.target_order_amount) }}(首仓 {{ amt_fmt(trend_preview.symbol, trend_preview.first_order_amount) }} + 补仓 {{ amt_fmt(trend_preview.symbol, trend_preview.remainder_total) }})<br>
|
||||
止损 {{ price_fmt(trend_preview.symbol, trend_preview.stop_loss) }} | 补仓上沿 {{ price_fmt(trend_preview.symbol, trend_preview.add_upper) }} | 止盈 {{ price_fmt(trend_preview.symbol, trend_preview.take_profit) }} | 风险比例 {{ trend_preview.risk_percent }}%
|
||||
止损 {{ price_fmt(trend_preview.symbol, trend_preview.stop_loss) }} | {{ trend_add_zone_label(trend_preview.direction) }} {{ price_fmt(trend_preview.symbol, trend_preview.add_upper) }} | 止盈 {{ price_fmt(trend_preview.symbol, trend_preview.take_profit) }} | 风险比例 {{ trend_preview.risk_percent }}%
|
||||
</div>
|
||||
<div class="table-wrap" style="margin-bottom:10px">
|
||||
<table>
|
||||
@@ -442,7 +457,7 @@
|
||||
</div>
|
||||
<div class="plan-card-meta">
|
||||
来源: 趋势回调计划 | 风险: {% if t.risk_percent is not none %}{{ t.risk_percent }}%{% else %}—{% endif %}
|
||||
| <span class="accent">补仓上沿 {{ price_fmt(sym, t.add_upper) }}</span>
|
||||
| <span class="accent">{{ trend_add_zone_label(t.direction) }} {{ price_fmt(sym, t.add_upper) }}</span>
|
||||
| 已补仓 <strong>{{ t.legs_done }}/{{ t.dca_legs }}</strong>
|
||||
</div>
|
||||
<div class="plan-card-grid">
|
||||
@@ -713,7 +728,7 @@ function openPreviewSnapshotDetail(id){
|
||||
`总张数:${s.target_order_amount != null ? s.target_order_amount : "-"}`,
|
||||
`首仓/补仓余:${s.first_order_amount != null ? s.first_order_amount : "-"} / ${s.remainder_total != null ? s.remainder_total : "-"}`,
|
||||
`补仓档数:${s.dca_legs != null ? s.dca_legs : "-"}`,
|
||||
`止损 / 补仓上沿 / 止盈:${s.stop_loss} / ${s.add_upper} / ${s.take_profit}`,
|
||||
`止损 / ${s.direction === "long" ? "补仓上沿" : "补仓下沿"} / 止盈:${s.stop_loss} / ${s.add_upper} / ${s.take_profit}`,
|
||||
`风险%:${s.risk_percent != null ? s.risk_percent : "-"}`,
|
||||
`网格价 JSON:${s.grid_prices_json || "[]"}`,
|
||||
`分档张数 JSON:${s.leg_amounts_json || "[]"}`,
|
||||
|
||||
Reference in New Issue
Block a user