Giter Club home page Giter Club logo

kite-connect-python-example's Introduction

Kite connect python client example

This is a simple example which uses Python Kite connect client to receive ticks and save it to Postgresql database. Celery is used as a Task queue manager to insert to database without blocking main Kite connect WebSocket thread.

Kite ticker subscribes to tokens in specified in stream.py with 5 second delay. Ticks received are sent to celery taske queue where it will be inserted to db.

Requirements

  1. Redis or any AMQP client for Celery
  2. Postgresql db (Can be replaced with any other db)

Install

pip install celery
pip install psycopg2
pip install kiteconnect

Create database and table

Create a database called ticks

CREATE DATABASE ticks;

Create a table called ticks in ticks database

CREATE TABLE ticks (
    token integer NOT NULL,
    date timestamp without time zone,
    price double precision
);

Configure celery and database in db.py

  1. Update broker URL in db.py with redis or any other AMQP client.
  2. Update user, password and host details for Postgresql in db.py

# Run Celery worker

celery -A db worker --loglevel=info

Run Python client

python stream.py

kite-connect-python-example's People

Contributors

scottwedge avatar vividvilla avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

kite-connect-python-example's Issues

Why need 5 second delay before each subscription in stream.py?

can't we subscribe to allowed limit of 3000 instrument in one go without delaying this? my use case need real time data for almost all instrument but with this 5 second delay it just defeat the whole concept of realtime for me, because it will take much time to subscribe to all instrument when market opens.
Any suggestion?
Thanks.

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.