Installation¶
Requirements¶
- Python 3.11+
- A supported broker or data source for live use
ml4t-backtestis installed automatically as a package dependency
Install From PyPI¶
Optional Add-Ons¶
ml4t-live installs the core broker/feed stack used by the package. DataBento is optional and must
be installed separately if you want DataBentoFeed:
Install From Source¶
Broker Setup¶
Interactive Brokers¶
- Install and launch TWS or IB Gateway
- Enable API access in the IB settings
- Use port
7497for paper trading or7496for live trading
Alpaca¶
- Create an Alpaca account
- Generate API credentials
- Start with
paper=True
from ml4t.live import AlpacaBroker
broker = AlpacaBroker(
api_key="YOUR_API_KEY",
secret_key="YOUR_SECRET_KEY",
paper=True,
)