Bot to automatically manage a stock portfolio
This project is compatible with python 3.11.4. If you are managing multiple python projects/versions locally, pairing pyenv with pyenv-virtualenv is one approach that works well for this
To install required packages and modules from this project to your local environment you can run
pip install . --upgrade pip
If you plan to make changes and test any of the modules you may want to add the -e
option.
pip install -e . --upgrade pip
This project uses the Alpaca Api to manage trades in the Alpaca brokerage. You will need to generate a set of keys to use with the alpaca api. Directoions in their docs. Your keys should be set as the following environment variables:
ALPACA_API_KEY="your_alpaca_api_key"
ALPACA_SECRET_KEY="your_alpaca_secret_key"
Alternatively, you can create a .env
and set the values in there.
The trade bot is capable of sending email push notifications about stocks it trades. This is handled via AWS SNS. You can create an SNS topic in the AWS Console, or via the automation provided in terraform. For the bot to access your SNS topic, you must provide a means of authentication in the credentials provider chain. The SNS topic arn should be set in the following environment variable:
AWS_SNS_TOPIC_ARN
The entrypoint for the trade bot is the main.py
file located in the trade_bot
module inside this repo. Visit the module README.md for startup instructions.
Tests can be run locally using make
:
make test
Additionally these tests will be run on pull requests and merges to main via github actions.