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
Copy file name to clipboardExpand all lines: README.md
+26-1Lines changed: 26 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -71,7 +71,7 @@ commit credentials.
71
71
|`FIRSTRADE_ACCOUNT`| Optional | Required when multiple accounts are returned |
72
72
|`STRATEGY_PROFILE`| Yes for runtime | Shared US equity strategy profile |
73
73
|`FIRSTRADE_DRY_RUN_ONLY`| Optional | Defaults to `true` for platform runtime |
74
-
|`FIRSTRADE_REUSE_SESSION`| Optional |Reuse cached Firstrade session headers inside the same warm runtime instance before logging in again. Defaults to `false`|
74
+
|`FIRSTRADE_REUSE_SESSION`| Optional |Try cached Firstrade session headers before logging in again. Defaults to `false`|
75
75
|`FIRSTRADE_SESSION_CACHE_TTL_SECONDS`| Optional | Max age for local session header reuse when `FIRSTRADE_REUSE_SESSION=true`. Defaults to `21600`|
76
76
|`FIRSTRADE_PERSIST_SESSION_CACHE`| Optional | Persist Firstrade session headers to the configured GCS state bucket when `FIRSTRADE_REUSE_SESSION=true`. Defaults to `false`|
77
77
|`FIRSTRADE_GCS_STATE_BUCKET`| Optional | GCS bucket for runtime state JSON, including persisted session cache and account funds snapshots |
@@ -214,6 +214,31 @@ included in the snapshot.
214
214
With the default environment, `/run` previews orders only. It can submit live
215
215
orders only when every live-trading gate above is enabled.
216
216
217
+
## Runtime State And Schedulers
218
+
219
+
The deployed Firstrade runtime keeps trading disabled unless the explicit live
220
+
order gates are changed:
221
+
222
+
-`FIRSTRADE_DRY_RUN_ONLY=true`
223
+
-`FIRSTRADE_RUN_STRATEGY_ON_HTTP=false`
224
+
-`FIRSTRADE_ENABLE_LIVE_TRADING=false`
225
+
-`FIRSTRADE_LIVE_ORDER_ACK=false`
226
+
227
+
For session keepalive tests, create a private GCS bucket, grant the Cloud Run
228
+
runtime service account object read/write access, and set:
229
+
230
+
-`FIRSTRADE_REUSE_SESSION=true`
231
+
-`FIRSTRADE_PERSIST_SESSION_CACHE=true`
232
+
-`FIRSTRADE_PERSIST_ACCOUNT_SNAPSHOT=true`
233
+
-`FIRSTRADE_GCS_STATE_BUCKET=<bucket-name>`
234
+
-`FIRSTRADE_STATE_PREFIX=firstrade-platform`
235
+
-`FIRSTRADE_RUN_SESSION_CHECK_ON_HTTP=true`
236
+
237
+
The `/session-check` scheduler can safely run more often than the strategy
238
+
scheduler because it is read-only. A typical test schedule is every 30 minutes
239
+
during US regular market hours. The route logs `session_reused=true|false` and
240
+
writes the latest masked funds snapshot plus timestamped history to GCS.
241
+
217
242
## License And Upstream Compliance
218
243
219
244
This repository is MIT licensed. The upstream `firstrade` package is also MIT
0 commit comments