It looks like you're new here. If you want to get involved, click one of these buttons!
75 kite = KiteConnect(api_key, api_secret)
76
77 # Fetch all orders
78 print("All kite holdings:\n")
79 print(kite.holdings())
80
I am getting the error:- Invalid `api_key` or `access_token`.
Thanks,
Ansuman
Thanks,
Ansuman
The request token is valid for only once and validity is only for a couple of seconds.
So once you get access token store it and re-use it in subsequent runs. Don't request for access token every time you run the script.
The access token is valid for one whole day.
It will be invalidated only if you log into other platforms like Pi or Nest. It is recommended to use Kite for monitoring purposes. If you log out of Kite then also you are logged out everywhere.
Thanks for your response.
To create a kite context, I am not using request token or access token, I am using api key and secret.
Creating kite context...
Done.
Looks like I am able to create the kite context. But I am not able to place an order, Order placement failed: Invalid session
Can you please point me to an working example?
Thanks,
Ansuman
The response that I am getting is
Will figure that out. But please correct the documentation. The payload is written wrong in documentation.
https://kite.trade/docs/connect/v1/?python#placing-orders
Response [200]
class 'requests.models.Response'
This code works:-