Git Product home page Git Product logo

zerodha-master's Introduction

zerodha

Wrapper around kiteconnect

Installation

git clone https://github.com/swapniljariwala/zerodha.git
cd zerodha
python setup.py install

Usage

from kitewrapper import KiteFront
q_arr = [
    'question1',
    'question2',
    "question3",
    'question4',
    'question5',
    'question6',
    ]
#answer array
a_arr = [
    "ans1",
    "ans2",
    "ans3",
    "ans4",
    "ans5",
    "ans6"
    ]
auth={k:v for k,v in zip(q_arr,a_arr)}
auth['user_id'] = 'UDI'
auth['password'] = 'PASS1'
k = KiteFront(auth=auth)
k.connect()
h = k.holdings()

Only limited functionality from kiteconnect is supported

Supported methods-

  • holdings
  • margins
  • orders
  • positions
  • trades
  • order_place [not tested]
  • order_modify [not tested]
  • order_cancel [not tested]

old way Automation of zerodha for HFT (currently tested with Python2.7)

from broker.module import Zerodha, Order
#question array
q_arr = [
    'question1',
    'question2',
    "question3",
    'question4',
    'question5',
    'question6',
    ]
#answer array
a_arr = [
    "ans1",
    "ans2",
    "ans3",
    "ans4",
    "ans5",
    "ans6"
    ]
auth={k:v for k,v in zip(q_arr,a_arr)}
auth['user_id'] = 'UDI'
auth['password'] = 'PASS1'
auth['txn_password'] = 'PASS2'

"""
    MIS- margin intraday square-off, 
    CNC - cash (buy for delivery, sell existing shares)
"""
zerodha = Zerodha(auth, prefs = {'default_product' : 'MIS',})
if zerodha.connect():
  print('Logged in to Zerodha')
else:
  print('Check credentials')
#Will result in 0.0 after market
print('Current price of SBIN {}'.format(zerodha.get_current_price('SBIN')))
#CAUTION- This will actually place orders in your zerodha account
buy_id = zerodha.buy(security="SBIN-EQ",
                                quantity=1,
                                price=230)

sell_id = zerodha.sell(security="SBIN-EQ",
                                quantity = 1,
                                price = 230)

buy_order = zerodha.get_order_info(buy_id)
if buy_order.state == order.State.FILLED:
  print("Buy exectuted")

To Do:

  • Addition of Test casees
  • Support for F&O
  • Integration with data vendors
  • Integration with a broader library like Zipline to include simulation and several brokers
  • Support for Python 3

Please log issues if you find any.

zerodha-master's People

Contributors

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