Skip to content

docs: rewrite README for beta release - #1

Merged
stefan-jansen merged 1 commit into
mainfrom
docs/readme-rewrite
Mar 3, 2026
Merged

docs: rewrite README for beta release#1
stefan-jansen merged 1 commit into
mainfrom
docs/readme-rewrite

Conversation

@stefan-jansen

Copy link
Copy Markdown
Contributor

Summary

  • Rewrote README to match ml4t-backtest quality bar (175 → 288 lines)
  • Added AlpacaBroker integration section
  • Added Data feeds table (6 feeds: Alpaca, IB, Databento, CCXT, OKX, BarAggregator)
  • Expanded LiveRiskConfig with all 16 parameters documented
  • Added Safety system section (kill switch, VirtualPortfolio, atomic state persistence)
  • Added SafeBroker wrapper usage
  • Added Documentation links section (5 docs)
  • Updated quick start to use AlpacaBroker + SafeBroker
  • Fixed git clone URL (applied-aiml4t)

Test plan

  • Verify code examples use real API names (all grep-verified against source)
  • Check GitHub markdown rendering

Copilot AI review requested due to automatic review settings March 3, 2026 23:09
@stefan-jansen
stefan-jansen merged commit a81d4eb into main Mar 3, 2026
7 checks passed
@stefan-jansen
stefan-jansen deleted the docs/readme-rewrite branch March 3, 2026 23:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR rewrites README.md to align the project’s public docs with the beta release feature set (Alpaca integration, expanded feed options, and the safety/risk system), and updates the Quick Start and documentation links accordingly.

Changes:

  • Updates the Quick Start to use AlpacaBroker + SafeBroker and adds an Alpaca integration section.
  • Adds a data feeds table and expands documentation of LiveRiskConfig/safety concepts (kill switch, VirtualPortfolio, state persistence).
  • Adds links to the docs site pages and fixes the repository clone URL.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md
- Thread-safe bridging between sync strategies and async brokers
- The same Strategy class used in ml4t-backtest works unchanged in production
- Two broker integrations: Interactive Brokers (TWS/Gateway) and Alpaca (stocks + crypto)
- Six data feeds: Alpaca, IB, Databento, CCXT (100+ crypto exchanges), OKX

Copilot AI Mar 3, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intro bullet claims "Six data feeds" but only lists five (Alpaca, IB, Databento, CCXT, OKX). Either add the 6th item (e.g., BarAggregator) to the list or change the count to match the items listed.

Suggested change
- Six data feeds: Alpaca, IB, Databento, CCXT (100+ crypto exchanges), OKX
- Five data feeds: Alpaca, IB, Databento, CCXT (100+ crypto exchanges), OKX

Copilot uses AI. Check for mistakes.
Comment thread README.md
- Two broker integrations: Interactive Brokers (TWS/Gateway) and Alpaca (stocks + crypto)
- Six data feeds: Alpaca, IB, Databento, CCXT (100+ crypto exchanges), OKX
- Shadow mode for testing without placing real orders (VirtualPortfolio tracking)
- 16-parameter risk configuration: position limits, order limits, loss limits, price protection

Copilot AI Mar 3, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The README states this is a "16-parameter" risk configuration, but LiveRiskConfig currently has 17 fields (including blocked_assets and state_file). Please update the count (or clarify what is/isn't counted) to avoid drifting from the actual API.

Suggested change
- 16-parameter risk configuration: position limits, order limits, loss limits, price protection
- Multi-parameter risk configuration: position limits, order limits, loss limits, price protection

Copilot uses AI. Check for mistakes.
Comment thread README.md
Comment on lines +186 to +190
config = LiveRiskConfig(
kill_switch_enabled=True,
max_drawdown_pct=0.05,
state_file=".ml4t_risk_state.json", # Atomic JSON writes
)

Copilot AI Mar 3, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example sets kill_switch_enabled=True, but SafeBroker.submit_order_async() treats kill_switch_enabled as an active kill switch and will immediately reject all orders. To document crash-safe persistence for drawdown-triggered kills, the example should not pre-enable the kill switch (instead configure max_drawdown_pct/state_file, and mention SafeBroker.enable_kill_switch() for manual activation).

Suggested change
config = LiveRiskConfig(
kill_switch_enabled=True,
max_drawdown_pct=0.05,
state_file=".ml4t_risk_state.json", # Atomic JSON writes
)
# Configure crash-safe kill switch persistence
config = LiveRiskConfig(
max_drawdown_pct=0.05,
state_file=".ml4t_risk_state.json", # Atomic JSON writes
)
# Create a SafeBroker with this risk config
safe_broker = SafeBroker(broker, config)
# Optional: manually activate the kill switch (e.g., from an ops tool)
safe_broker.enable_kill_switch()

Copilot uses AI. Check for mistakes.
Comment thread README.md
# Live
from ml4t.live import LiveEngine
await LiveEngine(broker, MyStrategy(), risk_config).run()
await LiveEngine(MyStrategy(), safe_broker, live_feed).run()

Copilot AI Mar 3, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the live snippet, calling LiveEngine(...).run() without await engine.connect() will raise RuntimeError("Call connect() before run()"). Update this example to show the required connect/run/stop lifecycle (similar to the Quick Start section).

Suggested change
await LiveEngine(MyStrategy(), safe_broker, live_feed).run()
engine = LiveEngine(MyStrategy(), safe_broker, live_feed)
await engine.connect()
try:
await engine.run()
finally:
await engine.stop()

Copilot uses AI. Check for mistakes.
Comment thread README.md
- Always start with shadow_mode=True
- Always start with `shadow_mode=True`
- Set conservative position and order limits
- Enable `kill_switch_enabled=True` with a reasonable `max_drawdown_pct`

Copilot AI Mar 3, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Safety Notice suggests setting kill_switch_enabled=True, but that flag makes the kill switch immediately active and will block all new orders. Consider recommending leaving it False initially (and relying on max_drawdown_pct activation), or calling SafeBroker.enable_kill_switch() when you actually want to halt trading.

Suggested change
- Enable `kill_switch_enabled=True` with a reasonable `max_drawdown_pct`
- Configure a reasonable `max_drawdown_pct` for the kill switch, and only enable it (for example via `SafeBroker.enable_kill_switch()`) when you explicitly intend to halt trading

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants