Installation¶
Requirements¶
- Linux, macOS, or Windows
- Python 3.12, 3.13, or 3.14
- A supported broker or data source for live use
ml4t-backtestis installed automatically as a package dependency
Python 3.15 prereleases run blocking core installation and non-hardware-dependent tests on Linux, macOS, and Windows. Prerelease support is not advertised as stable before Python 3.15 is final.
Install From PyPI¶
Optional Add-Ons¶
ml4t-live installs the stable-supported broker/feed stack used by the package. The DataBento SDK is
available only through the bounded optional extra for deliberate experimental evaluation:
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,
)
Verify Installation¶
from ml4t.live import (
AlpacaBroker,
AlpacaDataFeed,
BarAggregator,
IBBroker,
LiveEngine,
LiveRiskConfig,
SafeBroker,
)
print("ml4t-live imports succeeded")
What To Do Next¶
After installation, the recommended first run is:
- Follow the Quickstart with
execution_mode="shadow". - Read Backtest to Live if you are porting an existing strategy.
- Configure the broker and feed pages that match your deployment path.
- Use the Book Guide to map chapter examples back to the library APIs.