6e423eebfb
新增 vnpy CTP 桥接、以损定仓/固定张数、趋势回调与滚仓策略、按资金推荐品种及交易风控;模拟盘走 SimNow,实盘预留期货公司配置。 Co-authored-by: Cursor <cursoragent@cursor.com>
94 lines
5.2 KiB
HTML
94 lines
5.2 KiB
HTML
{% extends "base.html" %}
|
||
{% block title %}系统设置 - 国内期货监控系统{% endblock %}
|
||
{% block content %}
|
||
|
||
<div class="card">
|
||
<h2>交易模式</h2>
|
||
<form action="{{ url_for('settings') }}" method="post">
|
||
<input type="hidden" name="action" value="trading">
|
||
<div class="form-grid" style="max-width:640px">
|
||
<div class="field">
|
||
<label>交易通道</label>
|
||
<select name="trading_mode">
|
||
<option value="simulation" {% if trading_mode == 'simulation' %}selected{% endif %}>模拟盘 · SimNow(vnpy CTP)</option>
|
||
<option value="live" {% if trading_mode == 'live' %}selected{% endif %}>实盘 · 期货公司 CTP(后期接入)</option>
|
||
</select>
|
||
</div>
|
||
<div class="field">
|
||
<label>计仓模式</label>
|
||
<select name="position_sizing_mode">
|
||
<option value="risk" {% if position_sizing_mode == 'risk' %}selected{% endif %}>以损定仓</option>
|
||
<option value="fixed" {% if position_sizing_mode == 'fixed' %}selected{% endif %}>固定张数</option>
|
||
</select>
|
||
</div>
|
||
<div class="field">
|
||
<label>单笔风险比例(以损定仓,%)</label>
|
||
<input name="risk_percent" type="number" step="0.1" min="0.1" max="100" value="{{ risk_percent }}">
|
||
</div>
|
||
</div>
|
||
<button type="submit" class="btn-primary" style="margin-top:.75rem">保存交易设置</button>
|
||
</form>
|
||
<p class="hint" style="margin-top:.75rem">
|
||
<strong>模拟盘</strong>连接上期 SimNow 仿真柜台(非本地假资金)。在 <code>.env</code> 配置
|
||
<code>SIMNOW_USER</code>、<code>SIMNOW_PASSWORD</code> 等,在「期货下单」页点击连接 CTP。<br>
|
||
<strong>实盘</strong>后期配置 <code>CTP_LIVE_*</code> 对接你的期货公司。
|
||
</p>
|
||
</div>
|
||
|
||
<div class="card">
|
||
<h2>参考资金</h2>
|
||
<form action="{{ url_for('settings') }}" method="post" class="form-row">
|
||
<input type="hidden" name="action" value="capital">
|
||
<input name="live_capital" type="number" step="0.01" min="0" placeholder="参考权益(元)" value="{{ live_capital }}" style="flex:1;min-width:200px;max-width:320px">
|
||
<button type="submit" class="btn-primary">保存</button>
|
||
</form>
|
||
<p class="hint" style="margin-top:.75rem">
|
||
CTP 未连接时用于<strong>品种推荐</strong>与以损定仓估算;SimNow/实盘登录成功后自动改用<strong>柜台权益</strong>。
|
||
</p>
|
||
</div>
|
||
|
||
<div class="card">
|
||
<h2>行情说明</h2>
|
||
<p class="hint" style="font-size:.9rem;line-height:1.6">
|
||
当前行情源:<strong class="text-accent">{{ quote_label }}</strong><br>
|
||
合约代码按<strong>同花顺格式</strong>显示(如 ag2608、IF2606),便于与看盘软件对照;
|
||
实际价格通过行情接口获取,普通用户无需申请 token。<br>
|
||
<span class="text-muted" style="font-size:.85rem">同花顺 iFinD 接口面向机构用户,个人期货通用户一般无法获取 refresh_token,故系统默认不使用。</span>
|
||
</p>
|
||
</div>
|
||
|
||
<div class="card">
|
||
<h2>企业微信推送</h2>
|
||
<form action="{{ url_for('settings') }}" method="post" class="form-row">
|
||
<input type="hidden" name="action" value="wechat">
|
||
<input name="wechat_webhook" type="url" placeholder="企业微信 Webhook 地址" value="{{ webhook }}" style="flex:1;min-width:300px">
|
||
<button type="submit" class="btn-primary">保存</button>
|
||
</form>
|
||
<p class="hint" style="margin-top:.75rem">在企业微信群中添加机器人后,将 Webhook 地址粘贴到上方保存即可。</p>
|
||
</div>
|
||
|
||
<div class="card">
|
||
<h2>修改密码</h2>
|
||
<form action="{{ url_for('settings') }}" method="post" style="max-width:400px">
|
||
<input type="hidden" name="action" value="password">
|
||
<div style="margin-bottom:.75rem">
|
||
<label class="text-label" style="font-size:.85rem;display:block;margin-bottom:.35rem">当前账号</label>
|
||
<input type="text" value="{{ username }}" disabled style="width:100%">
|
||
</div>
|
||
<div style="margin-bottom:.75rem">
|
||
<label class="text-label" style="font-size:.85rem;display:block;margin-bottom:.35rem">原密码</label>
|
||
<input name="old_password" type="password" required style="width:100%">
|
||
</div>
|
||
<div style="margin-bottom:.75rem">
|
||
<label class="text-label" style="font-size:.85rem;display:block;margin-bottom:.35rem">新密码(至少 6 位)</label>
|
||
<input name="new_password" type="password" required minlength="6" style="width:100%">
|
||
</div>
|
||
<div style="margin-bottom:.75rem">
|
||
<label class="text-label" style="font-size:.85rem;display:block;margin-bottom:.35rem">确认新密码</label>
|
||
<input name="new_password2" type="password" required minlength="6" style="width:100%">
|
||
</div>
|
||
<button type="submit" class="btn-primary">修改密码</button>
|
||
</form>
|
||
</div>
|
||
{% endblock %}
|