Beginner- Please help- Guide to start with Kite Connect

pavanv61
Thank you zerodha for initiating the developer forum to help newbies . And i thank all developers for helping each other.

I'm new to coding and interested to learn the automatic trading after watching the webinar. with python i can successfully initialize kite connect and place orders, modify orders etc..

But when i tried to execute the Moving average example used in webinar. I'm getting exception.

Snippet:
# Gets historical data from Kite Connect
def get_historical_data():
return kite.historical(instrument_token, from_date, to_date, interval)
kite.historical("738561", "2016-10-01", "2016-10-17", "1day")

.
.
.def start():
records = get_historical_data()
strategy(records)

start()


Exception:

Traceback (most recent call last):
File "C:\Users\pavan\Documents\Notepad++\MA.py", line 32, in
kite.historical("738561", "2016-10-01", "2016-10-17", "1day")
File "C:\Users\pavan\AppData\Local\Programs\Python\Python36-32\lib\site-packages\kiteconnect\__init__.py", line 415, in historical
"interval": interval})
File "C:\Users\pavan\AppData\Local\Programs\Python\Python36-32\lib\site-packages\kiteconnect\__init__.py", line 455, in _get
return self._request(route, "GET", params)
File "C:\Users\pavan\AppData\Local\Programs\Python\Python36-32\lib\site-packages\kiteconnect\__init__.py", line 542, in _request
raise(exp(data["message"], code=r.status_code))
kiteconnect.exceptions.TokenException: Invalid API credentials



Please help me to get the historical data using python with proper methods.
Sign In or Register to comment.