Live SPY Algorithmic Backed bots for Day Trading Stocks by utilizing ALPACA / IBrokers as the REST Agents.
Lumibots Trading Algorithm HFT
Introduction
This project is implementation of high-frequency trading (HFT) bots that use various strategies, user predefined, to identify and execute trades on various stock tickers. The bot reads historical minute data, executes the strategy, and places buy or sell orders based on programmed conditions.
Current Achievements
- Positive ROI for Buy/Hold : Our Buy_hold strategy is currently being tested with Warren' buffets portfolio and is making around 2,000 per day which marked the first positive P & L since inception
- Long/short executes 100,000 trades in a historic run : Our Long/short strategy recently did 100k + Trades in a single Day run and helped us validate its shell-life for volatile markets trade. We thank AWS powerful EC2 Servers as always
Features
- Some Strategy : Long Hold strategy: Runs the HFT and determines which stocks to short/hold throghout the day after user provides them
- Automated Trading: Automatically places buy and sell orders based on the strategy. Turns on at 0930 Hrs NY Time and Sleeps at 03:45 hrs NY Time.
- Email Alerts: Sends email notifications for trade executions.
- Order Logging: Logs all executed orders to a CSV / Graph file for record-keeping.
Updates and Project Goals
I am currently reprogramming all strategies within the [Backtesting Algorithms] folder to be real-time HFT algorithms with trading bot capabalities. The user can also backtest with them . This will allow for a more modular and flexible approach to trading strategies. Users can now choose to run any algorithm manually that is labelled 'strategy' if they prefer, without relying solely on the ROC strategy. This enhancement aims to provide greater flexibility and customization for different trading needs.
Installation
- Clone the repository:
git clone https://github.com/yourusername/trading-algorithm-bot.git
cd trading-algorithm-bot
- Create a virtual environment and activate it:
python3 -m venv venv
source venv/bin/activate
- Install the required dependencies:
bash
pip install -r requirements.txt
- Set up environment variables:
export EMAILADDRESS="youremail@example.com"
export EMAILPASSWORD="youremail_password"
export ALPACAAPIKEY = "yourapcaapikeyid"
export ALPACAAPISECRETKEY = "yourapcasecretkey"
Usage
- Prepare your tick data:
tick_data directory. Each file should follow the structure:
Datetime,Open,High,Low,Close,Adj Close,Volume
2024-09-05 10:32,54.209999084472656,54.209999084472656,54.18000030517578,54.209999084472656,54.209999084472656,0
- You can also run python run Alpacafetchmain.py and fetch data from alpaca real-time(requires subscription) but can be used for historical data
- Run the algorithm (You can tweak and add more strategies inside algorithms/defined Technical Indicators):
python main.py
Email Alerts
The bot sends email alerts for each trade execution. Ensure you have set the EMAILADDRESS and EMAILPASSWORD environment variables correctly.
Order Logging
All executed orders are logged in the Orders.csv file with details such as time, ticker, type, price, quantity, total, and account balance.
Contributing
Contributions are welcome! Please fork the repository and submit a pull request.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Contact
For any inquiries, please contact franklinemisango4@gmail.com.
Happy Trading!