Skip to content

nithingadam/zerodhaAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kite Connect Trading Automation

Overview

Kite Connect Trading Automation is a sophisticated, JavaScript-based application designed to streamline stock trading operations by integrating with Zerodha's Kite Connect API. This project empowers users to automate buy and sell transactions seamlessly through a robust server infrastructure, leveraging the power of the Kite Connect API and a custom-built Master Control Program (MCP) server. With advanced tooling and intuitive prompt-based interactions, the system enables precise execution of trading strategies, such as purchasing stocks like MRF with a single command.

This project is actively evolving, with ongoing enhancements to expand functionality and optimize performance, making it a versatile tool for traders and developers alike.

 Features

- Zerodha Kite Connect Integration: Securely connects to Zerodha's Kite platform using API credentials from a dedicated Personal App.
- JavaScript Server: A high-performance server that orchestrates trading operations, ensuring reliable communication with the Kite Connect API.
- MCP Server: A specialized Master Control Program server providing intuitive buy and sell functionalities for streamlined trade execution.
- Prompt-Based Trading: Advanced integration with developer tools (e.g., Claude) to interpret user prompts, such as "buy a stock of MRF," and execute corresponding trades automatically.
- Scalable Architecture: Designed with modularity in mind, allowing for future enhancements and seamless integration of new features.
- Active Development: Continuous updates to introduce cutting-edge functionalities and improve system robustness.

 Prerequisites

To set up and run this project, ensure you have the following:

- Node.js: Version 14.x or higher for running the JavaScript server.
- Zerodha Kite Connect Account: A registered account with Zerodha and a Personal App created on the Kite Connect Developer Console.
- API Credentials: API key and secret from your Kite Connect Personal App.
- Developer Tools: Access to Claude or similar tools for prompt-based trading (optional for manual operations).
- Dependencies: Install required Node.js packages (listed in `package.json`).

 Setup Instructions

1. Create a Personal App on Kite Connect:
   - Log in to the [Kite Connect Developer Console](https://developers.kite.trade/).
   - Create a new Personal App and obtain the API key and secret.
   - Configure the app with appropriate redirect URLs and permissions.

2. Clone the Repository:
   ```bash
   git clone https://github.com/nithingadam/zerodhaAPI.git
   cd zerodhaAPI
  1. Install Dependencies:

    npm install
  2. Configure Environment Variables:

    • Create a .env file in the project root.
    • Add the following variables:
      KITE_API_KEY=your_api_key
      KITE_API_SECRET=your_api_secret
      KITE_ACCESS_TOKEN=your_access_token
    • Generate the access token programmatically or via the Kite Connect authentication flow.
  3. Run the JavaScript Server:

    node server.js
  4. Start the MCP Server:

    node mcp-server.js
  5. Optional: Integrate with Claude:

    • Update the developer tools in Claude to enable prompt-based trading.
    • Test the system by issuing commands like "buy a stock of MRF" to verify automatic trade execution.

Usage

  • Manual Trading:

    • Use the MCP server endpoints to trigger buy or sell orders programmatically.
    • Example API call to buy a stock:
      curl -X POST http://localhost:3000/buy -d '{"symbol": "MRF", "quantity": 1}'
  • Prompt-Based Trading:

    • Issue natural language commands through Claude (e.g., "buy a stock of MRF").
    • The system will detect the intent, invoke the appropriate tool, and execute the trade.
  • Monitoring:

    • Check server logs for real-time updates on trade executions and system status.

Project Structure

zerodhaAPI/
├── server.js             # Main JavaScript server for Kite Connect API integration
├── mcp-server.js         # MCP server for buy/sell functionalities
├── .env                  # Environment variables (API credentials)
├── package.json          # Node.js dependencies and scripts
├── README.md             # Project documentation
└── /src                  # Source code for additional modules

Future Enhancements

  • Advanced Trading Strategies: Implement complex algorithms for automated trading based on market trends.
  • Real-Time Analytics: Integrate dashboards for monitoring portfolio performance and trade history.
  • Multi-Broker Support: Extend compatibility to other brokerage APIs.
  • Enhanced Security: Introduce advanced encryption and authentication mechanisms.
  • UI Integration: Develop a web-based interface for manual trade management.

Contributing

Contributions are welcome! To contribute:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature/your-feature).
  3. Commit your changes (git commit -m "Add your feature").
  4. Push to the branch (git push origin feature/your-feature).
  5. Open a pull request with a detailed description of your changes.

Happy Trading! 🚀

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published