This trading bot is designed to automate the process of buying oversold assets and selling overbought assets based on Yahoo Finance data. The bot also sends notifications about recent trades via Slack during specified hours. The project uses the Alpaca API for trading operations and the Yahoo Finance API to identify trading opportunities.
The project is organized into the following files:
src/trading_classes.py
: Contains the TradingOpportunities
and Alpaca
classes, which handle scraping trading opportunities and executing buy/sell orders, respectively.src/slack_app_notification.py
: Contains the slack_app_notification()
function, which formats and returns a string containing the trading activity details to be sent via Slack.main.py
: The main script that brings together the functionality from the src
folder, executing the trading bot's operations and sending Slack notifications.creds.cfg
: A configuration file that stores the Alpaca API and Slack API credentials. (Make sure to add your own API keys and tokens here).circleci/config.yml
: The CircleCI configuration file that defines jobs, steps, and workflows for automated testing, building, and deployment.The trading bot performs the following tasks:
TradingOpportunities
class.The trading bot is scheduled to run at different times of the day using CircleCI, as specified in the .circleci/config.yml
file.
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
creds.cfg
file.python main.py
To set up the CircleCI integration for automated testing and deployment, follow these steps:
.circleci/config.yml
file to your repository. CircleCI will automatically detect the file and start running the specified workflows.main()
function in main.py
based on your preferences (e.g., trading hours, number of stocks and cryptocurrencies to consider, etc.).Happy trading!