项目作者: hemangjoshi37a

项目描述 :
Algorithmic trading NSE and BSE stocks using Zerodha's kite-connect API.
高级语言: Jupyter Notebook
项目地址: git://github.com/hemangjoshi37a/hjAlgos.git
创建时间: 2021-04-20T07:22:20Z
项目社区:https://github.com/hemangjoshi37a/hjAlgos

开源协议:

下载


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

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

Create and Activate a Virtual Environment

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

Install Dependencies

  1. pip install -r requirements.txt

Setup Environment Variables

Create a .env file in the root directory based on the provided .env.example.

  1. cp .env.example .env

Edit the .env file and fill in your credentials:

  1. # .env
  2. # Flask Secret Key
  3. SECRET_KEY=your_very_secure_secret_key
  4. # Appwrite Configuration
  5. APPWRITE_ENDPOINT=https://cloud.appwrite.io/v1
  6. APPWRITE_PROJECT_ID=your_project_id
  7. APPWRITE_API_KEY=your_api_key
  8. APPWRITE_DATABASE_ID=your_database_id
  9. # Zerodha Credentials
  10. ZERODHA_USER_ID=your_zerodha_user_id
  11. ZERODHA_PASSWORD=your_zerodha_password
  12. 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

  1. hjAlgos/
  2. ├── app.py
  3. ├── predictor.py
  4. ├── templates/
  5. └── index.html
  6. ├── static/
  7. └── images/
  8. └── totp_info.png
  9. ├── requirements.txt
  10. ├── .env.example
  11. ├── .gitignore
  12. ├── README.md
  13. └── 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.

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

  1. 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:

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

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

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