A simple python project to get you started on alpaca APIs.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
alpaca-trade-api-python is a python library for the Alpaca Commission Free Trading API. Note that this package supports only python version 3.7 and above.
Install the latest Python >= 3.7.
Install the pandas, numpy, scipy, websockets packages.
pip3 install pandas numpy scipy websockets
Install the alpaca-trade-api package.
pip3 install alpaca-trade-api
-
Get the API Key & Secret from Alpaca.
-
Set the
API_KEY
&API_SECRET
values intrade.py
&websocket.py
.
To run the trade service
python trade.py
To run the websocket service
python websocket.py
In the examples folder there's a few algorithms that connect to the paper-trading API.
- Long-short equity strategy
- Martingale strategy
In the websockets folder there's examples to do the following:
- Different subscriptions(channels) usage with alpaca/polygon streams
- Pause / resume connection
- Change subscriptions of existing connection
- ws disconnections handler (make sure we reconnect)
- Official client SDKs alpaca-trade-api-python / PyPI
- alpaca Broker API
- alpaca Trading API
- alpaca Market Data API
- README.md - Yet another README.md template!
Want to file a bug, contribute some code, or improve documentation? Excellent! Read up on our CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
We use SemVer for versioning. For the versions available, see the tags on this repository.
- Wai Mun - Initial work - waimunAlpaca
This project is licensed under the Apache License License - see the LICENSE file for details
- CONTRIBUTING.md - Contributing to Angular.
- Conventional Commits - A specification for adding human and machine readable meaning to commit messages.