Skip to content

hemangjoshi37a/hjAlgos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

hjAlgos πŸš€

License GitHub stars GitHub forks

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.

hjAlgos Banner

πŸ“œ Table of Contents

πŸš€ Features

  • 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.

πŸ“ˆ Demo and Backtests

Demo Screenshot
Backtest Results

πŸ›  Installation

Prerequisites

  • Python 3.8+
  • Zerodha Account with API access
  • Appwrite Account
  • GPU (optional, for faster model inference)

Clone the Repository

git clone https://github.com/hemangjoshi37a/hjAlgos.git
cd hjAlgos

Create and Activate a Virtual Environment

python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

Install Dependencies

pip install -r requirements.txt

Setup Environment Variables

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.

Initialize Appwrite Collections

Ensure that the required collections (users, trades, predictions) are created in your Appwrite project.

Load Normalization Parameters

Ensure that mean.pkl and std.pkl files are present in the project directory. These files are used for normalizing input data.

Load the Pre-trained Model

Ensure that stock_predictor_model.pth is present in the project directory.

πŸ“‚ Project Structure

hjAlgos/
β”œβ”€β”€ app.py
β”œβ”€β”€ predictor.py
β”œβ”€β”€ templates/
β”‚   └── index.html
β”œβ”€β”€ static/
β”‚   └── images/
β”‚       └── totp_info.png
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ .env.example
β”œβ”€β”€ .gitignore
β”œβ”€β”€ README.md
└── LICENSE

πŸ’‘ Usage

Running the Predictor

The predictor.py script continuously fetches stock data, runs predictions using the ML model, and saves predictions to the Appwrite database.

python predictor.py

Running the Web Application

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

πŸ“ Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository

  2. Create your feature branch:

    git checkout -b feature/YourFeature
  3. Commit your changes:

    git commit -m 'Add some feature'
  4. Push to the branch:

    git push origin feature/YourFeature
  5. 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.

🧾 License

This project is licensed under the MIT License. See the LICENSE file for details.

πŸ“« How to Reach Me

Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β 

πŸ”— Other Projects

Explore more projects by the author:

🀝 Sponsorship

This project is sponsored by hjLabs.


About

AI based algorithmic trading platform for zerodha users

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published