hjAlgos is the premier open-source algorithmic trading platform tailored for Zerodha and other leading trading platforms. Harness the power of advanced machine learning models to predict stock prices and execute trades in real-time. Seamlessly integrated with Zerodha for trading and Appwrite for backend services, hjAlgos offers a transparent and automated trading experience for both novice and seasoned traders.
- π Features
- π Demo and Backtests
- π Installation
- π Project Structure
- π‘ Usage
- π Contributing
- π§Ύ License
- π« How to Reach Me
- π Other Projects
- π€ Sponsorship
- Advanced Stock Prediction: Utilizes a Transformer-based neural network for highly accurate stock price predictions.
- Real-Time Trading: Automatically executes buy and sell orders based on the latest predictions.
- User-Friendly Interface: Intuitive web interface built with Flask and Bokeh for seamless visualization of predictions and trade history.
- Backtesting: Analyze historical performance of trading strategies with comprehensive backtest results.
- Secure and Scalable: Employs environment variables for secure configuration management and scalable backend services.
- Open Source Transparency: Full access to the codebase, fostering trust and community-driven enhancements.
- Automated Precision: Execute trades 24/7 with millisecond accuracy, eliminating human error.
- Data-Driven Decisions: Leverage advanced analytics to make informed trading choices.
- Seamless Integration: Easily connect with Zerodha API and other popular platforms.
- Continuous Improvement: Benefit from community-driven updates and enhancements.
- Risk Management: Implement advanced risk controls to protect your investments.
- Live Demo: https://hjalgos.hjlabs.in
- Backtest Results: https://hjalgos.hjlabs.in/backtest/
- Python 3.8+
- Zerodha Account with API access
- Appwrite Account
- GPU (optional, for faster model inference)
git clone https://github.com/hemangjoshi37a/hjAlgos.git
cd hjAlgos
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
Create a .env
file in the root directory based on the provided .env.example
.
cp .env.example .env
Edit the .env
file and fill in your credentials:
# .env
# Flask Secret Key
SECRET_KEY=your_very_secure_secret_key
# Appwrite Configuration
APPWRITE_ENDPOINT=https://cloud.appwrite.io/v1
APPWRITE_PROJECT_ID=your_project_id
APPWRITE_API_KEY=your_api_key
APPWRITE_DATABASE_ID=your_database_id
# Zerodha Credentials
ZERODHA_USER_ID=your_zerodha_user_id
ZERODHA_PASSWORD=your_zerodha_password
ZERODHA_TOTP_KEY=your_totp_key
β οΈ Security Tip:
Never commit your.env
file to version control systems like GitHub. To prevent accidental exposure, ensure.env
is listed in your.gitignore
file.
Ensure that the required collections (users
, trades
, predictions
) are created in your Appwrite project.
Ensure that mean.pkl
and std.pkl
files are present in the project directory. These files are used for normalizing input data.
Ensure that stock_predictor_model.pth
is present in the project directory.
hjAlgos/
βββ app.py
βββ predictor.py
βββ templates/
β βββ index.html
βββ static/
β βββ images/
β βββ totp_info.png
βββ requirements.txt
βββ .env.example
βββ .gitignore
βββ README.md
βββ LICENSE
The predictor.py
script continuously fetches stock data, runs predictions using the ML model, and saves predictions to the Appwrite database.
python predictor.py
The app.py
script runs the Flask web application, providing a user interface for managing trading sessions, viewing predictions, and monitoring trade history.
python app.py
Access the web app at http://localhost:5000
Contributions are welcome! Please follow these steps:
-
Fork the repository
-
Create your feature branch:
git checkout -b feature/YourFeature
-
Commit your changes:
git commit -m 'Add some feature'
-
Push to the branch:
git push origin feature/YourFeature
-
Open a Pull Request
Please ensure your code adheres to the project's coding standards and includes appropriate tests.
For detailed contribution guidelines, please refer to CONTRIBUTING.md.
This project is licensed under the MIT License. See the LICENSE file for details.
Explore more projects by the author:
- TrendMaster - Advanced trend analysis tool for traders.
- hjalgos_notebooks - Jupyter notebooks for hjAlgos strategies.
- Zerodha-Brokerage-Calculator - A calculator for Zerodha brokerage fees.
- TeleTest - Telegram bot for testing trading signals.
- Tradingview-Webhook-Manager - Manage TradingView webhooks effectively.
- Algotrading_Multi_account_Modern_UI - Modern UI for managing multiple algotrading accounts.
- pyPortMan - Python portfolio manager for tracking investments.
This project is sponsored by hjLabs.