You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -12,8 +12,8 @@ Quant system on LongPort OpenAPI and Google Cloud Run.
12
12
This repository uses `QuantPlatformKit` for LongPort token handling, context bootstrap, account snapshot access, market data, and order submission. Cloud Run deploys this repository directly.
13
13
The LongBridge runtime can execute all five live `us_equity` profiles from `UsEquityStrategies`; `LongBridgePlatform` keeps the LongPort runtime, token refresh, execution, and notification flow.
14
14
15
-
Full strategy documentation now lives in [`UsEquityStrategies`](https://github.com/QuantStrategyLab/UsEquityStrategies). The sections below focus on execution-side defaults and runtime behavior.
16
-
This runtime matrix is the authoritative enablement source for LongBridge. `UsEquityStrategies`only carries strategy-layer compatibility and metadata.
15
+
Full strategy documentation now lives in [`UsEquityStrategies`](https://github.com/QuantStrategyLab/UsEquityStrategies). The sections below focus on LongBridge runtime behavior, profile enablement, deployment, and credentials.
16
+
This runtime matrix is the authoritative enablement source for LongBridge. `UsEquityStrategies` carries strategy-layer logic, cadence, compatibility, and metadata.
17
17
18
18
### Execution boundary
19
19
@@ -43,84 +43,13 @@ Check the current matrix locally:
43
43
python3 scripts/print_strategy_profile_status.py
44
44
```
45
45
46
-
### Runtime cadence
46
+
### Strategy documentation boundary
47
47
48
-
Strategy cadence is owned by the strategy profile, but the actual broker run is
49
-
triggered by Cloud Scheduler. Keep the Cloud Scheduler job aligned with the
50
-
selected `STRATEGY_PROFILE` for each Cloud Run service:
|`global_etf_rotation`| quarterly rebalance + daily canary | weekdays near US close, e.g. `45 15 * * 1-5` in `America/New_York`| Non-rebalance days should only act on the canary emergency path. |
55
-
|`soxl_soxx_trend_income`| daily | weekdays near US close, e.g. `45 15 * * 1-5` in `America/New_York`| Trend/income value-mode profile. |
56
-
|`tqqq_growth_income`| daily | weekdays near US close, e.g. `45 15 * * 1-5` in `America/New_York`| Current SG line. |
57
-
|`russell_1000_multi_factor_defensive`| monthly | first few calendar days after month end, e.g. `45 15 1-7 * *` in `America/New_York`| Consumes monthly feature snapshots from `UsEquitySnapshotPipelines`. |
58
-
|`tech_communication_pullback_enhancement`| monthly | first few calendar days after month end, e.g. `45 15 1-7 * *` in `America/New_York`| Current HK line. LongBridge constrains this profile to the first trading day after the monthly snapshot to avoid month-internal rebalancing. |
59
-
60
-
The upstream snapshot/data workflows live in `UsEquitySnapshotPipelines` and run
61
-
monthly. Cloud Scheduler only invokes the broker runtime; it does not generate
62
-
new feature snapshots.
63
-
64
-
**Layers**
65
-
66
-
-**Trading:** SOXL / SOXX / BOXX
67
-
-**Income:** QQQI / SPYI
68
-
69
-
### Strategy
70
-
71
-
**Trading layer**
72
-
73
-
- SOXL 150-day MA for trend.
74
-
- SOXL > MA150 → hold SOXL; SOXL ≤ MA150 → hold SOXX.
75
-
- Rest of trading capital in BOXX.
76
-
77
-
**Income layer**
78
-
79
-
- Starts when total equity ≥ 150,000 USD.
80
-
- Target income allocation cap 15%.
81
-
- New income allocation: QQQI 70% / SPYI 30%.
82
-
- Income positions are buy-only (no automatic reduction).
83
-
84
-
**Execution**
85
-
86
-
- Only SOXL, SOXX, BOXX, QQQI, SPYI are used.
87
-
- Cash from account USD `available_cash`; no margin.
88
-
-`estimate_max_purchase_quantity` used before buys.
89
-
- Telegram alerts for submit, fill, reject, and errors.
48
+
Strategy logic, cadence, asset universes, parameters, and research/backtest notes live in `UsEquityStrategies`. This platform README keeps only LongBridge profile enablement, env vars, deployment wiring, broker execution behavior, and notification transport.
90
49
91
50
### Notifications
92
51
93
-
Telegram notifications include structured execution and heartbeat messages, with English and Chinese variants.
94
-
95
-
**Trade execution:**
96
-
```
97
-
🔔 【Trade Execution Report】
98
-
📊 Market: 🚀 RISK-ON (SOXL)
99
-
💼 Risk Position: 57.8%
100
-
💰 Income Target: 0.0%
101
-
🏦 Income Locked: 38.8%
102
-
🎯 Signal: SOXL above 150d MA, hold SOXL, risk 57.8%
🎯 Signal: SOXL above 150d MA, hold SOXL, risk 57.0%
121
-
━━━━━━━━━━━━━━━━━━
122
-
✅ No trades needed
123
-
```
52
+
Telegram notifications include structured execution and heartbeat messages, with English and Chinese variants. Strategy-specific signal/status fields come from the selected `UsEquityStrategies` profile; LongBridge-specific fields cover order submission, fill/reject/error reporting, account prefix, and region.
124
53
125
54
### Environment variables
126
55
@@ -211,17 +140,10 @@ Important:
211
140
2. Create secret `longport_token_hk` for HK / `longport_token_sg` for SG (or your custom `LONGPORT_SECRET_NAME`) in Secret Manager and add your LongPort access token as the first version.
212
141
3. Set the required env vars above on the Cloud Run service.
213
142
4. Deploy the app to Cloud Run (e.g. `gcloud run deploy` from repo root with Dockerfile or buildpack).
214
-
5. Create a Cloud Scheduler job that POSTs to the Cloud Run URL on a schedule. Use the [runtime cadence](#runtime-cadence) table: daily profiles usually use `45 15 * * 1-5`, while monthly snapshot profiles use a first-week monthly candidate window such as `45 15 1-7 * *`.
143
+
5. Create a Cloud Scheduler job that POSTs to the Cloud Run URL. Choose the cron from the strategy-layer cadence in `UsEquityStrategies`; this platform repo only owns the runtime trigger wiring.
215
144
216
145
IAM: the Cloud Run service account needs **Secret Manager Admin** (or Secret Accessor for the configured `LONGPORT_SECRET_NAME`, `LONGPORT_APP_KEY_SECRET_NAME`, and `LONGPORT_APP_SECRET_SECRET_NAME`, such as `longport_token_hk`, `longport-app-key-hk`, `longport-app-secret-hk`) and **Logs Writer**. Build/deploy typically uses a separate account with Artifact Registry Writer, Cloud Run Admin, Service Account User.
0 commit comments