0bebdd5717
Co-authored-by: Cursor <cursoragent@cursor.com>
217 lines
8.8 KiB
HTML
217 lines
8.8 KiB
HTML
{% extends "base.html" %}
|
|
{% block title %}交易记录与复盘 - 国内期货监控系统{% endblock %}
|
|
{% block content %}
|
|
<h1 class="page-title">交易复盘记录上传(含截图)</h1>
|
|
|
|
<div class="card">
|
|
<form action="{{ url_for('add_review') }}" method="post" enctype="multipart/form-data">
|
|
<div class="form-grid">
|
|
<div class="field">
|
|
<label>开仓时间</label>
|
|
<input type="datetime-local" name="open_time" required>
|
|
</div>
|
|
<div class="field">
|
|
<label>平仓时间</label>
|
|
<input type="datetime-local" name="close_time" required>
|
|
</div>
|
|
<div class="field">
|
|
<label>品种</label>
|
|
<input name="symbol" placeholder="如 ag2608" required>
|
|
</div>
|
|
<div class="field">
|
|
<label>周期</label>
|
|
<input name="timeframe" placeholder="5m" value="5m">
|
|
</div>
|
|
<div class="field">
|
|
<label>盈亏(U)</label>
|
|
<input name="pnl" type="number" step="0.01" placeholder="盈亏金额">
|
|
</div>
|
|
<div class="field full">
|
|
<label>开仓类型(必选)</label>
|
|
<select name="open_type" required>
|
|
<option value="">请选择</option>
|
|
{% for t in open_types %}
|
|
<option value="{{ t }}">{{ t }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
<div class="field">
|
|
<label>预期 RR</label>
|
|
<input name="expected_rr" type="number" step="0.01" placeholder="预期盈亏比">
|
|
</div>
|
|
<div class="field">
|
|
<label>实际 RR</label>
|
|
<input name="actual_rr" type="number" step="0.01" placeholder="实际盈亏比">
|
|
</div>
|
|
<div class="field">
|
|
<label>离场触发(必选)</label>
|
|
<select name="exit_trigger" required>
|
|
<option value="">请选择</option>
|
|
{% for t in exit_triggers %}
|
|
<option value="{{ t }}">{{ t }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
<div class="field">
|
|
<label>离场补充(仅手工平仓必填)</label>
|
|
<input name="exit_supplement" placeholder="手工平仓说明">
|
|
</div>
|
|
<div class="field">
|
|
<label>保本后盯盘</label>
|
|
<select name="watch_after_breakeven">
|
|
<option value="否">否</option>
|
|
<option value="是">是</option>
|
|
</select>
|
|
</div>
|
|
<div class="field">
|
|
<label>占用时新开仓</label>
|
|
<select name="new_position_while_occupied">
|
|
<option value="否">否</option>
|
|
<option value="是">是</option>
|
|
</select>
|
|
</div>
|
|
<div class="field">
|
|
<label>截图上传</label>
|
|
<input type="file" name="screenshot" accept="image/*">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="check-row">
|
|
<label><input type="checkbox" name="auto_kline" value="1"> 保存时自动生成 K 线图并作为截图</label>
|
|
</div>
|
|
<div class="form-grid">
|
|
<div class="field">
|
|
<label>周期1</label>
|
|
<select name="kline_period1">
|
|
{% for p in kline_periods %}
|
|
<option value="{{ p }}" {% if p == '15m' %}selected{% endif %}>{{ p }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
<div class="field">
|
|
<label>周期2</label>
|
|
<select name="kline_period2">
|
|
{% for p in kline_periods %}
|
|
<option value="{{ p }}" {% if p == '1h' %}selected{% endif %}>{{ p }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
<div class="field">
|
|
<label>K线数</label>
|
|
<input name="kline_count" type="number" value="300" min="50" max="1000">
|
|
</div>
|
|
<div class="field">
|
|
<label>K线截止</label>
|
|
<select name="kline_cutoff">
|
|
{% for c in kline_cutoffs %}
|
|
<option value="{{ c }}">{{ c }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<p class="hint">勾选自动生成时,将按所选周期上下排列 K 线图;截止时间为平仓/开仓/当前,用于截取行情片段。</p>
|
|
|
|
<div class="check-row">
|
|
{% for tag in behavior_tags %}
|
|
<label><input type="checkbox" name="tag_{{ tag }}" value="1"> {{ tag }}</label>
|
|
{% endfor %}
|
|
</div>
|
|
|
|
<div class="field" style="margin-top:1rem">
|
|
<label>备注</label>
|
|
<textarea name="notes" placeholder="复盘备注"></textarea>
|
|
</div>
|
|
|
|
<button type="submit" class="btn-primary" style="margin-top:1rem">保存复盘记录</button>
|
|
</form>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<h2>复盘历史</h2>
|
|
<form method="get" class="filter-row">
|
|
<div class="field">
|
|
<label>开始日期</label>
|
|
<input type="date" name="start" value="{{ start }}">
|
|
</div>
|
|
<div class="field">
|
|
<label>结束日期</label>
|
|
<input type="date" name="end" value="{{ end }}">
|
|
</div>
|
|
<button type="submit" class="btn-primary">筛选</button>
|
|
<a href="{{ url_for('records') }}" style="color:#888;font-size:.85rem;padding:.7rem">重置</a>
|
|
</form>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>开仓</th>
|
|
<th>平仓</th>
|
|
<th>品种</th>
|
|
<th>周期</th>
|
|
<th>盈亏</th>
|
|
<th>开仓类型</th>
|
|
<th>预期RR</th>
|
|
<th>实际RR</th>
|
|
<th>离场</th>
|
|
<th>行为标签</th>
|
|
<th>截图</th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for r in reviews %}
|
|
<tr>
|
|
<td>{{ r.open_time[:16] if r.open_time else '' }}</td>
|
|
<td>{{ r.close_time[:16] if r.close_time else '' }}</td>
|
|
<td>{{ r.symbol }}</td>
|
|
<td>{{ r.timeframe }}</td>
|
|
<td>
|
|
{% if r.pnl and r.pnl > 0 %}<span class="badge profit">{{ r.pnl }}</span>
|
|
{% elif r.pnl and r.pnl < 0 %}<span class="badge loss">{{ r.pnl }}</span>
|
|
{% else %}{{ r.pnl or '-' }}{% endif %}
|
|
</td>
|
|
<td>{{ r.open_type }}</td>
|
|
<td>{{ r.expected_rr or '-' }}</td>
|
|
<td>{{ r.actual_rr or '-' }}</td>
|
|
<td>{{ r.exit_trigger }}</td>
|
|
<td style="font-size:.8rem">{{ r.behavior_tags or '-' }}</td>
|
|
<td>
|
|
{% if r.screenshot %}
|
|
<a href="{{ url_for('uploaded_file', filename=r.screenshot) }}" target="_blank" style="color:#4cc2ff">查看</a>
|
|
{% else %}-{% endif %}
|
|
</td>
|
|
<td><a href="{{ url_for('del_review', rid=r.id) }}" class="btn-del" onclick="return confirm('删除?')">删</a></td>
|
|
</tr>
|
|
{% else %}
|
|
<tr><td colspan="12" style="color:#888">暂无复盘记录</td></tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
{% if auto_records %}
|
|
<div class="card">
|
|
<h2>系统自动记录(止盈/止损)</h2>
|
|
<table>
|
|
<thead>
|
|
<tr><th>品种</th><th>类型</th><th>方向</th><th>触发价</th><th>结果</th><th>时间</th></tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for r in auto_records %}
|
|
<tr>
|
|
<td>{{ r.symbol_name or r.symbol }}</td>
|
|
<td>{{ r.monitor_type }}</td>
|
|
<td><span class="badge dir">{{ '做多' if r.direction == 'long' else '做空' }}</span></td>
|
|
<td>{{ r.trigger_price }}</td>
|
|
<td>
|
|
{% if r.result == '止盈' %}<span class="badge profit">止盈</span>
|
|
{% else %}<span class="badge loss">止损</span>{% endif %}
|
|
</td>
|
|
<td>{{ r.created_at[:16] if r.created_at else '' }}</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{% endif %}
|
|
{% endblock %}
|