搭建期货量化管理后台 MVP,支持行情查看、博弈分析、持仓录入、品种合约管理
This commit is contained in:
@@ -0,0 +1,93 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}系统管理{% endblock %}
|
||||
{% block heading %}系统管理{% endblock %}
|
||||
{% block breadcrumb %}品种与合约{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{# ── New Product ── #}
|
||||
<div class="section-title">新建品种</div>
|
||||
<div class="form-card" style="margin-bottom:24px;">
|
||||
<form method="post" action="/admin/product" style="display:flex;gap:12px;align-items:flex-end;flex-wrap:wrap;">
|
||||
<div class="form-group" style="margin-bottom:0;flex:1;min-width:120px;">
|
||||
<label>品种代码</label>
|
||||
<input type="text" name="code" required placeholder="FG" maxlength="6" style="text-transform:uppercase;">
|
||||
</div>
|
||||
<div class="form-group" style="margin-bottom:0;flex:1;min-width:120px;">
|
||||
<label>品种名称</label>
|
||||
<input type="text" name="name" required placeholder="玻璃">
|
||||
</div>
|
||||
<div class="form-group" style="margin-bottom:0;flex:1;min-width:120px;">
|
||||
<label>交易所</label>
|
||||
<select name="exchange" required>
|
||||
{% for ex in exchanges %}
|
||||
<option value="{{ ex }}">{{ ex }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">新建</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{# ── Product List ── #}
|
||||
{% for p in products %}
|
||||
<div class="section-title">{{ p.code }} · {{ p.name }} <span style="font-weight:400;color:var(--sub);font-size:0.78rem;">{{ p.exchange }}</span></div>
|
||||
|
||||
{# ── New Contract ── #}
|
||||
<div class="form-card" style="margin-bottom:12px;">
|
||||
<form method="post" action="/admin/contract" style="display:flex;gap:12px;align-items:flex-end;flex-wrap:wrap;">
|
||||
<input type="hidden" name="product_id" value="{{ p.id }}">
|
||||
<div class="form-group" style="margin-bottom:0;flex:1;min-width:140px;">
|
||||
<label>合约代码</label>
|
||||
<input type="text" name="code" required placeholder="{{ p.code }}2609" maxlength="10" style="text-transform:uppercase;">
|
||||
</div>
|
||||
<div class="form-group" style="margin-bottom:0;flex:2;min-width:160px;">
|
||||
<label>合约名称</label>
|
||||
<input type="text" name="name" required placeholder="{{ p.name }}2609">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">添加合约</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{# ── Contract List ── #}
|
||||
{% if p.contracts %}
|
||||
<div class="table-wrap" style="margin-bottom:20px;">
|
||||
<table>
|
||||
<tr><th>合约代码</th><th>名称</th><th>状态</th><th>行情</th><th>操作</th></tr>
|
||||
{% for c in p.contracts %}
|
||||
<tr>
|
||||
<td><strong>{{ c.code }}</strong></td>
|
||||
<td>{{ c.name }}</td>
|
||||
<td>
|
||||
{% if c.is_active %}
|
||||
<span class="badge badge-up">启用</span>
|
||||
{% else %}
|
||||
<span class="badge badge-down">停用</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td><a href="/contracts/{{ c.code }}" style="color:var(--accent);text-decoration:none;">查看 →</a></td>
|
||||
<td>
|
||||
<form method="post" action="/admin/contract/{{ c.id }}/toggle" style="display:inline;">
|
||||
<button style="background:none;border:none;color:var(--sub);cursor:pointer;font-size:0.82rem;">
|
||||
{% if c.is_active %}停用{% else %}启用{% endif %}
|
||||
</button>
|
||||
</form>
|
||||
<form method="post" action="/admin/contract/{{ c.id }}/delete" style="display:inline;" onsubmit="return confirm('删除 {{ c.code }}?此操作不可恢复。')">
|
||||
<button style="background:none;border:none;color:var(--danger);cursor:pointer;font-size:0.82rem;">删除</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<form method="post" action="/admin/product/{{ p.id }}/delete" onsubmit="return confirm('删除品种 {{ p.code }} 及其所有合约?')" style="text-align:right;margin-bottom:28px;">
|
||||
<button style="background:none;border:none;color:var(--danger);cursor:pointer;font-size:0.82rem;">删除品种 {{ p.code }}</button>
|
||||
</form>
|
||||
|
||||
{% else %}
|
||||
<div style="text-align:center;padding:40px;color:var(--sub);">暂无品种,请先新建。</div>
|
||||
{% endfor %}
|
||||
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user