7b8a660309
策略与 CTP 自动同步持仓,新增 /api/trading/live 聚合展示与平仓接口。 Co-authored-by: Cursor <cursoragent@cursor.com>
42 lines
2.1 KiB
HTML
42 lines
2.1 KiB
HTML
{% extends "base.html" %}
|
|
{% block title %}持仓监控 - 国内期货监控系统{% endblock %}
|
|
{% block extra_css %}
|
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/trade.css') }}">
|
|
{% endblock %}
|
|
{% block content %}
|
|
<div class="trade-page">
|
|
<div class="trade-top-bar">
|
|
<span class="badge dir">{{ trading_mode_label }}</span>
|
|
<span class="badge {% if ctp_status.connected %}profit{% else %}planned{% endif %}" id="ctp-badge">
|
|
{% if ctp_status.connected %}CTP 已连接{% else %}CTP 未连接{% endif %}
|
|
</span>
|
|
<span class="badge {% if risk_status.can_trade %}profit{% else %}loss{% endif %}" id="risk-badge">{{ risk_status.status_label }}</span>
|
|
<span class="text-muted">权益 <strong id="cap-display">{{ '%.2f'|format(capital) }}</strong> 元</span>
|
|
{% if ctp_account.available is defined and ctp_status.connected %}
|
|
<span class="text-muted">可用 <strong>{{ '%.2f'|format(ctp_account.available) }}</strong> 元</span>
|
|
{% endif %}
|
|
<button type="button" class="btn-primary" id="btn-ctp-connect" style="padding:.4rem .9rem;font-size:.8rem">连接 CTP</button>
|
|
</div>
|
|
|
|
<div class="trade-subnav">
|
|
<span class="active">持仓监控</span>
|
|
<a href="{{ url_for('recommend_page') }}">品种推荐</a>
|
|
<a href="{{ url_for('strategy_page') }}">策略交易</a>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<h2>实时持仓</h2>
|
|
<div class="card-body" id="position-live-list">
|
|
<div class="empty-hint">加载中…</div>
|
|
</div>
|
|
<div class="trade-footer" id="trade-footer">
|
|
<p class="hint">开仓请使用「策略交易」;连接 CTP 后自动同步 SimNow / 柜台持仓与程序监控。</p>
|
|
{% if ctp_status.last_error %}<p class="text-loss" style="font-size:.78rem;margin-top:.5rem">{{ ctp_status.last_error }}</p>{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|
|
{% block extra_js %}
|
|
<script src="{{ url_for('static', filename='js/trade.js') }}"></script>
|
|
{% endblock %}
|