Kite Connect sample Flask app server

Vivek
Here is a basic implementation of Kite Connect API's for Flask web framework.

Note that you need to install Pykiteconnect along with flask.
Tagged:
  • parikshitbhinde
    parikshitbhinde edited September 2017
    Hi Vivek,
    I am not aware of Flask or Python web-frameworks in general, but this program looks like it completely automates the process of getting the request token, setting the access token and getting the program set for streaming data and placing orders. And that is something a lot of people here are looking for in different threads and just don't realise that your program does that.

    Is it possible for you to append some more code explaining how to further stream data using your code and then implement some logic (could be silly - if price of stock moves up by 2 points then buy) and then execute a trade?

    That would just make it a whole lot valuable for many people.

    Also, could you mention if a web-server/web-service should be already running when executing this program or does that program accomplish that itself.

    Thanks a ton!
  • Vivek
    I will try to add other things to that example when I get time.
  • parikshitbhinde
    Thanks.
    Could you mention if a web-server/web-service should be already running when executing this program or does that program accomplish that itself?
  • Vivek
    Flask itself has a inbuilt server which is invoked when you run this script so you don't need to user one separately but if you are deploying Flask in production then I would recommend uWsgi.
  • veepsirtt
    Kite Connect Python Flask Example

    While running this kiteconnect_flask.py
    I am getting Starting server: http://127.0.0.1:5010 and is connected,
    after that how to get these values?.

    # Get the list of positions.
    print(kite.positions())

    # Fetch all orders
    kite.orders()

    # Get instruments
    kite.instruments()
Sign In or Register to comment.