Description
alpaca-backtrader-api is a Python library from Alpaca that connects the Alpaca trading API to the backtrader framework, so you can develop trading algorithms in backtrader and run them against Alpaca's REST and streaming interfaces. It requires Python 3.5 or later because of its dependency on alpaca-trade-api. You authenticate with an API key ID and secret key from the Alpaca web console, passed to the AlpacaStore constructor. A paper parameter switches between live trading, which is the default, and paper trading, and the samples let you toggle between backtesting and paper trading. The examples need a funded brokerage account or another way to access Polygon data. Because Alpaca allows one websocket connection per account, running several strategies or data feeds uses the Alpaca Proxy Agent configured through an environment variable.…
Highlights
- Alpaca trading API inside the backtrader framework
- REST and streaming interface support
- Paper or live trading switch, plus backtesting
- Sample strategies included
- Multiple strategies via the Alpaca Proxy Agent
Ratings & Reviews
No ratings yet
Be the first to rate Alpaca Backtrader API.
People also visit
Alpaca Backtrader API FAQ
What does alpaca-backtrader-api do?
It lets backtrader strategies use the Alpaca trade API, with REST and streaming support, for backtesting, paper trading and live trading.
What do I need to use it?
Python 3.5 or later and Alpaca API keys from the web console. The examples also need a funded brokerage account or another means of accessing Polygon data.
Is live trading the default?
Yes. The paper parameter defaults to False, which means live trading. Set it to True for paper trading.
Can I run several strategies at once?
Yes, but Alpaca allows one websocket connection per account, so you run the Alpaca Proxy Agent and set DATA_PROXY_WS to its address.
What are the best Alpaca Backtrader API alternatives?
Popular alternatives to Alpaca Backtrader API include Rqalpha, Moonshot and Stock Bot. See all Alpaca Backtrader API alternatives

