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: docs/index.md
+8-1Lines changed: 8 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,7 +52,9 @@ With `ml4t-live`, you can:
52
52
- connect that strategy to Alpaca or Interactive Brokers
53
53
- replay or stream data through a live-style feed interface
54
54
- start in `shadow_mode=True` so orders are tracked but not routed
55
-
- add hard limits for order size, exposure, order rate, and drawdown before going live
55
+
- add hard limits for order size, exposure, stale data, daily loss, and drawdown before going live
56
+
- inspect persisted state and broker reachability with `ml4t-live status`
57
+
- run bounded shadow sessions from the CLI before promoting to paper or live
56
58
57
59
If you do not yet have a validated strategy, start in `ml4t-backtest`. If you do have one, this is the
58
60
next layer.
@@ -249,6 +251,11 @@ See [Brokers](user-guide/brokers.md) for connection details and usage patterns.
249
251
250
252
Use [Data Feeds](user-guide/feeds.md) for examples and feed-specific setup.
251
253
254
+
## Operator Surfaces
255
+
256
+
The library now includes a small CLI and a set of bounded operator-focused examples.
257
+
Use [CLI](user-guide/cli.md) for `status` and `shadow`, [Examples](user-guide/examples.md) for runnable scripts, and [Operator Guide](user-guide/operator-guide.md) for the recommended promotion workflow.
Copy file name to clipboardExpand all lines: docs/user-guide/brokers.md
+10-11Lines changed: 10 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,11 +7,10 @@
7
7
8
8
## Broker Model
9
9
10
-
The raw broker implementations are asynchronous. They implement `AsyncBrokerProtocol` and are meant
11
-
to be used by `LiveEngine` and `SafeBroker`.
10
+
The raw broker implementations are asynchronous and satisfy `AsyncBrokerProtocol`. In normal usage they sit behind `SafeBroker`, and strategies interact with a synchronous broker wrapper created by `LiveEngine`.
12
11
13
-
- Strategy code uses synchronous broker calls such as `broker.get_position(...)`
14
-
-Raw broker instances use async methods such as `await broker.get_cash_async()`
12
+
- Strategy code uses synchronous calls such as `broker.get_position(...)` and `broker.submit_order(...)`
13
+
-Infrastructure code uses async methods such as `await broker.get_cash_async()`
15
14
16
15
## Interactive Brokers
17
16
@@ -20,8 +19,9 @@ from ml4t.live import IBBroker
20
19
21
20
broker = IBBroker(
22
21
host="127.0.0.1",
23
-
port=7497, # paper
22
+
port=7497, # paper TWS
24
23
client_id=1,
24
+
account=None,
25
25
)
26
26
27
27
await broker.connect()
@@ -31,7 +31,8 @@ await broker.connect()
31
31
32
32
-`7497` is the usual TWS paper port
33
33
-`7496` is the usual TWS live port
34
-
- You must have TWS or IB Gateway running with API access enabled
34
+
-`4002` and `4001` are the usual paper/live IB Gateway ports
35
+
- TWS or IB Gateway must be running with API access enabled before you connect
35
36
36
37
## Alpaca
37
38
@@ -49,9 +50,8 @@ await broker.connect()
49
50
50
51
### Notes
51
52
52
-
-`paper=True` is the safe default
53
-
- The broker maintains positions and pending orders internally from Alpaca account state and trade
54
-
updates
53
+
-`paper=True` is the safe default and should stay on until you are ready for live deployment
54
+
- The broker tracks positions and pending orders from Alpaca account state plus trade-update callbacks
55
55
56
56
## Recommended Wrapper
57
57
@@ -98,8 +98,7 @@ await broker.disconnect()
98
98
99
99
## Error Handling
100
100
101
-
Broker connection and order failures surface as standard Python exceptions, typically
102
-
`RuntimeError`, broker SDK exceptions, or `RiskLimitError` when wrapped by `SafeBroker`.
101
+
Broker connection and order failures surface as standard Python exceptions, broker-SDK exceptions, or `RiskLimitError` when wrapped by `SafeBroker`.
0 commit comments