Compare commits
26 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f53f2814ab | |||
| e5051fb309 | |||
| 1dc7914701 | |||
| 58e2bf3e8b | |||
| 19debee581 | |||
| 1755f67eca | |||
| 6886de0bad | |||
| f04a91efe6 | |||
| b43e33e24f | |||
| b5a061e758 | |||
| 4ef3b40353 | |||
| 4a79e010c4 | |||
| 791cc750da | |||
| c8231ea194 | |||
| aaccdcfc16 | |||
| f993a89a21 | |||
| 9dc363270e | |||
| 9a83dfe209 | |||
| 32c42b8447 | |||
| a2075ba73e | |||
| 846f3de525 | |||
| a7b75895e6 | |||
| d870178b83 | |||
| 7ebe1671b2 | |||
| cb4f6aaa4b | |||
| eb175820e9 |
@@ -3,5 +3,8 @@
|
||||
deploy/** text eol=lf
|
||||
# 文档统一 LF,避免 Windows 编辑后产生 CRLF 脏 diff
|
||||
docs/** text eol=lf
|
||||
# XMind 为 ZIP 二进制;须覆盖上面 docs/** 的 text/eol,否则入库会损坏打不开
|
||||
*.xmind -text -diff -merge -eol
|
||||
docs/**/*.xmind -text -diff -merge -eol
|
||||
# .env 模板统一 LF,避免 Linux PM2 source 报 $'\r': command not found
|
||||
**/.env.example text eol=lf
|
||||
|
||||
@@ -411,7 +411,7 @@ _APP_STARTED_AT = time.time()
|
||||
_RECONCILE_FLAT_STREAK = {}
|
||||
KLINE_TIMEFRAME = os.getenv("KLINE_TIMEFRAME", "5m")
|
||||
FULL_MARGIN_BUFFER_RATIO = float(os.getenv("FULL_MARGIN_BUFFER_RATIO", "0.98"))
|
||||
TRANSFER_CCY = os.getenv("TRANSFER_CCY", "USDT")
|
||||
TRANSFER_CCY = (os.getenv("TRANSFER_CCY", "USDT") or "USDT").strip().upper() or "USDT"
|
||||
UPLOAD_FOLDER = resolve_path(os.getenv("UPLOAD_DIR", "static/images"))
|
||||
ORDER_CHART_ENABLED = os.getenv("ORDER_CHART_ENABLED", "true").lower() == "true"
|
||||
ORDER_CHART_TFS = [x.strip() for x in (os.getenv("ORDER_CHART_TFS", "4h,1h,15m,5m") or "").split(",") if x.strip()]
|
||||
@@ -9870,7 +9870,7 @@ def manual_transfer():
|
||||
amount = float(request.form.get("amount", "0"))
|
||||
except Exception:
|
||||
flash("划转金额格式错误")
|
||||
return redirect("/settings")
|
||||
return redirect("/settings?settings_tab=transfer")
|
||||
from_account = (request.form.get("from_account") or AUTO_TRANSFER_FROM).strip()
|
||||
to_account = (request.form.get("to_account") or AUTO_TRANSFER_TO).strip()
|
||||
ok, msg, _ = execute_transfer_usdt(amount, from_account, to_account)
|
||||
@@ -9885,7 +9885,7 @@ def manual_transfer():
|
||||
flash(f"手动划转成功:{amount}U {from_account}->{to_account}")
|
||||
else:
|
||||
flash(f"手动划转失败:{msg}")
|
||||
return redirect("/settings")
|
||||
return redirect("/settings?settings_tab=transfer")
|
||||
|
||||
|
||||
def _journal_ai_chart_builder(row):
|
||||
|
||||
@@ -404,7 +404,7 @@ KLINE_TIMEFRAME = os.getenv("KLINE_TIMEFRAME", "5m")
|
||||
_APP_STARTED_AT = time.time()
|
||||
_RECONCILE_FLAT_STREAK = {}
|
||||
FULL_MARGIN_BUFFER_RATIO = float(os.getenv("FULL_MARGIN_BUFFER_RATIO", "0.98"))
|
||||
TRANSFER_CCY = os.getenv("TRANSFER_CCY", "USDT")
|
||||
TRANSFER_CCY = (os.getenv("TRANSFER_CCY", "USDT") or "USDT").strip().upper() or "USDT"
|
||||
UPLOAD_FOLDER = resolve_path(os.getenv("UPLOAD_DIR", "static/images"))
|
||||
ORDER_CHART_ENABLED = os.getenv("ORDER_CHART_ENABLED", "true").lower() == "true"
|
||||
ORDER_CHART_TFS = [x.strip() for x in (os.getenv("ORDER_CHART_TFS", "4h,1h,15m,5m") or "").split(",") if x.strip()]
|
||||
@@ -9727,7 +9727,7 @@ def manual_transfer():
|
||||
amount = float(request.form.get("amount", "0"))
|
||||
except Exception:
|
||||
flash("划转金额格式错误")
|
||||
return redirect("/settings")
|
||||
return redirect("/settings?settings_tab=transfer")
|
||||
from_account = (request.form.get("from_account") or AUTO_TRANSFER_FROM).strip()
|
||||
to_account = (request.form.get("to_account") or AUTO_TRANSFER_TO).strip()
|
||||
ok, msg, _ = execute_transfer_usdt(amount, from_account, to_account)
|
||||
@@ -9742,7 +9742,7 @@ def manual_transfer():
|
||||
flash(f"手动划转成功:{amount}U {from_account}->{to_account}")
|
||||
else:
|
||||
flash(f"手动划转失败:{msg}")
|
||||
return redirect("/settings")
|
||||
return redirect("/settings?settings_tab=transfer")
|
||||
|
||||
|
||||
def _journal_ai_chart_builder(row):
|
||||
|
||||
@@ -384,7 +384,7 @@ BREAKEVEN_EXCHANGE_MIN_INTERVAL_SEC = max(
|
||||
_BREAKEVEN_LAST_EX_SYNC: dict[int, float] = {}
|
||||
KLINE_TIMEFRAME = os.getenv("KLINE_TIMEFRAME", "5m")
|
||||
FULL_MARGIN_BUFFER_RATIO = float(os.getenv("FULL_MARGIN_BUFFER_RATIO", "0.98"))
|
||||
TRANSFER_CCY = os.getenv("TRANSFER_CCY", "USDT")
|
||||
TRANSFER_CCY = (os.getenv("TRANSFER_CCY", "USDT") or "USDT").strip().upper() or "USDT"
|
||||
OKX_POSITION_INST_TYPE = os.getenv("OKX_POSITION_INST_TYPE", "SWAP")
|
||||
EXCHANGE_POSITION_SYNC_FROM_BJ = (os.getenv("EXCHANGE_POSITION_SYNC_FROM_BJ") or "").strip()
|
||||
EXCHANGE_POSITION_HISTORY_LIMIT = max(50, min(1000, int(os.getenv("EXCHANGE_POSITION_HISTORY_LIMIT", "200"))))
|
||||
@@ -9455,7 +9455,7 @@ def manual_transfer():
|
||||
amount = float(request.form.get("amount", "0"))
|
||||
except Exception:
|
||||
flash("划转金额格式错误")
|
||||
return redirect("/settings")
|
||||
return redirect("/settings?settings_tab=transfer")
|
||||
from_account = (request.form.get("from_account") or AUTO_TRANSFER_FROM).strip()
|
||||
to_account = (request.form.get("to_account") or AUTO_TRANSFER_TO).strip()
|
||||
ok, msg, _ = execute_transfer_usdt(amount, from_account, to_account)
|
||||
@@ -9477,7 +9477,7 @@ def manual_transfer():
|
||||
flash(f"手动划转成功:{amount}U {from_account}->{to_account}")
|
||||
else:
|
||||
flash(f"手动划转失败:{msg}")
|
||||
return redirect("/settings")
|
||||
return redirect("/settings?settings_tab=transfer")
|
||||
|
||||
|
||||
def _journal_ai_chart_builder(row):
|
||||
|
||||
Binary file not shown.
+4
-1
@@ -6,6 +6,9 @@
|
||||
|
||||
| 标签 | 指向提交 | 说明 |
|
||||
|------|----------|------|
|
||||
| `snapshot/20260726-2` | `4a79e01` | 2026-07-26 午:执行手册脑图(业务主题)、`.xmind` 按二进制入库、去掉缩略图避免 Gitea raw 换行损坏 |
|
||||
| `snapshot/20260726` | `a2075ba` | 2026-07-26:Gate划转币种大写修复、系统设置划转页签停留、自动划转账户/币种下拉默认、期权「按可用余额打满」=min(余额,单笔预算)及说明 |
|
||||
| `snapshot/20260724` | `890659f` | 2026-07-24:执行手册v2(无对冲)、监控/策略页签显隐、内照明心期权档案同步、期权开平仓微信必发、实例导航显隐关键位/实盘下单等 |
|
||||
| `snapshot/20260723-2` | `9e0591c` | 2026-07-23:策略对比页(合约/单期权/期期7:3)、监控与看板隐藏浮盈偏好、对比页卡片内边距等 |
|
||||
| `snapshot/20260723-pre-amp-stats` | `40be3a5` | 2026-07-23:振幅统计开发前;含执行手册进教练、日亏损冻结、手机监控 UI、振幅统计开发方案等 |
|
||||
| `snapshot/20260721-2` | `a721642` | 2026-07-21 晚:日亏损次数冻结、交易执行手册入中控策略说明、期权/Gate 执行手册文档等 |
|
||||
@@ -28,7 +31,7 @@
|
||||
git tag -l 'snapshot/*'
|
||||
|
||||
# 检出快照(只读查看,勿在此分支直接开发)
|
||||
git checkout snapshot/20260723-2
|
||||
git checkout snapshot/20260726-2
|
||||
|
||||
# 回到主线
|
||||
git checkout main
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
# 服务说明与报价说明
|
||||
|
||||
> 本文说明本系统的定位、适用对象、托管方式与参考报价。
|
||||
> 配套文件:`著作权声明.md`、`软件使用授权合同-模板.md`(托管服务与软件使用合同)。
|
||||
> **本系统以著作权人自用为主**;对外托管属个案合作,并非标准化「卖工具」业务。
|
||||
|
||||
---
|
||||
|
||||
## 1. 这是什么
|
||||
|
||||
`crypto_monitor`(加密货币交易监控与中控系统)由著作权人 **马建军** 历时约三个月持续开发,用于自身实盘交易中的:
|
||||
|
||||
- 多交易所实例监控与下单辅助
|
||||
- 风控与纪律约束(如日亏冻结、执行规则落地到系统)
|
||||
- 复盘、关键位、期权/合约相关流程(以实际开通功能为准)
|
||||
- 中控统一查看与管理
|
||||
|
||||
开发目的首先是:**把交易习惯钉进系统,减少情绪单与随意操作**,而不是面向市场量产销售的通用软件商品。
|
||||
|
||||
---
|
||||
|
||||
## 2. 定位与适用对象
|
||||
|
||||
### 2.1 定位
|
||||
|
||||
| 是 | 不是 |
|
||||
|----|------|
|
||||
| 全职(或准全职)交易者的执行与纪律系统 | 兼职「玩玩」的下单插件 |
|
||||
| 规则、限制、复盘一起用的工作台 | 帮你加杠杆、追涨杀跌的「发财工具」 |
|
||||
| 著作权人自用为主;对外仅少量托管 | 开源产品或标准化 SaaS 大卖场 |
|
||||
|
||||
### 2.2 适合
|
||||
|
||||
- 以交易为主要工作、愿意按规则执行的人
|
||||
- 认同执行手册与系统内限制(含开仓限制、冻结等)
|
||||
- 接受「一户一机、不交付源码、按期付费」的托管方式
|
||||
- 账户规模与付费意愿匹配(服务费不应明显高于可承受的交易成本)
|
||||
|
||||
### 2.3 不适合(一般不承接)
|
||||
|
||||
- 兼职、偶尔开几单的小散
|
||||
- 只想要更快开仓、更高杠杆,不愿接受纪律约束
|
||||
- 要求交付源码、私有仓库权限或「买断随便改」
|
||||
- 希望多人共用一台服务器以压低费用
|
||||
|
||||
**说明:** 不适合不等于否定任何人,而是产品与服务形态不匹配;强行上线往往浪费双方时间。
|
||||
|
||||
---
|
||||
|
||||
## 3. 对外怎么提供(若合作)
|
||||
|
||||
默认且唯一推荐的方式:
|
||||
|
||||
1. **著作权人提供专属服务器**(一用户一服务器,不与其他客户共用)
|
||||
2. **部署中控与实例**,配置域名 / HTTPS
|
||||
3. 客户仅获得 **访问地址 + 登录账号**
|
||||
4. **不交付源代码**、不开放 Git、不移交服务器 root(由甲方代持运维)
|
||||
|
||||
合作前建议:先阅读相关执行/行为说明,确认认同纪律设计,再谈部署与费用。
|
||||
|
||||
正式合作须签署《托管服务与软件使用合同》(见合同模板)。
|
||||
|
||||
---
|
||||
|
||||
## 4. 费用构成
|
||||
|
||||
费用分四项,建议在报价单中分列,避免被理解成「只卖服务器」:
|
||||
|
||||
| 费用 | 含义 | 通常周期 |
|
||||
|------|------|----------|
|
||||
| 服务器费用 | 该客户专属云主机、带宽、磁盘等 | 月 / 年 |
|
||||
| 域名费用 | 域名注册或续费(代持或客户自带域名) | 年 |
|
||||
| 部署费用 | 首次装机、证书、上线、基础培训 | 一次性 |
|
||||
| 程序使用费 | 软件托管使用权、基础更新与运维响应 | 月 / 年 |
|
||||
|
||||
续费年一般不再收部署费(大改版或迁移可另议)。
|
||||
|
||||
---
|
||||
|
||||
## 5. 参考报价(非标价,可协商)
|
||||
|
||||
以下为**面向全职交易者、个案托管**的参考区间(人民币)。
|
||||
因以自用为主、名额有限,实际以当时口头/书面报价为准,可高于下列下限。
|
||||
|
||||
### 5.1 分项参考
|
||||
|
||||
| 项目 | 参考区间 | 备注 |
|
||||
|------|----------|------|
|
||||
| 服务器费用 | **200–400 元/月** | 按机型实报或固定档;专属机,不共用 |
|
||||
| 域名费用 | **60–120 元/年** | 实报实销;客户自带域名可减免 |
|
||||
| 部署费用 | **2,000–5,000 元** | 一次性;含上线与基础使用说明 |
|
||||
| 程序使用费 | **1,000–2,500 元/月** 或 **10,000–25,000 元/年** | 年付可相当于少收 1~2 个月 |
|
||||
|
||||
### 5.2 首年打包示意(便于沟通)
|
||||
|
||||
| 档位 | 首年大约量级 | 思路 |
|
||||
|------|--------------|------|
|
||||
| 协作档 | 约 **1.5–2.5 万** | 部署中档 + 服务器 + 使用费中低 |
|
||||
| 标准档 | 约 **2–4 万** | 部署与使用费取中高,含优先响应 |
|
||||
|
||||
**不提供:** 低价引流套餐、兼职小资金特惠、源码买断(若极少数个案谈源码,须另签合同且价格远高于年使用费,默认不做)。
|
||||
|
||||
### 5.3 付款与停服
|
||||
|
||||
- 部署费 + 首周期费用:签约后约定日内支付,到账后排期部署
|
||||
- 续费:到期前支付;逾期可暂停访问,严重逾期可停服并释放专属服务器
|
||||
- 细节以合同条款为准
|
||||
|
||||
---
|
||||
|
||||
## 6. 服务边界(简要)
|
||||
|
||||
**甲方(马建军)合理范围内可提供:**
|
||||
|
||||
- 专属机上的首次部署与基础运维
|
||||
- 程序常规更新、进程异常处理
|
||||
- 约定范围内的使用说明
|
||||
|
||||
**一般不包含(除非另议):**
|
||||
|
||||
- 代客交易、代管资金、投资建议
|
||||
- 保证盈利或胜率
|
||||
- 7×24 即时响应当成「专职客服」
|
||||
- 按客户要求无限改需求而不另计定制费
|
||||
|
||||
交易盈亏由客户自行承担;系统为辅助与纪律工具。
|
||||
|
||||
---
|
||||
|
||||
## 7. 知识产权
|
||||
|
||||
- 软件与文档著作权归 **马建军** 所有,见 `著作权声明.md`
|
||||
- 托管仅授权约定范围内的使用权,**不转移著作权、不交付源码**
|
||||
- 仓库为私有保存;私有不影响著作权主张
|
||||
|
||||
---
|
||||
|
||||
## 8. 联系
|
||||
|
||||
- 著作权人 / 服务提供方:马建军
|
||||
- 电话:18364911125
|
||||
|
||||
意向合作请说明:交易经验与是否全职、大致账户规模(可不精确)、希望开通的交易所、是否接受系统纪律限制。
|
||||
**谢绝:** 仅询源码价格、要求多人共用一台服务器、明确表示不接受任何交易限制的需求。
|
||||
|
||||
---
|
||||
|
||||
*文档版本:与仓库同步维护;报价为参考,最终以双方确认的报价单与合同为准。*
|
||||
@@ -0,0 +1,50 @@
|
||||
# 著作权声明
|
||||
|
||||
## 作品信息
|
||||
|
||||
| 项 | 内容 |
|
||||
|----|------|
|
||||
| 作品名称 | crypto_monitor(加密货币交易监控与中控系统) |
|
||||
| 作品形式 | 计算机软件及相关技术文档 |
|
||||
| 著作权人 | 马建军 |
|
||||
| 联系电话 | 18364911125 |
|
||||
| 权利主张起始 | 2026 年(以本仓库首次提交及后续持续开发为准) |
|
||||
|
||||
## 权利声明
|
||||
|
||||
本仓库所含下列内容之著作权归 **马建军** 所有:
|
||||
|
||||
1. 源代码、脚本、配置模板与部署相关文件;
|
||||
2. 界面文案、说明文档、执行手册、策略与设计类文档;
|
||||
3. 由著作权人创作并纳入本仓库的图表、脑图及其他配套材料。
|
||||
|
||||
**Copyright © 2026 马建军. 保留所有权利。**
|
||||
|
||||
未经著作权人书面许可,任何单位或个人不得擅自:
|
||||
|
||||
- 复制、传播、公开披露本仓库全部或部分内容;
|
||||
- 出售、出租、赠与或以任何方式向第三方提供本软件或其衍生版本;
|
||||
- 删除或篡改本声明及表明著作权归属的标识。
|
||||
|
||||
本仓库计划以私有方式保存;私有并不影响著作权人对本作品享有的权利。
|
||||
|
||||
## 证明与版本痕迹
|
||||
|
||||
本作品的创作过程以 Git 提交历史、远程私有仓库记录及快照标签(如 `snapshot/*`)为时间线依据。著作权主张以本声明与上述开发痕迹为准。
|
||||
|
||||
## 免责(与著作权并列说明)
|
||||
|
||||
本软件及相关文档仅供著作权人授权范围内的交易辅助与内部使用。市场有风险,交易决策与盈亏由使用者自行承担;本声明不构成任何投资建议。
|
||||
|
||||
## 对外提供方式
|
||||
|
||||
著作权人对外提供本软件的**默认方式**为:由著作权人为每位客户提供**专属服务器**(一用户一服务器,不与其他客户共用同一台机器)与部署,客户通过访问地址与账号使用,并缴纳服务器费、域名费、部署费及程序使用费;**不交付源代码**。
|
||||
|
||||
对外托管或授权使用时,请签署《托管服务与软件使用合同》(模板见同目录 `软件使用授权合同-模板.md`)。服务定位、适用对象与参考报价见 `服务说明与报价说明.md`。未签署有效合同的,除著作权人本人外,任何人均无权使用、复制或传播本软件。
|
||||
|
||||
## 联系
|
||||
|
||||
- 著作权人:马建军
|
||||
- 电话:18364911125
|
||||
|
||||
本声明随仓库版本一并维护;如有更新,以仓库中最新文本为准。
|
||||
@@ -0,0 +1,192 @@
|
||||
# 托管服务与软件使用合同(模板)
|
||||
|
||||
> 说明:本文为**合同模板**,适用于甲方(马建军)提供**专属服务器**与部署、乙方通过网页/账号使用软件、**不交付源码**的托管模式。
|
||||
> **一用户一服务器**:每位客户单独一台(套)服务器,不与其他客户共用同一台服务器。
|
||||
> 与仓库内《著作权声明》配套:声明主张权利;本合同约定服务范围、费用与使用边界。
|
||||
> 签署前请双方核对条款;金额较大或长期合作,建议再请律师审阅。
|
||||
|
||||
---
|
||||
|
||||
**合同编号:** ________________
|
||||
**签订日期:** ______ 年 ____ 月 ____ 日
|
||||
**签订地点:** ________________
|
||||
|
||||
## 甲方(服务提供方 / 著作权人)
|
||||
|
||||
| 项 | 内容 |
|
||||
|----|------|
|
||||
| 姓名 | 马建军 |
|
||||
| 联系电话 | 18364911125 |
|
||||
| 身份证件号码 | ________________(签署时填写) |
|
||||
| 住址 | ________________(签署时填写,选填) |
|
||||
|
||||
## 乙方(客户 / 使用方)
|
||||
|
||||
| 项 | 内容 |
|
||||
|----|------|
|
||||
| 姓名 / 名称 | ________________ |
|
||||
| 证件类型及号码 | ________________ |
|
||||
| 联系电话 | ________________ |
|
||||
| 住址 / 住所地 | ________________(选填) |
|
||||
|
||||
甲乙双方就甲方在其控制的服务器上部署、运维 `crypto_monitor`(加密货币交易监控与中控系统,以下称「本软件」),并向乙方提供**托管使用服务**,经协商一致,订立本合同。
|
||||
|
||||
---
|
||||
|
||||
## 第一条 服务内容与交付方式
|
||||
|
||||
1.1 **服务模式**:甲方为乙方提供**专属**云服务器(或等价专属托管环境)、域名解析(或子域名)、程序部署与运行维护;乙方通过甲方提供的 **访问地址与账号** 使用本软件,**不交付、不提供** 源代码、私有仓库权限、部署脚本全集或可用于独立重建系统的技术资料。
|
||||
|
||||
1.2 **一用户一服务器**:本合同项下服务器**仅供乙方使用**,不与其他客户共用同一台服务器、同一操作系统实例或同一套生产部署环境。甲方不得将其他客户的程序、数据或账号部署于本合同约定的专属服务器上。
|
||||
|
||||
1.3 **交付物**(勾选实际提供项):
|
||||
- [ ] 专属服务器标识 / 实例 ID(选填):________________
|
||||
- [ ] 中控访问地址:________________
|
||||
- [ ] 实例访问地址(交易所):________________ / ________________ / ________________
|
||||
- [ ] 登录账号:________________(或另行发放)
|
||||
- [ ] 使用说明 / 培训(____ 次,每次 ____ 分钟,选填)
|
||||
|
||||
1.4 **不包含**(除非另签书面补充协议并另付费):源码转让、源码只读权限、独立私有化部署包、二次开发源代码交付、数据库完整镜像导出用于迁移至第三方系统、服务器 root/控制台账号移交(服务器由甲方代持运维)。
|
||||
|
||||
1.5 本软件著作权及部署架构归甲方所有。专属服务器的云账号/机器所有权或租赁关系由甲方管理,乙方取得的是**该服务器上本软件的有限使用权**,不转让著作权、商标权、服务器所有权及其他知识产权。
|
||||
|
||||
---
|
||||
|
||||
## 第二条 授权范围与使用限制
|
||||
|
||||
2.1 **授权性质**:普通、非独占、不可再许可;仅限本合同约定的**专属服务器**及域名/访问地址范围内使用。
|
||||
|
||||
2.2 **使用主体**:仅限乙方本人及经甲方书面确认的 ______ 名操作人员;账号不得转借、共享给合同外第三方。
|
||||
|
||||
2.3 **使用目的**:仅限乙方自身交易辅助、内部监控与运营;不得将本软件或实质相同的功能作为产品/服务向不特定公众或第三方收费提供。
|
||||
|
||||
2.4 **服务期限**:
|
||||
- 自 ______ 年 ____ 月 ____ 日起,至 ______ 年 ____ 月 ____ 日止;
|
||||
- 期满前 ______ 日双方可协商续签;期满未续费且未书面延期的,甲方有权停服并回收该专属服务器资源。
|
||||
|
||||
2.5 乙方不得实施下列行为:
|
||||
1. 要求或试图获取源码、Git 仓库、服务器 root/云控制台权限(合同另有约定的除外);
|
||||
2. 复制、传播、截图外传足以重建系统的架构说明、配置全集或程序文件;
|
||||
3. 对系统进行反向工程、抓包重建、或委托他人仿制同类托管产品对外经营;
|
||||
4. 将访问账号、域名、API 密钥用于合同约定外的用途或转售;
|
||||
5. 攻击、扫描本合同专属服务器或甲方其他基础设施。
|
||||
|
||||
---
|
||||
|
||||
## 第三条 费用与支付
|
||||
|
||||
3.1 乙方按下列项目向甲方支付费用(勾选并填写金额;可打包为「标准套餐价」并在备注中列明分项):
|
||||
|
||||
| 费用项目 | 说明 | 金额(元) | 计费周期 |
|
||||
|----------|------|------------|----------|
|
||||
| 服务器费用 | **乙方专属**云主机、带宽、磁盘等(不与其他客户分摊同一台机器) | ¥ ______ | □月付 □年付 |
|
||||
| 域名费用 | 域名注册/续费(域名归属:□甲方代持 □乙方自有,解析由甲方配置) | ¥ ______ | □年付 |
|
||||
| 部署费用 | 在专属服务器上首次环境搭建、证书、实例与中控上线(一次性) | ¥ ______ | 一次性 |
|
||||
| 程序使用费 | 本软件托管使用权、日常更新与基础运维 | ¥ ______ | □月付 □年付 |
|
||||
|
||||
3.2 **合计**(首年 / 首月应付):人民币(大写)________________ 元整(¥ ________)。
|
||||
|
||||
3.3 **支付方式与时间**:________________(如:签约后 ____ 日内付部署费+首周期费用;之后每 ____ 提前 ____ 日支付续费)。
|
||||
|
||||
3.4 **续费**:服务期满前,乙方按 3.1 约定支付下一周期费用;逾期超过 ______ 日未付的,甲方有权暂停服务;逾期超过 ______ 日仍未付的,甲方有权解除合同并停服,已付未消费部分按实际服务天数抵扣后退还(部署费是否退还:□不退 □按约定 ________________)。
|
||||
|
||||
3.5 **价格调整**:续签时,因云厂商涨价、域名涨价或功能范围扩大,甲方可提前 ______ 日书面通知调整后续周期价格;乙方不同意调整的,可在当前周期结束后不再续签。
|
||||
|
||||
3.6 [ ] 本次为试用 / 友情托管:期限至 ______,费用减免 ________________,乙方仍须遵守第二条全部限制。
|
||||
|
||||
---
|
||||
|
||||
## 第四条 部署、运维与更新
|
||||
|
||||
4.1 **甲方责任**(合理范围内):
|
||||
- 按约定完成首次部署并使乙方可以登录使用;
|
||||
- 程序版本更新、安全补丁、PM2/进程异常重启等**基础运维**(具体 SLA:________________,如「工作日 24 小时内响应」);
|
||||
- 因交易所 API 变更导致的**常规适配**(重大重构另议)。
|
||||
|
||||
4.2 **乙方责任**:
|
||||
- 提供合法有效的交易所 API 等密钥信息,并保证账户使用合规;
|
||||
- 妥善保管登录密码;因乙方泄露导致的损失由乙方承担;
|
||||
- 按约定及时支付各项费用。
|
||||
|
||||
4.3 **数据**:乙方在系统中的交易记录、配置等业务数据归属乙方,并存放于本合同专属服务器;甲方为运维可接触相关数据,但不得用于合同约定外的目的,亦不得将乙方数据混存于其他客户服务器。合同终止后,乙方可申请导出**业务数据**(格式:________________,费用:________________);**不包含**源码与部署环境镜像。
|
||||
|
||||
4.4 **停服与备份**:甲方在停服前 ______ 日通知乙方(因乙方欠费紧急停服除外);停服后该专属服务器上的数据保留 ______ 日,逾期可删除并释放服务器资源。
|
||||
|
||||
---
|
||||
|
||||
## 第五条 保密
|
||||
|
||||
5.1 乙方对知悉的本软件存在、界面逻辑、非公开功能、报价及甲方技术方案负有保密义务。
|
||||
|
||||
5.2 甲方对乙方的 API 密钥、账户信息负有保密义务,除运维必需与法律要求外不得向第三方披露。
|
||||
|
||||
5.3 保密期限:合同存续期间及终止后 ______ 年(未填则视为 5 年)。
|
||||
|
||||
---
|
||||
|
||||
## 第六条 免责与风险提示
|
||||
|
||||
6.1 本软件为交易辅助工具,不构成投资建议。市场有风险,乙方交易决策与盈亏自行承担。
|
||||
|
||||
6.2 因行情、交易所接口变更、网络故障、云厂商故障、乙方误操作等导致的交易或间接损失,在法律允许范围内甲方不承担责任;因甲方故意或重大过失造成的服务长时间不可用除外(可约定:连续不可用超过 ____ 小时按比例退还当期程序使用费)。
|
||||
|
||||
6.3 甲方保证其有权提供本托管服务并享有本软件著作权;乙方保证身份信息及资金账户来源合法。
|
||||
|
||||
---
|
||||
|
||||
## 第七条 违约责任
|
||||
|
||||
7.1 乙方欠费、外传账号、试图获取源码或违反第二条的,甲方有权**暂停或立即终止服务**,并要求:
|
||||
1. 停止违约行为;
|
||||
2. 支付欠费及违约金人民币 ________ 元(或按实际损失);
|
||||
3. 赔偿甲方维权合理费用。
|
||||
|
||||
7.2 甲方无正当理由逾期未完成首次部署超过 ______ 日,或恶意长期停服且无合理解释的,乙方有权解除合同并要求退还已付未消费部分(部署费处理按 3.4 约定)。
|
||||
|
||||
---
|
||||
|
||||
## 第八条 合同解除与终止
|
||||
|
||||
8.1 协商一致可书面解除。
|
||||
|
||||
8.2 一方严重违约,守约方书面通知后 ______ 日内仍未改正的,守约方可解除。
|
||||
|
||||
8.3 终止后:乙方停止使用;甲方关闭访问权限;双方按第四条、第五条履行数据与保密义务。
|
||||
|
||||
---
|
||||
|
||||
## 第九条 争议解决
|
||||
|
||||
因本合同引起的争议,双方协商解决;协商不成的,提交甲方住所地有管辖权的人民法院诉讼解决(或:提交 ________ 仲裁委员会仲裁)。
|
||||
|
||||
---
|
||||
|
||||
## 第十条 其他
|
||||
|
||||
10.1 未尽事宜可签订补充协议。
|
||||
|
||||
10.2 本合同一式贰份,甲乙双方各执壹份,具有同等法律效力。
|
||||
|
||||
10.3 附件(如有):□《著作权声明》副本 □《服务说明与报价说明》 □ 服务清单 / 报价单 □ 域名与实例列表 □ 其他:________
|
||||
|
||||
---
|
||||
|
||||
## 签署栏
|
||||
|
||||
**甲方(服务提供方 / 著作权人):**
|
||||
|
||||
签名:________________ 日期:______ 年 ____ 月 ____ 日
|
||||
|
||||
**乙方(客户):**
|
||||
|
||||
签名 / 盖章:________________ 日期:______ 年 ____ 月 ____ 日
|
||||
|
||||
---
|
||||
|
||||
## 填写提示(签署前可删本段)
|
||||
|
||||
1. **标准商业路径**:专属服务器费 + 域名费 + 部署费(首单)+ 程序使用费(按月/年)— 四项建议在报价单里写清,合同 3.1 表格与报价一致。
|
||||
2. **一用户一服务器**:新客户开新机器;不要把多名客户塞进同一台 VPS。
|
||||
3. **源码**:默认一律不交付;若客户坚持私有化,应另签高价「源码许可/买断」合同,与本托管模板分开。
|
||||
4. **自用**:著作权人本人使用无需签本合同,见《著作权声明》。
|
||||
5. **不要**在仓库添加开源 `LICENSE`(MIT 等),与「保留所有权利 + 托管授权」冲突。
|
||||
@@ -61,6 +61,11 @@
|
||||
document.querySelectorAll(".embed-top-nav [data-embed-tab]").forEach((a) => {
|
||||
a.classList.toggle("active", a.getAttribute("data-embed-tab") === tab);
|
||||
});
|
||||
if (global.InstanceMobileNav && typeof global.InstanceMobileNav.onTabChange === "function") {
|
||||
global.InstanceMobileNav.onTabChange(tab);
|
||||
} else if (global.InstanceMobileNav && typeof global.InstanceMobileNav.syncTabActive === "function") {
|
||||
global.InstanceMobileNav.syncTabActive(tab);
|
||||
}
|
||||
}
|
||||
|
||||
function pageNavAllowed(tab) {
|
||||
@@ -235,9 +240,57 @@
|
||||
const parts = [];
|
||||
if (qs) parts.push(qs);
|
||||
parts.push("embed=1");
|
||||
if (tab === "settings") {
|
||||
try {
|
||||
const st = new URLSearchParams(location.search).get("settings_tab");
|
||||
if (st) parts.push("settings_tab=" + encodeURIComponent(st));
|
||||
} catch (_) {}
|
||||
}
|
||||
return url + "?" + parts.join("&");
|
||||
}
|
||||
|
||||
function setSettingsSubTabInUrl(key) {
|
||||
if (!key) return;
|
||||
try {
|
||||
const q = new URLSearchParams(location.search);
|
||||
q.set("tab", "settings");
|
||||
q.set("settings_tab", key);
|
||||
q.set("embed", "1");
|
||||
history.replaceState(null, "", "/embed?" + q.toString());
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
function activateSettingsSubTab(key) {
|
||||
if (!key) return;
|
||||
setSettingsSubTabInUrl(key);
|
||||
const pane = tabPanes.get("settings") || document;
|
||||
const radio = pane.querySelector(
|
||||
'input.env-tab-radio[data-settings-tab="' + key + '"]'
|
||||
);
|
||||
if (radio) radio.checked = true;
|
||||
}
|
||||
|
||||
function formActionPath(form) {
|
||||
try {
|
||||
return new URL(form.action || "", location.href).pathname.replace(/\/$/, "") || "/";
|
||||
} catch (_) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
function maybeKeepSettingsSubTabAfterForm(form) {
|
||||
const path = formActionPath(form);
|
||||
if (path === "/manual_transfer") {
|
||||
setSettingsSubTabInUrl("transfer");
|
||||
return "transfer";
|
||||
}
|
||||
if (path.indexOf("/api/options/transfer") >= 0 || path.indexOf("/api/options/cross-transfer") >= 0) {
|
||||
setSettingsSubTabInUrl("options_transfer");
|
||||
return "options_transfer";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
async function fetchTabHtml(tab) {
|
||||
const r = await fetch(embedPageUrl(tab), {
|
||||
credentials: "same-origin",
|
||||
@@ -400,14 +453,15 @@
|
||||
}
|
||||
}
|
||||
const fd = new FormData(form);
|
||||
const keepSub = maybeKeepSettingsSubTabAfterForm(form);
|
||||
return fetch(form.action, {
|
||||
method: form.method || "POST",
|
||||
body: fd,
|
||||
credentials: "same-origin",
|
||||
redirect: "manual",
|
||||
})
|
||||
.then(() => reloadCurrentTab())
|
||||
.catch(() => reloadCurrentTab());
|
||||
.then(() => reloadCurrentTab().then(() => activateSettingsSubTab(keepSub)))
|
||||
.catch(() => reloadCurrentTab().then(() => activateSettingsSubTab(keepSub)));
|
||||
}
|
||||
|
||||
function patchApplyListWindow() {
|
||||
@@ -466,14 +520,15 @@
|
||||
if (CUSTOM_SUBMIT_FORM_IDS.has(form.id)) return;
|
||||
ev.preventDefault();
|
||||
const fd = new FormData(form);
|
||||
const keepSub = maybeKeepSettingsSubTabAfterForm(form);
|
||||
fetch(form.action, {
|
||||
method: form.method || "POST",
|
||||
body: fd,
|
||||
credentials: "same-origin",
|
||||
redirect: "manual",
|
||||
})
|
||||
.then(() => reloadCurrentTab())
|
||||
.catch(() => reloadCurrentTab());
|
||||
.then(() => reloadCurrentTab().then(() => activateSettingsSubTab(keepSub)))
|
||||
.catch(() => reloadCurrentTab().then(() => activateSettingsSubTab(keepSub)));
|
||||
},
|
||||
true
|
||||
);
|
||||
|
||||
@@ -0,0 +1,177 @@
|
||||
/**
|
||||
* 实例手机壳: ≤720px 底栏 +「更多」,与 embed soft-nav 同步.
|
||||
*/
|
||||
(function (global) {
|
||||
const PRIMARY = { trade: 1, key_monitor: 1, options: 1 };
|
||||
const MQ = "(max-width: 720px)";
|
||||
|
||||
function isEmbedShell() {
|
||||
return document.body && document.body.getAttribute("data-embed-shell") === "1";
|
||||
}
|
||||
|
||||
function isMobileLayout() {
|
||||
return window.matchMedia(MQ).matches;
|
||||
}
|
||||
|
||||
function syncPhoneClass() {
|
||||
if (!document.body) return;
|
||||
document.body.classList.toggle("inst-phone", isMobileLayout());
|
||||
}
|
||||
|
||||
function currentTab() {
|
||||
if (global.InstanceEmbed && typeof global.InstanceEmbed.getTab === "function") {
|
||||
return global.InstanceEmbed.getTab();
|
||||
}
|
||||
try {
|
||||
const t = new URLSearchParams(location.search).get("tab");
|
||||
if (t) return t;
|
||||
} catch (_) {}
|
||||
return (document.body && document.body.getAttribute("data-page")) || "trade";
|
||||
}
|
||||
|
||||
function closeMore() {
|
||||
document.body.classList.remove("inst-mobile-more-open");
|
||||
const more = document.getElementById("inst-mobile-more");
|
||||
const btn = document.getElementById("inst-m-tab-more");
|
||||
if (more) more.setAttribute("aria-hidden", "true");
|
||||
if (btn) btn.setAttribute("aria-expanded", "false");
|
||||
syncTabActive(currentTab());
|
||||
}
|
||||
|
||||
function openMore() {
|
||||
if (!isMobileLayout()) return;
|
||||
document.body.classList.add("inst-mobile-more-open");
|
||||
const more = document.getElementById("inst-mobile-more");
|
||||
const btn = document.getElementById("inst-m-tab-more");
|
||||
if (more) more.setAttribute("aria-hidden", "false");
|
||||
if (btn) btn.setAttribute("aria-expanded", "true");
|
||||
syncTabActive(currentTab());
|
||||
}
|
||||
|
||||
function toggleMore() {
|
||||
if (document.body.classList.contains("inst-mobile-more-open")) closeMore();
|
||||
else openMore();
|
||||
}
|
||||
|
||||
function syncTabActive(tab) {
|
||||
const page = tab || currentTab();
|
||||
const primary = !!PRIMARY[page];
|
||||
const moreOpen = document.body.classList.contains("inst-mobile-more-open");
|
||||
document.querySelectorAll("#inst-mobile-tabbar .inst-m-tab").forEach((el) => {
|
||||
const t = el.getAttribute("data-embed-tab") || "";
|
||||
let on = false;
|
||||
if (t === "more") on = moreOpen || !primary;
|
||||
else on = !moreOpen && t === page;
|
||||
el.classList.toggle("active", on);
|
||||
});
|
||||
document.querySelectorAll("#inst-mobile-more .inst-mobile-more-nav [data-embed-tab]").forEach((a) => {
|
||||
a.classList.toggle("active", a.getAttribute("data-embed-tab") === page);
|
||||
});
|
||||
}
|
||||
|
||||
/** embed 切页时关闭「更多」并同步高亮 */
|
||||
function onTabChange(tab) {
|
||||
document.body.classList.remove("inst-mobile-more-open");
|
||||
const more = document.getElementById("inst-mobile-more");
|
||||
const btn = document.getElementById("inst-m-tab-more");
|
||||
if (more) more.setAttribute("aria-hidden", "true");
|
||||
if (btn) btn.setAttribute("aria-expanded", "false");
|
||||
syncTabActive(tab);
|
||||
}
|
||||
|
||||
function goTab(tab) {
|
||||
if (!tab || tab === "more") return;
|
||||
closeMore();
|
||||
if (global.InstanceEmbed && typeof global.InstanceEmbed.loadTab === "function") {
|
||||
if (tab === currentTab()) {
|
||||
syncTabActive(tab);
|
||||
return;
|
||||
}
|
||||
void global.InstanceEmbed.loadTab(tab);
|
||||
return;
|
||||
}
|
||||
const pathMap = {
|
||||
dashboard: "/dashboard",
|
||||
key_monitor: "/key_monitor",
|
||||
trade: "/trade",
|
||||
strategy: "/strategy",
|
||||
strategy_records: "/strategy/records",
|
||||
options: "/options",
|
||||
options_review: "/options/review",
|
||||
hedge_plan: "/hedge-plan",
|
||||
records: "/records",
|
||||
stats: "/stats",
|
||||
risk_policy: "/risk_policy",
|
||||
system_guide: "/system_guide",
|
||||
env_config: "/env_config",
|
||||
settings: "/settings",
|
||||
};
|
||||
location.href = pathMap[tab] || "/trade";
|
||||
}
|
||||
|
||||
function bindChrome() {
|
||||
const moreBtn = document.getElementById("inst-m-tab-more");
|
||||
const backdrop = document.getElementById("inst-mobile-more-backdrop");
|
||||
const closeBtn = document.getElementById("inst-mobile-more-close");
|
||||
if (moreBtn) {
|
||||
moreBtn.addEventListener("click", (ev) => {
|
||||
ev.preventDefault();
|
||||
toggleMore();
|
||||
});
|
||||
}
|
||||
if (backdrop) backdrop.addEventListener("click", closeMore);
|
||||
if (closeBtn) closeBtn.addEventListener("click", closeMore);
|
||||
document.addEventListener("keydown", (ev) => {
|
||||
if (ev.key === "Escape" && document.body.classList.contains("inst-mobile-more-open")) {
|
||||
closeMore();
|
||||
}
|
||||
});
|
||||
|
||||
document.querySelectorAll("#inst-mobile-tabbar .inst-m-tab[data-embed-tab]").forEach((el) => {
|
||||
if (el.getAttribute("data-embed-tab") === "more") return;
|
||||
el.addEventListener("click", (ev) => {
|
||||
if (ev.ctrlKey || ev.metaKey || ev.shiftKey || ev.altKey) return;
|
||||
ev.preventDefault();
|
||||
goTab(el.getAttribute("data-embed-tab"));
|
||||
});
|
||||
});
|
||||
document.querySelectorAll("#inst-mobile-more .inst-mobile-more-nav [data-embed-tab]").forEach((a) => {
|
||||
a.addEventListener("click", (ev) => {
|
||||
if (ev.ctrlKey || ev.metaKey || ev.shiftKey || ev.altKey) return;
|
||||
ev.preventDefault();
|
||||
goTab(a.getAttribute("data-embed-tab"));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function boot() {
|
||||
if (!isEmbedShell()) return;
|
||||
if (!document.getElementById("inst-mobile-tabbar")) return;
|
||||
syncPhoneClass();
|
||||
bindChrome();
|
||||
syncTabActive(currentTab());
|
||||
let resizeTimer = null;
|
||||
window.addEventListener("resize", () => {
|
||||
clearTimeout(resizeTimer);
|
||||
resizeTimer = setTimeout(() => {
|
||||
const was = document.body.classList.contains("inst-phone");
|
||||
syncPhoneClass();
|
||||
if (!isMobileLayout()) closeMore();
|
||||
else if (!was) syncTabActive(currentTab());
|
||||
}, 120);
|
||||
});
|
||||
}
|
||||
|
||||
global.InstanceMobileNav = {
|
||||
syncTabActive,
|
||||
onTabChange,
|
||||
closeMore,
|
||||
isMobileLayout,
|
||||
};
|
||||
|
||||
if (document.readyState === "loading") {
|
||||
document.addEventListener("DOMContentLoaded", boot);
|
||||
} else {
|
||||
boot();
|
||||
}
|
||||
})(typeof window !== "undefined" ? window : globalThis);
|
||||
@@ -31,6 +31,8 @@
|
||||
function applyDisplayToNav(display) {
|
||||
const map = {
|
||||
dashboard: "show_nav_dashboard",
|
||||
key_monitor: "show_nav_key_monitor",
|
||||
trade: "show_nav_trade",
|
||||
strategy: "show_nav_strategy",
|
||||
strategy_records: "show_nav_strategy_records",
|
||||
records: "show_nav_records",
|
||||
@@ -44,14 +46,19 @@
|
||||
system_guide: "show_nav_system_guide",
|
||||
env_config: "show_nav_env_config",
|
||||
};
|
||||
document.querySelectorAll(".embed-top-nav [data-embed-tab], .top-nav a[href^='/']").forEach((a) => {
|
||||
const tab = a.getAttribute("data-embed-tab") || (a.getAttribute("href") || "").replace(/^\//, "").split("?")[0];
|
||||
const key = map[tab];
|
||||
if (!key) return;
|
||||
const show = navPrefShow(display, key);
|
||||
a.classList.toggle("nav-hidden", !show);
|
||||
a.style.display = show ? "" : "none";
|
||||
});
|
||||
document
|
||||
.querySelectorAll(
|
||||
".embed-top-nav [data-embed-tab], .top-nav a[href^='/'], #inst-mobile-tabbar [data-embed-tab], #inst-mobile-more [data-embed-tab]"
|
||||
)
|
||||
.forEach((a) => {
|
||||
const tab = a.getAttribute("data-embed-tab") || (a.getAttribute("href") || "").replace(/^\//, "").split("?")[0];
|
||||
if (tab === "more") return;
|
||||
const key = map[tab];
|
||||
if (!key) return;
|
||||
const show = navPrefShow(display, key);
|
||||
a.classList.toggle("nav-hidden", !show);
|
||||
a.style.display = show ? "" : "none";
|
||||
});
|
||||
global.__INSTANCE_DISPLAY__ = display;
|
||||
}
|
||||
|
||||
@@ -59,6 +66,8 @@
|
||||
const d = DISPLAY();
|
||||
const map = {
|
||||
dashboard: "show_nav_dashboard",
|
||||
key_monitor: "show_nav_key_monitor",
|
||||
trade: "show_nav_trade",
|
||||
strategy: "show_nav_strategy",
|
||||
strategy_records: "show_nav_strategy_records",
|
||||
records: "show_nav_records",
|
||||
|
||||
@@ -5526,3 +5526,441 @@ html[data-theme="light"] .options-review-wrap .or-reviewed-table tbody tr:hover
|
||||
color: #ff8b8b;
|
||||
}
|
||||
|
||||
/* —— 实例手机壳:底栏四件套(仅 ≤720px + body.inst-phone) —— */
|
||||
.inst-mobile-tabbar,
|
||||
.inst-mobile-more,
|
||||
.instance-phone-only {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
:root {
|
||||
--inst-m-tabbar-h: 56px;
|
||||
--inst-m-page-pad: calc(var(--inst-m-tabbar-h) + max(16px, env(safe-area-inset-bottom)) + 12px);
|
||||
}
|
||||
|
||||
/* 仅手机壳:不碰 >720 桌面/平板。overflow 放 container,避免裁切 fixed 下单弹窗 */
|
||||
body.inst-phone {
|
||||
padding-bottom: var(--inst-m-page-pad) !important;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body.inst-phone .embed-top-nav.top-nav {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
body.inst-phone .header {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
body.inst-phone .header h1 {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
body.inst-phone .container {
|
||||
padding-bottom: 8px !important;
|
||||
max-width: 100% !important;
|
||||
min-width: 0 !important;
|
||||
overflow-x: hidden !important;
|
||||
}
|
||||
|
||||
body.inst-phone #embed-page-root,
|
||||
body.inst-phone .embed-tab-pane,
|
||||
body.inst-phone .embed-tab-pane.is-active-pane {
|
||||
max-width: 100%;
|
||||
min-width: 0;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
body.inst-phone .card {
|
||||
max-width: 100%;
|
||||
min-width: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body.inst-phone .instance-header-toolbar {
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
body.inst-phone .instance-header-toolbar-end {
|
||||
width: auto;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
body.inst-phone .instance-phone-only {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
body.inst-phone .instance-header-phone-strip {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 6px;
|
||||
margin-top: 8px;
|
||||
padding-top: 8px;
|
||||
border-top: 1px solid rgba(255, 255, 255, 0.06);
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
html[data-theme="light"] body.inst-phone .instance-header-phone-strip {
|
||||
border-top-color: rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
body.inst-phone .inst-phone-chip {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
justify-content: space-between;
|
||||
gap: 6px;
|
||||
min-height: 32px;
|
||||
min-width: 0;
|
||||
padding: 6px 8px;
|
||||
border-radius: 8px;
|
||||
background: rgba(255, 255, 255, 0.04);
|
||||
border: 1px solid rgba(255, 255, 255, 0.06);
|
||||
font-size: 12px;
|
||||
color: var(--inst-text);
|
||||
}
|
||||
|
||||
html[data-theme="light"] body.inst-phone .inst-phone-chip {
|
||||
background: rgba(0, 0, 0, 0.03);
|
||||
border-color: rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
body.inst-phone .inst-phone-chip em {
|
||||
font-style: normal;
|
||||
color: var(--inst-muted);
|
||||
font-size: 11px;
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
body.inst-phone .inst-phone-chip b {
|
||||
font-weight: 600;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
body.inst-phone .inst-phone-chip--pnl b {
|
||||
color: var(--inst-nav-idle);
|
||||
}
|
||||
|
||||
/* 实盘/关键位等表单:窄屏拉满,避免挤成一行裁切 */
|
||||
body.inst-phone #add-order-form.form-row,
|
||||
body.inst-phone form.form-row {
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
body.inst-phone #add-order-form.form-row > input:not([type="checkbox"]):not([type="radio"]),
|
||||
body.inst-phone #add-order-form.form-row > select,
|
||||
body.inst-phone #add-order-form #sltp-mode,
|
||||
body.inst-phone form.form-row > input:not([type="checkbox"]):not([type="radio"]),
|
||||
body.inst-phone form.form-row > select {
|
||||
flex: 1 1 100% !important;
|
||||
width: 100% !important;
|
||||
max-width: 100% !important;
|
||||
min-width: 0 !important;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body.inst-phone #add-order-form .order-entry-model-row,
|
||||
body.inst-phone #add-order-form .order-time-close-wrap,
|
||||
body.inst-phone #add-order-form > label,
|
||||
body.inst-phone #add-order-form > button {
|
||||
flex: 1 1 100%;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
body.inst-phone #add-order-form .order-entry-model-row select {
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
body.inst-phone .order-plan-preview {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
/* 期权:防止宽表撑破页面;表内横向滑看「操作」 */
|
||||
body.inst-phone .options-page-wrap,
|
||||
body.inst-phone .options-dual-grid,
|
||||
body.inst-phone .options-order-card,
|
||||
body.inst-phone .options-pos-card-wrap {
|
||||
max-width: 100%;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
body.inst-phone .options-dual-grid {
|
||||
grid-template-columns: minmax(0, 1fr) !important;
|
||||
}
|
||||
|
||||
body.inst-phone .options-chain-toolbar.form-row {
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
body.inst-phone .options-chain-toolbar .btn-secondary,
|
||||
body.inst-phone .options-chain-toolbar select,
|
||||
body.inst-phone .options-chain-toolbar .opt-chain-view-group,
|
||||
body.inst-phone .options-chain-toolbar .opt-type-btn-group {
|
||||
flex: 0 1 auto;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
body.inst-phone .options-strike-table-wrap,
|
||||
body.inst-phone .options-strike-table-wrap--t,
|
||||
body.inst-phone .options-history-table-wrap,
|
||||
body.inst-phone .table-wrap {
|
||||
display: block;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
overflow-x: auto !important;
|
||||
overflow-y: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
overscroll-behavior-x: contain;
|
||||
touch-action: pan-x pan-y;
|
||||
}
|
||||
|
||||
body.inst-phone .options-strike-table {
|
||||
width: max-content;
|
||||
min-width: 100%;
|
||||
}
|
||||
|
||||
body.inst-phone .options-strike-table th,
|
||||
body.inst-phone .options-strike-table td {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* 列表视图:隐藏合约 / 买一 / 到期平衡 / 距平衡(保留行权价·类型·卖一·操作) */
|
||||
body.inst-phone #opt-strike-head-list th:nth-child(3),
|
||||
body.inst-phone #opt-strike-head-list th:nth-child(5),
|
||||
body.inst-phone #opt-strike-head-list th:nth-child(6),
|
||||
body.inst-phone #opt-strike-head-list th:nth-child(7),
|
||||
body.inst-phone .opt-strike-row:not(.opt-strike-row-t) > td:nth-child(3),
|
||||
body.inst-phone .opt-strike-row:not(.opt-strike-row-t) > td:nth-child(5),
|
||||
body.inst-phone .opt-strike-row:not(.opt-strike-row-t) > td:nth-child(6),
|
||||
body.inst-phone .opt-strike-row:not(.opt-strike-row-t) > td:nth-child(7) {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* 选择后下单弹窗:盖过底栏,可滚动完整显示 */
|
||||
body.inst-phone .opt-order-backdrop {
|
||||
z-index: 2400;
|
||||
align-items: flex-end;
|
||||
justify-content: center;
|
||||
padding: 0;
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
background: rgba(0, 0, 0, 0.72);
|
||||
}
|
||||
|
||||
body.inst-phone .opt-order-backdrop:not([hidden]) {
|
||||
display: flex !important;
|
||||
}
|
||||
|
||||
body.inst-phone .opt-order-dialog {
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
max-height: min(88vh, 720px);
|
||||
margin: 0;
|
||||
border-radius: 16px 16px 0 0;
|
||||
padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
|
||||
overflow: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
body.inst-phone .opt-order-dialog .options-order-grid {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
body.inst-phone .options-estimate-row .opt-est-main {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
body.inst-phone .opt-size-mode-bar {
|
||||
flex-wrap: wrap;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
body.inst-phone .inst-mobile-tabbar {
|
||||
display: flex;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 80;
|
||||
height: calc(var(--inst-m-tabbar-h) + env(safe-area-inset-bottom));
|
||||
padding: 0 max(8px, env(safe-area-inset-right)) env(safe-area-inset-bottom)
|
||||
max(8px, env(safe-area-inset-left));
|
||||
align-items: stretch;
|
||||
justify-content: space-around;
|
||||
gap: 2px;
|
||||
background: color-mix(in srgb, #12161f 92%, transparent);
|
||||
border-top: 1px solid rgba(255, 255, 255, 0.08);
|
||||
backdrop-filter: blur(14px);
|
||||
-webkit-backdrop-filter: blur(14px);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html[data-theme="light"] body.inst-phone .inst-mobile-tabbar {
|
||||
background: color-mix(in srgb, #f4f7fb 94%, transparent);
|
||||
border-top-color: rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
body.inst-phone .inst-mobile-tabbar .inst-m-tab.nav-hidden {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
body.inst-phone .inst-m-tab {
|
||||
flex: 1 1 0;
|
||||
min-width: 0;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: 6px 2px;
|
||||
padding: 0 4px;
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
background: transparent;
|
||||
color: var(--inst-muted);
|
||||
font: inherit;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.04em;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
}
|
||||
|
||||
body.inst-phone .inst-m-tab:hover,
|
||||
body.inst-phone .inst-m-tab:focus-visible {
|
||||
color: var(--inst-text);
|
||||
background: rgba(255, 255, 255, 0.04);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
body.inst-phone .inst-m-tab.active {
|
||||
color: var(--inst-nav-idle);
|
||||
background: rgba(143, 200, 255, 0.12);
|
||||
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--inst-nav-idle) 35%, transparent);
|
||||
}
|
||||
|
||||
body.inst-phone.inst-mobile-more-open .inst-mobile-more {
|
||||
display: block;
|
||||
}
|
||||
|
||||
body.inst-phone .inst-mobile-more {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 90;
|
||||
}
|
||||
|
||||
body.inst-phone .inst-mobile-more-backdrop {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: rgba(0, 0, 0, 0.45);
|
||||
}
|
||||
|
||||
body.inst-phone .inst-mobile-more-sheet {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
max-height: min(78vh, 560px);
|
||||
overflow: auto;
|
||||
padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
|
||||
border-radius: 16px 16px 0 0;
|
||||
background: #12161f;
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
border-bottom: none;
|
||||
box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.35);
|
||||
}
|
||||
|
||||
html[data-theme="light"] body.inst-phone .inst-mobile-more-sheet {
|
||||
background: #f4f7fb;
|
||||
border-color: rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
body.inst-phone .inst-mobile-more-handle {
|
||||
width: 36px;
|
||||
height: 4px;
|
||||
margin: 2px auto 12px;
|
||||
border-radius: 999px;
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
|
||||
html[data-theme="light"] body.inst-phone .inst-mobile-more-handle {
|
||||
background: rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
body.inst-phone .inst-mobile-more-title {
|
||||
margin: 0 0 4px;
|
||||
font-size: 1rem;
|
||||
color: var(--inst-text);
|
||||
}
|
||||
|
||||
body.inst-phone .inst-mobile-more-hint {
|
||||
margin: 0 0 14px;
|
||||
font-size: 11px;
|
||||
color: var(--inst-muted);
|
||||
}
|
||||
|
||||
body.inst-phone .inst-mobile-more-nav {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
body.inst-phone .inst-mobile-more-nav a {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 44px;
|
||||
padding: 10px 8px;
|
||||
border-radius: 10px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
color: var(--inst-text);
|
||||
text-decoration: none;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
html[data-theme="light"] body.inst-phone .inst-mobile-more-nav a {
|
||||
border-color: rgba(0, 0, 0, 0.1);
|
||||
background: rgba(0, 0, 0, 0.03);
|
||||
}
|
||||
|
||||
body.inst-phone .inst-mobile-more-nav a.nav-hidden {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
body.inst-phone .inst-mobile-more-nav a.active {
|
||||
border-color: color-mix(in srgb, var(--inst-nav-idle) 45%, transparent);
|
||||
background: rgba(143, 200, 255, 0.12);
|
||||
color: var(--inst-nav-idle);
|
||||
}
|
||||
|
||||
body.inst-phone .inst-mobile-more-close {
|
||||
width: 100%;
|
||||
margin-top: 14px;
|
||||
min-height: 44px;
|
||||
border-radius: 10px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.12);
|
||||
background: transparent;
|
||||
color: var(--inst-text);
|
||||
font: inherit;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
html[data-theme="light"] body.inst-phone .inst-mobile-more-close {
|
||||
border-color: rgba(0, 0, 0, 0.12);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -280,8 +280,15 @@
|
||||
const mode = currentSizeMode();
|
||||
const sheetsEl = document.getElementById("opt-sheets-amount");
|
||||
const ethEl = document.getElementById("opt-eth-amount");
|
||||
const hint = document.getElementById("opt-budget-full-hint");
|
||||
const capEl = document.getElementById("opt-budget-full-cap");
|
||||
if (sheetsEl) sheetsEl.style.display = mode === "sheets" ? "" : "none";
|
||||
if (ethEl) ethEl.style.display = mode === "eth_amount" ? "" : "none";
|
||||
if (hint) hint.style.display = mode === "budget_full" ? "" : "none";
|
||||
if (capEl && root && root.dataset.tradeBudget) {
|
||||
const n = Number(root.dataset.tradeBudget);
|
||||
if (Number.isFinite(n) && n > 0) capEl.textContent = n.toFixed(2);
|
||||
}
|
||||
document.querySelectorAll(".opt-size-mode-chip").forEach(function (chip) {
|
||||
const radio = chip.querySelector('input[name="opt-size-mode"]');
|
||||
chip.classList.toggle("is-selected", !!(radio && radio.checked));
|
||||
|
||||
Vendored
+18
@@ -70,7 +70,10 @@ HOT_RELOAD_EXACT = frozenset({
|
||||
"MONITOR_POLL_SECONDS",
|
||||
"AUTO_TRANSFER_ENABLED",
|
||||
"AUTO_TRANSFER_AMOUNT",
|
||||
"AUTO_TRANSFER_FROM",
|
||||
"AUTO_TRANSFER_TO",
|
||||
"AUTO_TRANSFER_BJ_HOUR",
|
||||
"TRANSFER_CCY",
|
||||
"FORCE_CLOSE_ENABLED",
|
||||
"FORCE_CLOSE_BJ_HOUR",
|
||||
"BTC_LEVERAGE",
|
||||
@@ -126,6 +129,17 @@ SELECT_OPTIONS: dict[str, tuple[tuple[str, str], ...]] = {
|
||||
("long_only", "仅做多"),
|
||||
("short_only", "仅做空"),
|
||||
),
|
||||
"AUTO_TRANSFER_FROM": (
|
||||
("funding", "funding 资金账户"),
|
||||
("swap", "swap 交易账户"),
|
||||
("spot", "spot 现货"),
|
||||
),
|
||||
"AUTO_TRANSFER_TO": (
|
||||
("swap", "swap 交易账户"),
|
||||
("funding", "funding 资金账户"),
|
||||
("spot", "spot 现货"),
|
||||
),
|
||||
"TRANSFER_CCY": (("USDT", "USDT"),),
|
||||
"HEDGE_PLAN_OO_BIAS_SPLIT_BY": (
|
||||
("budget", "预算金额"),
|
||||
("sheets", "张数"),
|
||||
@@ -136,6 +150,7 @@ _SELECT_ALIASES: dict[str, dict[str, str]] = {
|
||||
"OKX_TD_MODE": {"cross_margin": "cross", "isolated_margin": "isolated"},
|
||||
"BINANCE_MARGIN_MODE": {"cross_margin": "cross", "isolated_margin": "isolated"},
|
||||
"GATE_TD_MODE": {"cross_margin": "cross", "isolated_margin": "isolated"},
|
||||
"TRANSFER_CCY": {"usdt": "USDT"},
|
||||
}
|
||||
|
||||
|
||||
@@ -159,10 +174,13 @@ def normalize_select_value(key: str, value: Optional[str]) -> str:
|
||||
if low in aliases:
|
||||
return aliases[low]
|
||||
allowed = {v for v, _ in (SELECT_OPTIONS.get(key) or ())}
|
||||
allowed_by_lower = {v.lower(): v for v in allowed}
|
||||
if low in allowed:
|
||||
return low
|
||||
if raw in allowed:
|
||||
return raw
|
||||
if low in allowed_by_lower:
|
||||
return allowed_by_lower[low]
|
||||
return raw
|
||||
|
||||
|
||||
|
||||
Vendored
+9
-4
@@ -103,10 +103,10 @@ _SHARED_SECTIONS: list[dict[str, Any]] = [
|
||||
"fields": [
|
||||
("AUTO_TRANSFER_ENABLED", "启用自动划转", ""),
|
||||
("AUTO_TRANSFER_AMOUNT", "目标余额(U)", "交易账户目标 USDT"),
|
||||
("AUTO_TRANSFER_FROM", "划出账户", "funding 或 swap"),
|
||||
("AUTO_TRANSFER_TO", "划入账户", "swap 或 funding"),
|
||||
("AUTO_TRANSFER_FROM", "划出账户", "余额不足时从此账户划入交易账户"),
|
||||
("AUTO_TRANSFER_TO", "划入账户", "目标余额所在账户,一般为 swap"),
|
||||
("AUTO_TRANSFER_BJ_HOUR", "执行整点(北京时间)", ""),
|
||||
("TRANSFER_CCY", "划转币种", "默认 USDT"),
|
||||
("TRANSFER_CCY", "划转币种", ""),
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -200,6 +200,9 @@ _RUNTIME_ENV_DEFAULTS: dict[str, str] = {
|
||||
"RISK_MANUAL_CLOSE_DAILY_LIMIT": "2",
|
||||
"RISK_DAILY_LOSS_LIMIT": "2",
|
||||
"RISK_MOOD_ISSUES_DAILY_FREEZE": "true",
|
||||
"AUTO_TRANSFER_FROM": "funding",
|
||||
"AUTO_TRANSFER_TO": "swap",
|
||||
"TRANSFER_CCY": "USDT",
|
||||
"HEDGE_PLAN_SHOW_PERP_OPTIONS": "true",
|
||||
"HEDGE_PLAN_SHOW_OPTIONS_OPTIONS": "true",
|
||||
"OKX_OPTIONS_CHAIN_ASK_LIQ_FILTER_ENABLED": "true",
|
||||
@@ -214,7 +217,9 @@ _RUNTIME_ENV_DEFAULTS: dict[str, str] = {
|
||||
|
||||
def _effective_env_value(key: str, file_values: dict[str, str], schema_default: str = "") -> str:
|
||||
if key in file_values:
|
||||
return file_values[key]
|
||||
file_val = str(file_values.get(key) or "").strip()
|
||||
if file_val:
|
||||
return file_val
|
||||
runtime = os.getenv(key)
|
||||
if runtime is not None and str(runtime).strip() != "":
|
||||
return str(runtime).strip()
|
||||
|
||||
@@ -22,6 +22,7 @@ def execute_transfer_usdt(
|
||||
) -> tuple[bool, str, Any]:
|
||||
if amount <= 0:
|
||||
return False, "划转金额必须大于0", None
|
||||
ccy = (transfer_ccy or "USDT").strip().upper() or "USDT"
|
||||
ok_live, reason = ensure_live_ready()
|
||||
if not ok_live:
|
||||
return False, reason, None
|
||||
@@ -31,7 +32,7 @@ def execute_transfer_usdt(
|
||||
except Exception:
|
||||
pass
|
||||
try:
|
||||
resp = exchange.transfer(transfer_ccy, float(amount), from_account, to_account)
|
||||
resp = exchange.transfer(ccy, float(amount), from_account, to_account)
|
||||
return True, "划转成功", resp
|
||||
except Exception as e:
|
||||
msg = str(e)
|
||||
|
||||
@@ -71,6 +71,7 @@ def install_instance_theme_static(app) -> None:
|
||||
"strategy_roll.js": "application/javascript; charset=utf-8",
|
||||
"instance_page.css": "text/css; charset=utf-8",
|
||||
"instance_embed.js": "application/javascript; charset=utf-8",
|
||||
"instance_mobile_nav.js": "application/javascript; charset=utf-8",
|
||||
"instance_stats.js": "application/javascript; charset=utf-8",
|
||||
"instance_live.js": "application/javascript; charset=utf-8",
|
||||
"instance_settings_prefs.js": "application/javascript; charset=utf-8",
|
||||
|
||||
@@ -84,6 +84,11 @@ def embed_shell_enabled() -> bool:
|
||||
return (os.getenv("HUB_EMBED_SHELL") or "1").strip().lower() in ("1", "true", "yes", "on")
|
||||
|
||||
|
||||
_SETTINGS_SUB_TABS = frozenset(
|
||||
{"nav", "password", "transfer", "export", "options_swap", "options_transfer"}
|
||||
)
|
||||
|
||||
|
||||
def redirect_to_embed_shell_if_enabled(page: str):
|
||||
"""直连 /trade 等整页路由时,重定向到 embed 壳(顶栏常驻,tab 软切换)."""
|
||||
if not embed_shell_enabled():
|
||||
@@ -93,6 +98,12 @@ def redirect_to_embed_shell_if_enabled(page: str):
|
||||
if (request.path or "").rstrip("/") == "/embed":
|
||||
return None
|
||||
q = {k: v for k, v in request.args.items()}
|
||||
# embed 的 tab=页面名;系统设置内页签用 settings_tab,避免 /settings?tab=transfer 被覆盖成 tab=settings
|
||||
if (page or "").strip() == "settings":
|
||||
sub = (q.get("settings_tab") or "").strip()
|
||||
legacy = (q.get("tab") or "").strip()
|
||||
if not sub and legacy in _SETTINGS_SUB_TABS:
|
||||
q["settings_tab"] = legacy
|
||||
q["tab"] = page
|
||||
q["embed"] = "1"
|
||||
return redirect("/embed?" + urlencode(q))
|
||||
@@ -115,6 +126,11 @@ def rewrite_embed_dest(path: str, hub_theme: str | None = None) -> str:
|
||||
tab = path_to_embed_tab(split.path)
|
||||
q = dict(parse_qsl(split.query, keep_blank_values=True))
|
||||
if tab:
|
||||
if tab == "settings":
|
||||
sub = (q.get("settings_tab") or "").strip()
|
||||
legacy = (q.get("tab") or "").strip()
|
||||
if not sub and legacy in _SETTINGS_SUB_TABS:
|
||||
q["settings_tab"] = legacy
|
||||
q["tab"] = tab
|
||||
q["embed"] = "1"
|
||||
ht = (hub_theme or q.get("hub_theme") or "").strip().lower()
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<link rel="stylesheet" href="/static/instance_theme_early.css?v=4">
|
||||
<link rel="stylesheet" href="/static/account_risk_badge.css?v=4">
|
||||
<link rel="stylesheet" href="/static/instance_page.css?v=11">
|
||||
<link rel="stylesheet" href="/static/instance_theme.css?v=105">
|
||||
<link rel="stylesheet" href="/static/instance_theme.css?v=108">
|
||||
<script src="/static/account_risk_badge.js?v=4"></script>
|
||||
<meta name="theme-color" content="#0b0d14">
|
||||
<title>{{ pwa_app_name }}</title>
|
||||
@@ -93,6 +93,54 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 手机端主导航(≤720px);桌面不显示 -->
|
||||
<nav id="inst-mobile-tabbar" class="inst-mobile-tabbar" aria-label="手机主导航">
|
||||
<a href="/trade" class="inst-m-tab{% if initial_tab == 'trade' %} active{% endif %}" data-embed-tab="trade"{% if not display.show_nav_trade %} style="display:none"{% endif %}>下单</a>
|
||||
<a href="/key_monitor" class="inst-m-tab{% if initial_tab == 'key_monitor' %} active{% endif %}" data-embed-tab="key_monitor"{% if not display.show_nav_key_monitor %} style="display:none"{% endif %}>关键位</a>
|
||||
{% if options_nav_visible and display.show_nav_options %}
|
||||
<a href="/options" class="inst-m-tab{% if initial_tab == 'options' %} active{% endif %}" data-embed-tab="options">期权</a>
|
||||
{% endif %}
|
||||
<button type="button" class="inst-m-tab" data-embed-tab="more" id="inst-m-tab-more" aria-haspopup="dialog" aria-expanded="false">更多</button>
|
||||
</nav>
|
||||
<div id="inst-mobile-more" class="inst-mobile-more" aria-hidden="true">
|
||||
<div class="inst-mobile-more-backdrop" id="inst-mobile-more-backdrop"></div>
|
||||
<div class="inst-mobile-more-sheet" role="dialog" aria-modal="true" aria-labelledby="inst-mobile-more-title">
|
||||
<div class="inst-mobile-more-handle" aria-hidden="true"></div>
|
||||
<h2 id="inst-mobile-more-title" class="inst-mobile-more-title">更多</h2>
|
||||
<p class="inst-mobile-more-hint">次要页面 · 完整界面请用电脑</p>
|
||||
<nav class="inst-mobile-more-nav" aria-label="更多页面">
|
||||
<a href="/dashboard" data-embed-tab="dashboard"{% if not display.show_nav_dashboard %} style="display:none"{% endif %}>数据看板</a>
|
||||
{% if display.show_nav_records %}
|
||||
<a href="/records" data-embed-tab="records">交易记录</a>
|
||||
{% endif %}
|
||||
{% if not intraday_discipline and display.show_nav_strategy %}
|
||||
<a href="/strategy" data-embed-tab="strategy">策略交易</a>
|
||||
{% endif %}
|
||||
{% if not intraday_discipline and display.show_nav_strategy_records %}
|
||||
<a href="/strategy/records" data-embed-tab="strategy_records">策略记录</a>
|
||||
{% endif %}
|
||||
{% if display.show_nav_stats %}
|
||||
<a href="/stats" data-embed-tab="stats">统计分析</a>
|
||||
{% endif %}
|
||||
{% if options_nav_visible and display.show_nav_options_review %}
|
||||
<a href="/options/review" data-embed-tab="options_review">期权复盘</a>
|
||||
{% endif %}
|
||||
{% if hedge_plan_nav_visible and display.show_nav_hedge_plan %}
|
||||
<a href="/hedge-plan" data-embed-tab="hedge_plan">对冲计划</a>
|
||||
{% endif %}
|
||||
{% if display.show_nav_risk_policy %}
|
||||
<a href="/risk_policy" data-embed-tab="risk_policy">风控说明</a>
|
||||
{% endif %}
|
||||
<a href="/system_guide" data-embed-tab="system_guide"{% if not display.show_nav_system_guide %} style="display:none"{% endif %}>系统说明</a>
|
||||
{% if display.show_nav_env_config %}
|
||||
<a href="/env_config" data-embed-tab="env_config">env配置</a>
|
||||
{% endif %}
|
||||
<a href="/settings" data-embed-tab="settings">系统设置</a>
|
||||
</nav>
|
||||
<button type="button" class="inst-mobile-more-close" id="inst-mobile-more-close">关闭</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="/static/instance_ui.js?v=10"></script>
|
||||
<script src="/static/journal_upload_slots.js?v=4"></script>
|
||||
<script src="/static/instance_records_mobile.js?v=2"></script>
|
||||
@@ -118,8 +166,9 @@ const ORDER_ENTRY_MODEL_CODE_TO_CATEGORY = {{ entry_model_code_to_category | toj
|
||||
<script>
|
||||
window.__INSTANCE_DISPLAY__ = {{ display | tojson }};
|
||||
</script>
|
||||
<script src="/static/instance_settings_prefs.js?v=15"></script>
|
||||
<script src="/static/instance_settings_prefs.js?v=16"></script>
|
||||
<script src="/static/instance_live.js?v=6"></script>
|
||||
<script src="/static/instance_embed.js?v=27"></script>
|
||||
<script src="/static/instance_embed.js?v=29"></script>
|
||||
<script src="/static/instance_mobile_nav.js?v=2"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{# 统一顶栏:状态 + 筛选(上)· 统计条(下) #}
|
||||
<div class="instance-header-panel card">
|
||||
<div class="instance-header-toolbar">
|
||||
<div class="instance-header-toolbar-filter">
|
||||
<div class="instance-header-toolbar-filter instance-desktop-only">
|
||||
<span class="list-window-label" title="列表按 UTC 时间筛选,默认本月">UTC {{ list_window.label }}</span>
|
||||
<label class="list-window-preset">预设
|
||||
<select id="win-preset-select" onchange="toggleListWindowCustom()">
|
||||
@@ -37,4 +37,18 @@
|
||||
<div class="instance-header-stats-wrap instance-desktop-only">
|
||||
{% include 'instance_header_stats.html' %}
|
||||
</div>
|
||||
<div class="instance-header-phone-strip instance-phone-only" aria-label="手机资金摘要">
|
||||
<span class="inst-phone-chip">
|
||||
<em>交易</em>
|
||||
<b data-funds-field="current-capital">{{ funds_fmt(current_capital) }}U</b>
|
||||
</span>
|
||||
<span class="inst-phone-chip">
|
||||
<em>资金</em>
|
||||
<b data-funds-field="total-capital">{% if funding_usdt is not none %}{{ funds_fmt(funding_usdt) }}U{% else %}—{% endif %}</b>
|
||||
</span>
|
||||
<span class="inst-phone-chip">
|
||||
<em>总资</em>
|
||||
<b data-funds-field="total-funds">{% if total_funds is not none %}{{ funds_fmt(total_funds) }}U{% else %}—{% endif %}</b>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -6,9 +6,21 @@
|
||||
</div>
|
||||
|
||||
{% if settings_tabs %}
|
||||
<div class="env-config-body card settings-config-body">
|
||||
{% set _sub = (request.args.get('settings_tab') or '').strip() %}
|
||||
{% set _legacy_tab = (request.args.get('tab') or '').strip() %}
|
||||
{% set ns = namespace(active_idx=0, active_key='') %}
|
||||
{% for tab in settings_tabs %}
|
||||
{% if _sub and tab.key == _sub %}
|
||||
{% set ns.active_idx = loop.index0 %}
|
||||
{% set ns.active_key = tab.key %}
|
||||
{% elif (not _sub) and _legacy_tab and tab.key == _legacy_tab %}
|
||||
{% set ns.active_idx = loop.index0 %}
|
||||
{% set ns.active_key = tab.key %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<div class="env-config-body card settings-config-body" data-settings-active-tab="{{ ns.active_key }}">
|
||||
{% for tab in settings_tabs %}
|
||||
<input type="radio" name="settings-section" id="settings-sec-{{ loop.index0 }}" class="env-tab-radio"{% if loop.first %} checked{% endif %}>
|
||||
<input type="radio" name="settings-section" id="settings-sec-{{ loop.index0 }}" class="env-tab-radio" data-settings-tab="{{ tab.key }}"{% if loop.index0 == ns.active_idx %} checked{% endif %}>
|
||||
{% endfor %}
|
||||
<div class="env-config-tabs" role="tablist" aria-label="系统设置分类">
|
||||
{% for tab in settings_tabs %}
|
||||
@@ -52,3 +64,14 @@
|
||||
{% include 'options_settings_panel.html' %}
|
||||
{% endif %}
|
||||
</div>
|
||||
<script>
|
||||
(function () {
|
||||
try {
|
||||
var q = new URLSearchParams(window.location.search || "");
|
||||
var key = (q.get("settings_tab") || "").trim();
|
||||
if (!key) return;
|
||||
var radio = document.querySelector('input.env-tab-radio[data-settings-tab="' + key + '"]');
|
||||
if (radio) radio.checked = true;
|
||||
} catch (e) {}
|
||||
})();
|
||||
</script>
|
||||
|
||||
@@ -259,6 +259,11 @@ def eth_amount_from_sheets(sheets: int, ct_mult: float = 0.01) -> float:
|
||||
return round(int(sheets) * float(ct_mult), 8)
|
||||
|
||||
|
||||
def resolve_budget_full_usdc(trading_usdc: float, trade_budget_usdc: float) -> float:
|
||||
"""按可用余额打满:余额大于预算用预算,否则用余额."""
|
||||
return min(float(trading_usdc), float(trade_budget_usdc))
|
||||
|
||||
|
||||
def calc_order_size(
|
||||
*,
|
||||
quote_per_unit: float,
|
||||
|
||||
@@ -163,13 +163,18 @@ def _require_options_ex(cfg: dict[str, Any]):
|
||||
|
||||
|
||||
def _budget_full_usdc(cfg: dict[str, Any], ex: Any) -> tuple[float | None, str]:
|
||||
"""交易账户 USDC 可用余额(由 calc_order_size 再乘 budget_buffer 留余量)."""
|
||||
"""打满可用额度 = min(交易户可用 USDC, 单笔预算);calc_order_size 再乘 budget_buffer."""
|
||||
from lib.exchange.okx_options_lib import fetch_options_trading_usdc
|
||||
from lib.options.options_pricing_lib import resolve_budget_full_usdc
|
||||
|
||||
raw = fetch_options_trading_usdc(ex)
|
||||
if raw is None or float(raw) <= 0:
|
||||
return None, "交易账户 USDC 可用余额不足"
|
||||
return float(raw), ""
|
||||
trading = float(raw)
|
||||
cap = _env_float("OKX_OPTIONS_TRADE_BUDGET_USDC", float(cfg.get("trade_budget") or 10.0))
|
||||
if cap <= 0:
|
||||
return None, "单笔预算无效(OKX_OPTIONS_TRADE_BUDGET_USDC)"
|
||||
return resolve_budget_full_usdc(trading, float(cap)), ""
|
||||
|
||||
|
||||
def _open_premium_paid(cfg: dict[str, Any], inst_id: str) -> float | None:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<div class="options-page-wrap" style="grid-column:1/-1" id="options-root"
|
||||
data-default-underly="{{ options_default_underly | default('ETH') }}"
|
||||
data-budget-buffer="{{ options_budget_buffer | default(0.95) }}"
|
||||
data-trade-budget="{{ options_trade_budget | default(10) }}"
|
||||
data-ask-liq-filter="{% if options_chain_ask_liq_filter is defined %}{{ '1' if options_chain_ask_liq_filter else '0' }}{% else %}1{% endif %}">
|
||||
{% if not options_enabled %}
|
||||
<div class="flash" style="margin-bottom:12px">期权 API 未启用:请在 <code>crypto_monitor_okx/.env</code> 设置 <code>OKX_OPTIONS_ENABLED=true</code> 及主账户 <code>OKX_OPTIONS_API_*</code>,然后 <code>pm2 restart crypto_okx --update-env</code>.</div>
|
||||
@@ -18,7 +19,7 @@
|
||||
<li>环境配置「链上仅显示有卖一」开启时,隐藏无真实卖一或深度不足 1 张的合约(估算价 <strong>~</strong> 亦不显示)。</li>
|
||||
<li><strong>开仓只认真实卖一价且卖一深度≥1</strong>;无深度时面板显示参考标记价并禁用买入。</li>
|
||||
<li>链展示近 <span id="opt-chain-dte">14</span> 日到期;<strong>T 型</strong>默认 ATM ±5 档,可展开全部。</li>
|
||||
<li>「按可用余额打满」可用额度 = min(交易 USDC × 预算缓冲 <strong id="opt-budget-buf">{{ '%.2f'|format(options_budget_buffer|default(0.95)|float) }}</strong>, 单笔预算);可在 env「预算缓冲比例」改。</li>
|
||||
<li>「按可用余额打满」可用额度 = min(交易户可用 USDC, 单笔预算 <strong id="opt-trade-budget">{{ '%.2f'|format(options_trade_budget|default(10)|float) }}</strong>),再 × 预算缓冲 <strong id="opt-budget-buf">{{ '%.2f'|format(options_budget_buffer|default(0.95)|float) }}</strong> 算张数(env 可改)。</li>
|
||||
<li>平仓仅买一限价,详见说明文档。</li>
|
||||
</ul>
|
||||
<p><a href="/options/guide" target="_blank" rel="noopener">打开《期权开平仓与监控说明》</a></p>
|
||||
@@ -133,6 +134,9 @@
|
||||
<input type="number" id="opt-eth-amount" min="0.01" step="0.01" placeholder="如 0.5" style="display:none"
|
||||
autocomplete="off" inputmode="decimal" data-lpignore="true" data-1p-ignore="true" data-form-type="other">
|
||||
</div>
|
||||
<p class="muted opt-budget-full-hint" id="opt-budget-full-hint" style="display:none;margin:6px 0 0;font-size:.82rem;line-height:1.4">
|
||||
余额 > 单笔预算(<span id="opt-budget-full-cap">{{ '%.2f'|format(options_trade_budget|default(10)|float) }}</span>U)时按预算;余额不足时按余额;再乘预算缓冲算张数。
|
||||
</p>
|
||||
<input type="text" id="opt-signal-note" name="opt_signal_note" class="opt-signal-note" placeholder="备注(关键位说明)"
|
||||
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
|
||||
data-lpignore="true" data-1p-ignore="true" data-form-type="other" readonly>
|
||||
@@ -316,4 +320,4 @@
|
||||
</div>
|
||||
</div>
|
||||
<script src="/static/options_expiry_countdown.js?v=1"></script>
|
||||
<script src="/static/options_panel.js?v=49"></script>
|
||||
<script src="/static/options_panel.js?v=50"></script>
|
||||
|
||||
@@ -0,0 +1,674 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Generate business-style XMind (Zen/2020+) from playbook + behavior rules."""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import uuid
|
||||
import zipfile
|
||||
from pathlib import Path
|
||||
from typing import Any, Optional
|
||||
|
||||
OUT = Path(__file__).resolve().parents[1] / "docs" / "交易执行手册与行为准则.xmind"
|
||||
|
||||
# 商务配色:深蓝主调 + 灰蓝辅色 + 强调色
|
||||
C_ROOT = "#0F2942"
|
||||
C_L1 = "#1B4F72"
|
||||
C_L2 = "#2E86AB"
|
||||
C_PASS = "#1E8449"
|
||||
C_FAIL = "#922B21"
|
||||
C_WARN = "#B9770E"
|
||||
C_MUTED = "#566573"
|
||||
C_TEXT = "#FFFFFF"
|
||||
C_TEXT_DARK = "#1C2833"
|
||||
|
||||
|
||||
def tid() -> str:
|
||||
return uuid.uuid4().hex[:26]
|
||||
|
||||
|
||||
def style(
|
||||
*,
|
||||
fill: Optional[str] = None,
|
||||
color: Optional[str] = None,
|
||||
font_size: str = "12pt",
|
||||
bold: bool = False,
|
||||
shape: str = "org.xmind.topicShape.roundedRect",
|
||||
line: Optional[str] = None,
|
||||
) -> dict[str, Any]:
|
||||
props: dict[str, str] = {
|
||||
"shape-class": shape,
|
||||
"fo:font-family": "Microsoft YaHei",
|
||||
"fo:font-size": font_size,
|
||||
"fo:font-weight": "bold" if bold else "normal",
|
||||
"border-line-width": "0pt",
|
||||
"line-width": "1.5pt",
|
||||
"line-class": "org.xmind.branchConnection.roundedelbow",
|
||||
}
|
||||
if fill:
|
||||
props["svg:fill"] = fill
|
||||
if color:
|
||||
props["fo:color"] = color
|
||||
if line:
|
||||
props["line-color"] = line
|
||||
return {"id": tid(), "properties": props}
|
||||
|
||||
|
||||
def topic(
|
||||
title: str,
|
||||
children: list | None = None,
|
||||
*,
|
||||
markers: list[str] | None = None,
|
||||
labels: list[str] | None = None,
|
||||
notes: str | None = None,
|
||||
fill: Optional[str] = None,
|
||||
color: Optional[str] = None,
|
||||
font_size: str = "12pt",
|
||||
bold: bool = False,
|
||||
line: Optional[str] = None,
|
||||
) -> dict:
|
||||
node: dict[str, Any] = {
|
||||
"id": tid(),
|
||||
"class": "topic",
|
||||
"title": title,
|
||||
"style": style(
|
||||
fill=fill, color=color, font_size=font_size, bold=bold, line=line
|
||||
),
|
||||
}
|
||||
if markers:
|
||||
node["markers"] = [{"markerId": m} for m in markers]
|
||||
if labels:
|
||||
node["labels"] = labels
|
||||
if notes:
|
||||
node["notes"] = {"plain": {"content": notes}}
|
||||
if children:
|
||||
node["children"] = {"attached": children}
|
||||
return node
|
||||
|
||||
|
||||
def t1(title: str, children: list, markers: list[str], label: str) -> dict:
|
||||
return topic(
|
||||
title,
|
||||
children,
|
||||
markers=markers,
|
||||
labels=[label],
|
||||
fill=C_L1,
|
||||
color=C_TEXT,
|
||||
font_size="16pt",
|
||||
bold=True,
|
||||
line=C_L1,
|
||||
)
|
||||
|
||||
|
||||
def t2(title: str, children: list | None = None, markers: list[str] | None = None) -> dict:
|
||||
return topic(
|
||||
title,
|
||||
children,
|
||||
markers=markers or ["flag-dark-blue"],
|
||||
fill=C_L2,
|
||||
color=C_TEXT,
|
||||
font_size="13pt",
|
||||
bold=True,
|
||||
line=C_L2,
|
||||
)
|
||||
|
||||
|
||||
def leaf(
|
||||
title: str,
|
||||
*,
|
||||
markers: list[str] | None = None,
|
||||
fill: Optional[str] = None,
|
||||
color: Optional[str] = C_TEXT_DARK,
|
||||
) -> dict:
|
||||
return topic(
|
||||
title,
|
||||
markers=markers or ["symbol-right"],
|
||||
fill=fill or "#EBF5FB",
|
||||
color=color,
|
||||
font_size="11pt",
|
||||
line="#AED6F1",
|
||||
)
|
||||
|
||||
|
||||
def ok(title: str) -> dict:
|
||||
return leaf(title, markers=["other-yes", "symbol-right"], fill="#E8F8F5", color=C_PASS)
|
||||
|
||||
|
||||
def no(title: str) -> dict:
|
||||
return leaf(title, markers=["other-no", "flag-gray"], fill="#FDEDEC", color=C_FAIL)
|
||||
|
||||
|
||||
def warn(title: str) -> dict:
|
||||
return leaf(title, markers=["symbol-info"], fill="#FEF9E7", color=C_WARN)
|
||||
|
||||
|
||||
def build_content() -> list:
|
||||
root = topic(
|
||||
"交易执行体系\n手册 v2 · 开单三检",
|
||||
[
|
||||
t1(
|
||||
"① 设计理念",
|
||||
[
|
||||
t2(
|
||||
"核心主张",
|
||||
[
|
||||
leaf("少而精,珍惜机会,样本干净", markers=["star-dark-blue"]),
|
||||
leaf("不保证收益;过程可控,结果随缘", markers=["symbol-info"]),
|
||||
leaf("过滤比频率重要;日更不是目标", markers=["symbol-info"]),
|
||||
leaf("看不懂不做;不为开单找理由", markers=["symbol-info"]),
|
||||
warn("丢掉对冲:无「有保护就能多做」幻觉"),
|
||||
],
|
||||
markers=["other-lightbulb"],
|
||||
),
|
||||
t2(
|
||||
"工具边界",
|
||||
[
|
||||
leaf("OKX 期权:方向单(虚值等)", markers=["flag-blue"]),
|
||||
leaf("Gate 合约:结构清楚时的波段", markers=["flag-dark-blue"]),
|
||||
leaf("同一时段尽量只让一边说话", markers=["symbol-equality"]),
|
||||
no("不做期期对冲 / 偏置壳"),
|
||||
],
|
||||
markers=["symbol-info"],
|
||||
),
|
||||
t2(
|
||||
"文档分工",
|
||||
[
|
||||
leaf("行为准则:能不能动手(防火墙)", markers=["other-lock"]),
|
||||
leaf("执行手册:怎么做单(玩法/仓位/离场)", markers=["other-note"]),
|
||||
],
|
||||
markers=["other-businesscard"],
|
||||
),
|
||||
],
|
||||
markers=["priority-1", "other-lightbulb"],
|
||||
label="理念",
|
||||
),
|
||||
t1(
|
||||
"② 资金要求",
|
||||
[
|
||||
t2(
|
||||
"总盘约 800U",
|
||||
[
|
||||
leaf("单笔约 1.25% 量级", markers=["symbol-info"]),
|
||||
leaf("全错一天约 2.5% 量级——防守优先", markers=["symbol-info"]),
|
||||
],
|
||||
markers=["other-businesscard"],
|
||||
),
|
||||
t2(
|
||||
"单笔期权",
|
||||
[
|
||||
leaf("约 10U 权利金预算", markers=["priority-1"]),
|
||||
leaf("一次只持有一个期权仓位", markers=["symbol-info"]),
|
||||
leaf("打满 = min(余额, 单笔预算)", markers=["symbol-equality"]),
|
||||
],
|
||||
markers=["flag-blue"],
|
||||
),
|
||||
t2(
|
||||
"Gate 合约",
|
||||
[
|
||||
leaf("日内保证金约 50U · 约 10 倍", markers=["symbol-info"]),
|
||||
leaf("止损一般约 5U", markers=["symbol-info"]),
|
||||
leaf("单笔最大亏损不超过约 10U", markers=["flag-gray"]),
|
||||
leaf("有单才用保证金,无单为 0", markers=["task-done"]),
|
||||
],
|
||||
markers=["flag-dark-blue"],
|
||||
),
|
||||
t2(
|
||||
"日损失心理框",
|
||||
[
|
||||
warn("都错:合计大约 ≤20U"),
|
||||
ok("都对:期望可到 40U+(理想,非每日目标)"),
|
||||
no("不为「好像有保护」放大仓位"),
|
||||
warn("尽量少同向双开;双开按合计最坏约 20U"),
|
||||
],
|
||||
markers=["symbol-info"],
|
||||
),
|
||||
],
|
||||
markers=["priority-2", "other-businesscard"],
|
||||
label="资金",
|
||||
),
|
||||
t1(
|
||||
"③ 操盘思路",
|
||||
[
|
||||
t2(
|
||||
"行为准则 · 开单三检",
|
||||
[
|
||||
topic(
|
||||
"一句话防火墙",
|
||||
[
|
||||
leaf("信号够不够清晰?", markers=["symbol-question"]),
|
||||
leaf("流程有没有跑通?", markers=["symbol-question"]),
|
||||
leaf("情绪是不是在证明自己?", markers=["symbol-question"]),
|
||||
no("三检不过 → 不开"),
|
||||
],
|
||||
markers=["other-lock", "priority-1"],
|
||||
fill="#154360",
|
||||
color=C_TEXT,
|
||||
font_size="12pt",
|
||||
bold=True,
|
||||
labels=["防火墙"],
|
||||
),
|
||||
topic(
|
||||
"总循环",
|
||||
[
|
||||
leaf("信号判断 → 流程确认 → 情绪自检", markers=["arrow-right"]),
|
||||
leaf("全部通过 → 开仓", markers=["other-yes"]),
|
||||
leaf("等待系统结果(止盈/止损/到期)", markers=["other-clock"]),
|
||||
leaf("复盘整环 → 等待下一信号", markers=["arrow-refresh"]),
|
||||
no("任一步否决 → 空仓离开"),
|
||||
],
|
||||
markers=["arrow-right"],
|
||||
fill="#1A5276",
|
||||
color=C_TEXT,
|
||||
font_size="12pt",
|
||||
bold=True,
|
||||
),
|
||||
topic(
|
||||
"开单前三秒停顿",
|
||||
[
|
||||
leaf("核心信号是什么?", markers=["symbol-info"]),
|
||||
leaf("安全流程跑通了吗?", markers=["task-start"]),
|
||||
leaf("冷静执行,还是怕踏空/回本/证明自己?", markers=["symbol-info"]),
|
||||
],
|
||||
markers=["other-clock"],
|
||||
fill="#1A5276",
|
||||
color=C_TEXT,
|
||||
font_size="12pt",
|
||||
bold=True,
|
||||
),
|
||||
topic(
|
||||
"检1 · 信号判断",
|
||||
[
|
||||
ok("一句话说清唯一核心确认"),
|
||||
ok("点位/结构本身已够清楚"),
|
||||
no("说不清、靠宏观故事自圆"),
|
||||
no("「好像有戏」但确认模糊"),
|
||||
leaf("对照:1H→空间→结构→定损盈→工具", markers=["arrow-right"]),
|
||||
],
|
||||
markers=["priority-1", "symbol-info"],
|
||||
fill="#1A5276",
|
||||
color=C_TEXT,
|
||||
font_size="12pt",
|
||||
bold=True,
|
||||
labels=["Signal"],
|
||||
),
|
||||
topic(
|
||||
"检2 · 流程确认",
|
||||
[
|
||||
ok("资金与当日额度符合"),
|
||||
ok("单笔/组合敞口在预算内"),
|
||||
no("资金或次数已触限"),
|
||||
no("单笔或日最坏超限 → 暂停"),
|
||||
no("「先开了再说」跳步"),
|
||||
],
|
||||
markers=["priority-2", "task-start"],
|
||||
fill="#1A5276",
|
||||
color=C_TEXT,
|
||||
font_size="12pt",
|
||||
bold=True,
|
||||
labels=["Process"],
|
||||
),
|
||||
topic(
|
||||
"检3 · 情绪自检",
|
||||
[
|
||||
ok("符合系统 + 账户没问题 → 开"),
|
||||
ok("可接受空仓,旁观者视角"),
|
||||
no("怕踏空"),
|
||||
no("上回亏了要回本"),
|
||||
no("必须证明我是对的"),
|
||||
warn("红灯亮了,信号再好看也不开"),
|
||||
],
|
||||
markers=["priority-3", "smiley-smile"],
|
||||
fill="#1A5276",
|
||||
color=C_TEXT,
|
||||
font_size="12pt",
|
||||
bold=True,
|
||||
labels=["Emotion"],
|
||||
),
|
||||
topic(
|
||||
"复盘只记什么",
|
||||
[
|
||||
leaf("信号:是否做了?核心写了什么?", markers=["other-note"]),
|
||||
leaf("流程:资金/敞口是否过关?有无跳步?", markers=["other-note"]),
|
||||
leaf("情绪:当时是哪一类心态?", markers=["other-note"]),
|
||||
warn("结果不推翻「三检是否完成」评分"),
|
||||
],
|
||||
markers=["other-note"],
|
||||
fill="#1A5276",
|
||||
color=C_TEXT,
|
||||
font_size="12pt",
|
||||
bold=True,
|
||||
),
|
||||
],
|
||||
markers=["other-lock", "flag-purple"],
|
||||
),
|
||||
t2(
|
||||
"开仓逻辑",
|
||||
[
|
||||
topic(
|
||||
"主链条(强制)",
|
||||
[
|
||||
leaf("1H 方向:明显 N 字;跟 1H 波段", markers=["priority-1"]),
|
||||
leaf("空间:空看支撑、多看阻力;≥约 2%", markers=["priority-2"]),
|
||||
leaf("结构:15m/5m;量级约 8h+(约 48×15m)", markers=["priority-3"]),
|
||||
leaf("定损盈:外沿/针尖;RR 须接受", markers=["priority-4"]),
|
||||
leaf("选工具:期权 或 合约(不对冲)", markers=["priority-5"]),
|
||||
no("任一步不过 → 空仓等待"),
|
||||
],
|
||||
markers=["arrow-right", "symbol-info"],
|
||||
fill="#154360",
|
||||
color=C_TEXT,
|
||||
font_size="12pt",
|
||||
bold=True,
|
||||
labels=["主链"],
|
||||
),
|
||||
topic(
|
||||
"结构形态参考",
|
||||
[
|
||||
leaf("收敛", markers=["flag-blue"]),
|
||||
leaf("两段式回调", markers=["flag-dark-blue"]),
|
||||
leaf("箱体", markers=["flag-gray"]),
|
||||
leaf("假突破", markers=["flag-orange"]),
|
||||
],
|
||||
markers=["symbol-image"],
|
||||
fill="#1A5276",
|
||||
color=C_TEXT,
|
||||
font_size="12pt",
|
||||
bold=True,
|
||||
),
|
||||
topic(
|
||||
"期权入场",
|
||||
[
|
||||
ok("主链条全过;结构突破/假突破成立"),
|
||||
leaf("一天期方向单;空间够优先虚值", markers=["star-blue"]),
|
||||
leaf("默认先只开期权,不上合约", markers=["symbol-info"]),
|
||||
leaf("尽量 16:00 后开次日到期", markers=["other-clock"]),
|
||||
no("不做:期期对冲、偏置壳、为开而开"),
|
||||
],
|
||||
markers=["flag-blue", "symbol-plus"],
|
||||
fill="#1A5276",
|
||||
color=C_TEXT,
|
||||
font_size="12pt",
|
||||
bold=True,
|
||||
labels=["期权"],
|
||||
),
|
||||
topic(
|
||||
"合约入场(Gate)",
|
||||
[
|
||||
ok("主链条过关;位置极明确"),
|
||||
leaf("想清进场:假突破 / 结构突破", markers=["symbol-info"]),
|
||||
leaf("止损挂模型位(外沿/针尖)", markers=["symbol-info"]),
|
||||
warn("独立假突破:只做合约或空仓"),
|
||||
no("勿与「突破期权后再加仓」混仓"),
|
||||
],
|
||||
markers=["flag-dark-blue", "symbol-plus"],
|
||||
fill="#1A5276",
|
||||
color=C_TEXT,
|
||||
font_size="12pt",
|
||||
bold=True,
|
||||
labels=["合约"],
|
||||
),
|
||||
],
|
||||
markers=["symbol-plus", "arrow-up-right"],
|
||||
),
|
||||
t2(
|
||||
"平仓逻辑",
|
||||
[
|
||||
topic(
|
||||
"期权离场",
|
||||
[
|
||||
ok("只认:系统/规则止盈"),
|
||||
ok("只认:到期"),
|
||||
no("开仓后中间不手动平仓"),
|
||||
warn("紧急手平 → 标记非策略样本"),
|
||||
],
|
||||
markers=["flag-green", "symbol-minus"],
|
||||
fill="#145A32",
|
||||
color=C_TEXT,
|
||||
font_size="12pt",
|
||||
bold=True,
|
||||
labels=["期权"],
|
||||
),
|
||||
topic(
|
||||
"合约离场",
|
||||
[
|
||||
ok("结构止盈为准"),
|
||||
ok("结构止损为准(约 5U 量级)"),
|
||||
leaf("等待系统/挂单结果,不情绪手平", markers=["other-clock"]),
|
||||
],
|
||||
markers=["flag-dark-green", "symbol-minus"],
|
||||
fill="#145A32",
|
||||
color=C_TEXT,
|
||||
font_size="12pt",
|
||||
bold=True,
|
||||
labels=["合约"],
|
||||
),
|
||||
topic(
|
||||
"持仓期盯什么",
|
||||
[
|
||||
leaf("程序与纪律是否正常", markers=["task-done"]),
|
||||
no("不是浮盈浮亏数字本身"),
|
||||
leaf("无信号空档:空跑三检也是训练", markers=["other-lightbulb"]),
|
||||
],
|
||||
markers=["symbol-info"],
|
||||
fill="#1A5276",
|
||||
color=C_TEXT,
|
||||
font_size="12pt",
|
||||
bold=True,
|
||||
),
|
||||
],
|
||||
markers=["symbol-minus", "flag-green"],
|
||||
),
|
||||
],
|
||||
markers=["priority-3", "arrow-right"],
|
||||
label="操盘",
|
||||
),
|
||||
t1(
|
||||
"④ 纪律执行",
|
||||
[
|
||||
t2(
|
||||
"Gate 日纪律",
|
||||
[
|
||||
leaf("只做很明确的位置", markers=["symbol-info"]),
|
||||
leaf("同一位置最多两次机会(突破/假突破)", markers=["priority-2"]),
|
||||
no("两次都错 → 当日不再做单"),
|
||||
ok("离场以结构止盈/止损为准"),
|
||||
],
|
||||
markers=["flag-dark-blue", "task-done"],
|
||||
),
|
||||
t2(
|
||||
"期权日纪律",
|
||||
[
|
||||
no("不手平;等规则止盈或到期"),
|
||||
leaf("一次一仓;约 10U 权利金", markers=["symbol-info"]),
|
||||
no("不对冲;不做每天默认开期权"),
|
||||
leaf("损位跟模型:外沿/针尖", markers=["symbol-info"]),
|
||||
],
|
||||
markers=["flag-blue", "task-done"],
|
||||
),
|
||||
t2(
|
||||
"开仓前自检清单",
|
||||
[
|
||||
leaf("今日只动期权/合约?未开对冲?", markers=["task-start"]),
|
||||
leaf("1H 方向清楚(含 N 字)?", markers=["task-start"]),
|
||||
leaf("空间足够?结构量级够?", markers=["task-start"]),
|
||||
leaf("止损/止盈与 RR 定好?", markers=["task-start"]),
|
||||
leaf("工具选期权还是合约?理由写清?", markers=["task-start"]),
|
||||
leaf("合约:本位置第几次?今日两次用完?", markers=["task-start"]),
|
||||
],
|
||||
markers=["other-yes", "task-start"],
|
||||
),
|
||||
t2(
|
||||
"一句话版本",
|
||||
[
|
||||
leaf("1H→空间→结构→定损盈→期权/合约", markers=["arrow-right"]),
|
||||
leaf("不对冲;期权不手平", markers=["flag-gray"]),
|
||||
leaf("一位置两次,错完收工", markers=["priority-2"]),
|
||||
leaf("珍惜机会,日更不是目标", markers=["star-dark-blue"]),
|
||||
],
|
||||
markers=["star-dark-blue", "symbol-right"],
|
||||
),
|
||||
],
|
||||
markers=["priority-4", "task-done"],
|
||||
label="纪律",
|
||||
),
|
||||
],
|
||||
# 中心主题保持干净:不加图标/标签/备注,避免绿人、黄便签等杂乱标识
|
||||
markers=None,
|
||||
labels=None,
|
||||
fill=C_ROOT,
|
||||
color=C_TEXT,
|
||||
font_size="20pt",
|
||||
bold=True,
|
||||
line=C_ROOT,
|
||||
)
|
||||
root["structureClass"] = "org.xmind.ui.logic.right"
|
||||
|
||||
# XMind Zen 内置主题名;客户端可识别 business
|
||||
sheet = {
|
||||
"id": tid(),
|
||||
"class": "sheet",
|
||||
"title": "执行手册与行为准则 · 商务版",
|
||||
"rootTopic": root,
|
||||
"theme": {
|
||||
"id": tid(),
|
||||
"title": "business",
|
||||
"centralTopic": {
|
||||
"id": "centralTopic",
|
||||
"properties": {
|
||||
"svg:fill": C_ROOT,
|
||||
"fo:color": C_TEXT,
|
||||
"fo:font-family": "Microsoft YaHei",
|
||||
"fo:font-size": "20pt",
|
||||
"fo:font-weight": "bold",
|
||||
"shape-class": "org.xmind.topicShape.roundedRect",
|
||||
"line-color": C_L1,
|
||||
"line-width": "2pt",
|
||||
"line-class": "org.xmind.branchConnection.roundedelbow",
|
||||
},
|
||||
},
|
||||
"mainTopic": {
|
||||
"id": "mainTopic",
|
||||
"properties": {
|
||||
"svg:fill": C_L1,
|
||||
"fo:color": C_TEXT,
|
||||
"fo:font-family": "Microsoft YaHei",
|
||||
"fo:font-size": "15pt",
|
||||
"fo:font-weight": "bold",
|
||||
"shape-class": "org.xmind.topicShape.roundedRect",
|
||||
"line-color": C_L2,
|
||||
"line-width": "1.5pt",
|
||||
},
|
||||
},
|
||||
"subTopic": {
|
||||
"id": "subTopic",
|
||||
"properties": {
|
||||
"svg:fill": C_L2,
|
||||
"fo:color": C_TEXT,
|
||||
"fo:font-family": "Microsoft YaHei",
|
||||
"fo:font-size": "12pt",
|
||||
"shape-class": "org.xmind.topicShape.roundedRect",
|
||||
"line-color": "#85C1E9",
|
||||
},
|
||||
},
|
||||
"floatingTopic": {
|
||||
"id": "floatingTopic",
|
||||
"properties": {
|
||||
"svg:fill": C_MUTED,
|
||||
"fo:color": C_TEXT,
|
||||
"fo:font-family": "Microsoft YaHei",
|
||||
},
|
||||
},
|
||||
"importantTopic": {
|
||||
"id": "importantTopic",
|
||||
"properties": {
|
||||
"svg:fill": C_WARN,
|
||||
"fo:color": C_TEXT,
|
||||
},
|
||||
},
|
||||
"minorTopic": {
|
||||
"id": "minorTopic",
|
||||
"properties": {
|
||||
"svg:fill": "#EBF5FB",
|
||||
"fo:color": C_TEXT_DARK,
|
||||
},
|
||||
},
|
||||
"expiredTopic": {
|
||||
"id": "expiredTopic",
|
||||
"properties": {
|
||||
"svg:fill": "#D5D8DC",
|
||||
"fo:color": C_MUTED,
|
||||
},
|
||||
},
|
||||
"calloutTopic": {
|
||||
"id": "calloutTopic",
|
||||
"properties": {
|
||||
"svg:fill": "#FEF9E7",
|
||||
"fo:color": C_WARN,
|
||||
},
|
||||
},
|
||||
"summaryTopic": {
|
||||
"id": "summaryTopic",
|
||||
"properties": {
|
||||
"svg:fill": "#145A32",
|
||||
"fo:color": C_TEXT,
|
||||
},
|
||||
},
|
||||
"boundary": {
|
||||
"id": "boundary",
|
||||
"properties": {
|
||||
"svg:fill": "#D6EAF8",
|
||||
"fo:color": C_L1,
|
||||
"line-color": C_L2,
|
||||
},
|
||||
},
|
||||
"summary": {
|
||||
"id": "summary",
|
||||
"properties": {
|
||||
"line-color": C_L1,
|
||||
"line-width": "2pt",
|
||||
},
|
||||
},
|
||||
"relationship": {
|
||||
"id": "relationship",
|
||||
"properties": {
|
||||
"line-color": C_MUTED,
|
||||
"line-pattern": "dash",
|
||||
},
|
||||
},
|
||||
"map": {
|
||||
"id": "map",
|
||||
"properties": {
|
||||
"svg:fill": "#F4F6F7",
|
||||
"color-list": f"{C_L1} {C_L2} #2874A6 #1ABC9C #B9770E",
|
||||
"line-tapered": "none",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
return [sheet]
|
||||
|
||||
|
||||
def main() -> None:
|
||||
content = build_content()
|
||||
metadata = {
|
||||
"creator": {"name": "crypto_monitor", "version": "1.1"},
|
||||
"activeSheetId": content[0]["id"],
|
||||
}
|
||||
manifest = {
|
||||
"file-entries": {
|
||||
"content.json": {},
|
||||
"metadata.json": {},
|
||||
"manifest.json": {},
|
||||
}
|
||||
}
|
||||
OUT.parent.mkdir(parents=True, exist_ok=True)
|
||||
if OUT.exists():
|
||||
OUT.unlink()
|
||||
with zipfile.ZipFile(OUT, "w", compression=zipfile.ZIP_DEFLATED) as zf:
|
||||
zf.writestr("content.json", json.dumps(content, ensure_ascii=False, indent=2))
|
||||
zf.writestr("metadata.json", json.dumps(metadata, ensure_ascii=False, indent=2))
|
||||
zf.writestr("manifest.json", json.dumps(manifest, ensure_ascii=False, indent=2))
|
||||
print(f"wrote {OUT}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,16 @@
|
||||
"""按可用余额打满:min(余额, 单笔预算)."""
|
||||
from __future__ import annotations
|
||||
|
||||
from lib.options.options_pricing_lib import resolve_budget_full_usdc
|
||||
|
||||
|
||||
def test_balance_above_budget_uses_budget():
|
||||
assert resolve_budget_full_usdc(100.0, 10.0) == 10.0
|
||||
|
||||
|
||||
def test_balance_below_budget_uses_balance():
|
||||
assert resolve_budget_full_usdc(5.0, 10.0) == 5.0
|
||||
|
||||
|
||||
def test_balance_equals_budget():
|
||||
assert resolve_budget_full_usdc(10.0, 10.0) == 10.0
|
||||
Reference in New Issue
Block a user