Algorithmic trading NSE and BSE stocks using Zerodha's kite-connect API.
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.
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:
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:
This project is sponsored by hjLabs.