Skip to content

Commit 011366c

Browse files
committed
Inject service_name into defaultAccountOptions from config
1 parent 117ecec commit 011366c

3 files changed

Lines changed: 89 additions & 9 deletions

File tree

scripts/build_config.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,10 @@ def build_platform_meta_js(config: dict) -> str:
130130
lines.append(" const defaultAccountOptions = {")
131131
for pid, pdata in sorted(platforms.items()):
132132
acct = dict(pdata["default_account"])
133-
# Add deployment fields for capabilities
134133
dep = pdata.get("deployment", {})
135-
caps = pdata.get("capabilities", {})
134+
# Inject service_name into each account
135+
if dep.get("service_name") and "service_name" not in acct:
136+
acct["service_name"] = dep["service_name"]
136137
lines.append(f" {pid}: [{json.dumps(acct, ensure_ascii=False)}],")
137138
lines.append(" };")
138139
# Domain labels for i18n

web/strategy-switch-console/index.html

Lines changed: 85 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1505,12 +1505,12 @@ <h2 data-i18n="summary">切换摘要</h2>
15051505
const defaultRepositories = platformRepositories;
15061506

15071507
const defaultAccountOptions = {
1508-
binance: [{"key": "preview", "label": "Binance", "target_name": "crypto_combo", "supported_domains": ["crypto"], "default_strategy_profile": "crypto_equity_combo", "cash_currency": "USD", "default_execution_mode": "live"}],
1509-
firstrade: [{"key": "preview", "label": "Firstrade", "target_name": "preview", "supported_domains": ["us_equity"], "cash_currency": "USD", "default_execution_mode": "live"}],
1510-
ibkr: [{"key": "preview", "label": "IBKR", "target_name": "preview", "supported_domains": ["us_equity", "hk_equity"], "cash_currency": "USD", "default_execution_mode": "live"}],
1511-
longbridge: [{"key": "preview", "label": "LongBridge", "target_name": "preview", "supported_domains": ["us_equity", "hk_equity"], "cash_currency": "USD", "default_execution_mode": "live"}],
1512-
qmt: [{"key": "preview", "label": "QMT dry-run", "target_name": "industry_etf_dry_run", "cash_currency": "CNY", "default_strategy_profile": "cn_industry_etf_rotation", "supported_domains": ["cn_equity"]}],
1513-
schwab: [{"key": "preview", "label": "Schwab", "target_name": "preview", "supported_domains": ["us_equity"], "cash_currency": "USD", "default_execution_mode": "live"}],
1508+
binance: [{"key": "preview", "label": "Binance", "target_name": "crypto_combo", "supported_domains": ["crypto"], "default_strategy_profile": "crypto_equity_combo", "cash_currency": "USD", "default_execution_mode": "live", "service_name": "binance-quant-service"}],
1509+
firstrade: [{"key": "preview", "label": "Firstrade", "target_name": "preview", "supported_domains": ["us_equity"], "cash_currency": "USD", "default_execution_mode": "live", "service_name": "firstrade-quant-service"}],
1510+
ibkr: [{"key": "preview", "label": "IBKR", "target_name": "preview", "supported_domains": ["us_equity", "hk_equity"], "cash_currency": "USD", "default_execution_mode": "live", "service_name": "ibkr-quant-service"}],
1511+
longbridge: [{"key": "preview", "label": "LongBridge", "target_name": "preview", "supported_domains": ["us_equity", "hk_equity"], "cash_currency": "USD", "default_execution_mode": "live", "service_name": "longbridge-quant-service"}],
1512+
qmt: [{"key": "preview", "label": "QMT dry-run", "target_name": "industry_etf_dry_run", "cash_currency": "CNY", "default_strategy_profile": "cn_industry_etf_rotation", "supported_domains": ["cn_equity"], "service_name": "qmt-quant-service"}],
1513+
schwab: [{"key": "preview", "label": "Schwab", "target_name": "preview", "supported_domains": ["us_equity"], "cash_currency": "USD", "default_execution_mode": "live", "service_name": "schwab-quant-service"}],
15141514
};
15151515

15161516
const domainLabels = {
@@ -1592,6 +1592,85 @@ <h2 data-i18n="summary">切换摘要</h2>
15921592

15931593

15941594

1595+
const domainLabels = {
1596+
cn_equity: { zh: "A股", en: "CN A-share" },
1597+
crypto: { zh: "加密", en: "Crypto" },
1598+
hk_equity: { zh: "港股", en: "HK Equity" },
1599+
us_equity: { zh: "美股", en: "US Equity" },
1600+
};
1601+
1602+
const platformConfig = {
1603+
binance: {
1604+
dry_run_only: false,
1605+
margin_policy: false,
1606+
reserved_cash: false,
1607+
income_layer: false,
1608+
option_overlay: false,
1609+
dca: true,
1610+
execution_mode: "live",
1611+
service_name: "binance-quant-service",
1612+
default_execution_mode: "live"
1613+
},
1614+
firstrade: {
1615+
dry_run_only: false,
1616+
margin_policy: true,
1617+
reserved_cash: true,
1618+
income_layer: true,
1619+
option_overlay: true,
1620+
dca: true,
1621+
execution_mode: "live",
1622+
service_name: "firstrade-quant-service",
1623+
default_execution_mode: "live"
1624+
},
1625+
ibkr: {
1626+
dry_run_only: false,
1627+
margin_policy: true,
1628+
reserved_cash: true,
1629+
income_layer: true,
1630+
option_overlay: true,
1631+
dca: false,
1632+
execution_mode: "live",
1633+
service_name: "ibkr-quant-service",
1634+
default_execution_mode: "live"
1635+
},
1636+
longbridge: {
1637+
dry_run_only: false,
1638+
margin_policy: true,
1639+
reserved_cash: true,
1640+
income_layer: true,
1641+
option_overlay: true,
1642+
dca: false,
1643+
execution_mode: "live",
1644+
service_name: "longbridge-quant-service",
1645+
default_execution_mode: "live"
1646+
},
1647+
qmt: {
1648+
dry_run_only: true,
1649+
margin_policy: false,
1650+
reserved_cash: false,
1651+
income_layer: false,
1652+
option_overlay: false,
1653+
dca: false,
1654+
execution_mode: "paper",
1655+
service_name: "qmt-quant-service",
1656+
default_execution_mode: "paper"
1657+
},
1658+
schwab: {
1659+
dry_run_only: false,
1660+
margin_policy: true,
1661+
reserved_cash: true,
1662+
income_layer: true,
1663+
option_overlay: true,
1664+
dca: false,
1665+
execution_mode: "live",
1666+
service_name: "schwab-quant-service",
1667+
default_execution_mode: "live"
1668+
},
1669+
};
1670+
1671+
1672+
1673+
15951674

15961675

15971676

web/strategy-switch-console/page_asset.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)