Code Monkey home page Code Monkey logo

python-algo-trading-zerodha's Introduction

Python-Algo-Trading-Zerodha

This repo contains sample templates for implementing strategies in python.

I have used Zerodha's kiteconnect api for developing sample strategies.

Zerodha kiteconnect

Here are some important links that you may need to go through to understand the login and other related stuff.

  1. KiteConnect API Doc
  2. KiteConnect Python Doc
  3. KiteConnect github page
  4. KiteConnect developer login
  5. KiteConnect developer forum

Install dependencies

pip install -r requirements.txt

Automate the login process

For first time run

  1. pip install selenium
  2. Download the correct webdriver from here and place the .exe file in the directory having access_token.py
  3. Create api_key.txt file with the following info -
    • API KEY - Obtained from the trading app in your developer account.
    • API SECRET - Obtained from the trading app in your developer account.
    • USER ID - Zerodha Kite user id.
    • PASSWORD - Zerodha Kite password.
    • PIN - Zerodha Kite pin.

python access_token.py

Strategy

Buy when PSAR crosses below candle and sell when PSAR crosses above candle. The code for the same is in strategy_PSAR.py and other utility functions are in utils.py

Daily Usage

It is recommended to change the global variables in strategy_PSAR.py as per the new startegy. Also run the strategy_PSAR.py a minute later than candle start( if working with larger duration candles like 15minutes or bigger). For ex. if you want to start at 9:15 AM run the code at 9:16 AM to avoid some signals being missed.

  1. run python access_token.py
  2. run strategy_PSAR.py

NOTE_1 - This is just a sample strategy to get started with kiteconnect and zerodha. It is always recommended to use one's own strategy for best results.

NOTE_2 - For coding technical indicators use pandas-ta and NOT TA-Lib. TA-Lib gave wrong PSAR values many times during PSAR reversals.

python-algo-trading-zerodha's People

Contributors

quicklearner171998 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.