中控条件单页:下发/取消/改出场,有仓客户端不可选。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-10-03 02:13:17 +08:00
parent fdb71d6896
commit 1546bc49f0
6 changed files with 616 additions and 37 deletions
+30 -29
View File
@@ -1,29 +1,30 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block title %}期权中控{% endblock %}</title>
<link rel="stylesheet" href="{{ url_for('static', filename='hub.css') }}">
</head>
<body class="{% if request.path.startswith('/login') %}page-login{% elif request.path.startswith('/desk') %}page-desk{% elif request.path == '/' %}page-dashboard{% endif %}">
{% if session.get('logged_in') %}
<header class="topbar">
<nav>
<a href="/" class="{% if request.path == '/' %}active{% endif %}">总览</a>
<a href="/instances" class="{% if request.path.startswith('/instances') %}active{% endif %}">实例</a>
<a href="/desk" class="{% if request.path.startswith('/desk') %}active{% endif %}">工作台</a>
<a href="/settings" class="{% if request.path.startswith('/settings') %}active{% endif %}">系统设置</a>
<a href="/logout">退出</a>
</nav>
</header>
{% endif %}
<main class="main">
{% with messages = get_flashed_messages() %}
{% if messages %}<div class="flash">{{ messages[0] }}</div>{% endif %}
{% endwith %}
{% block body %}{% endblock %}
</main>
{% block scripts %}{% endblock %}
</body>
</html>
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block title %}期权中控{% endblock %}</title>
<link rel="stylesheet" href="{{ url_for('static', filename='hub.css') }}">
</head>
<body class="{% if request.path.startswith('/login') %}page-login{% elif request.path.startswith('/desk') %}page-desk{% elif request.path == '/' %}page-dashboard{% endif %}">
{% if session.get('logged_in') %}
<header class="topbar">
<nav>
<a href="/" class="{% if request.path == '/' %}active{% endif %}">总览</a>
<a href="/cond_orders" class="{% if request.path.startswith('/cond_orders') %}active{% endif %}">条件单</a>
<a href="/instances" class="{% if request.path.startswith('/instances') %}active{% endif %}">实例</a>
<a href="/desk" class="{% if request.path.startswith('/desk') %}active{% endif %}">工作台</a>
<a href="/settings" class="{% if request.path.startswith('/settings') %}active{% endif %}">系统设置</a>
<a href="/logout">退出</a>
</nav>
</header>
{% endif %}
<main class="main">
{% with messages = get_flashed_messages() %}
{% if messages %}<div class="flash">{{ messages[0] }}</div>{% endif %}
{% endwith %}
{% block body %}{% endblock %}
</main>
{% block scripts %}{% endblock %}
</body>
</html>
+66
View File
@@ -0,0 +1,66 @@
{% extends "base.html" %}
{% block title %}条件单 · 期权中控{% endblock %}
{% block body %}
<section class="page-head">
<h1>条件开仓单</h1>
<button type="button" class="btn" id="btn-cond-refresh">刷新</button>
</section>
<p class="muted">中控只下发指令;行情监控与买币/开仓/平仓/卖币均在客户端本地执行。有仓或已占用的机器不可选。</p>
<div class="panel">
<h2 style="margin:0 0 10px;font-size:1rem">新建条件单</h2>
<div class="form-grid" id="cond-form">
<label>标的
<select id="cf-underlying">
<option value="ETH">ETH</option>
<option value="BTC">BTC</option>
</select>
</label>
<label>方向
<select id="cf-opt-type">
<option value="P">看跌 Put</option>
<option value="C">看涨 Call</option>
</select>
</label>
<label>触发
<select id="cf-trigger-side">
<option value="gte">指数 ≥ 触发价(上穿)</option>
<option value="lte">指数 ≤ 触发价(下穿)</option>
</select>
</label>
<label>触发价
<input id="cf-trigger-px" type="number" step="any" placeholder="如 3000" required>
</label>
<label>偏离 %
<input id="cf-deviation" type="number" step="0.1" value="1" placeholder="1" required>
</label>
<label>最短到期(小时)
<input id="cf-expiry-h" type="number" step="1" value="24" placeholder="24" required>
</label>
<label>出场目标指数(可选)
<input id="cf-target" type="number" step="any" placeholder="如 2800">
</label>
<label class="check"><input id="cf-pe" type="checkbox" checked> 翻倍出场</label>
<label>翻倍倍数
<input id="cf-pe-mult" type="number" step="0.1" value="1" placeholder="1">
</label>
</div>
<div style="margin-top:12px">
<div class="muted" style="margin-bottom:6px">选择客户端</div>
<div id="cf-instances" class="inst-pick"></div>
</div>
<div style="margin-top:12px">
<button type="button" class="btn" id="btn-cond-create">下发条件单</button>
<span class="muted" id="cf-status"></span>
</div>
</div>
<div class="panel">
<h2 style="margin:0 0 10px;font-size:1rem">条件单列表</h2>
<div id="cond-list" class="muted">加载中…</div>
</div>
{% endblock %}
{% block scripts %}
<script src="{{ url_for('static', filename='cond_orders.js') }}"></script>
<script>HubCondOrders.boot();</script>
{% endblock %}