Python wrapper for kite API to test trading strategies in live market and also deploy them live. This framework makes it easier to communicate with Kite Connect API.
Kite Connect gives their users direct access to the Indian stock market and makes executing orders using python script in real time accessible. One of the main concern with the API is complex the login flow which we automate.
We make use of Selenium to fetch access token from kite.
- First you need to download webdriver for your browser for Selenium. Here is the link for chrome webdriver.
- Login process makes use of
config.properties
file to fetch the user details such asapi_key
andapi_secret
to access the API. You can generate your own config.properties file using theconfig.py
. Make sure you dont share theconfig.properties
file publicly as it contains accounts sensitive information. Give the path to the webdriver incofig.py
. - Now you can run
setup.py
which will fetch the access token and setup a kiteInstance which connects you to the API.
- To start backtesting you need to fetch historical data for your intrument. For this use
DataFetch.py
. - You need to provide your config.properties path, path where you will store data and the start date and end date for historical data.
- Run
DataFetch.py
along with the instrument number and you will get the csv's created with your data. - To start backtesting with this data you can put your strategy in
backTest.py
and start teting. - You can use methods in
positionManaget.py
to backtest.
- To connect with market and get live ticks for your intrument use
LiveTicks.py
.
There is a lot if work needed to be done on this framework, feel free to contribute or use as you wish