We are fixing this issue in the upcoming update in the API. For now, to access it you can use the following API call:
curl "https://api.kite.trade/quote?i=NSE:INFY&i=NSE:ASHOKLEY" \
-H 'X-Kite-Version: 3' \
-H 'Authorization: token aaa…
It seems to be working on our end. Can you give an example snippet to reproduce this?
Also, if you are trying to serialize the data then it probably won't work because the size of the instruments object might be bigger than the framework's max limi…
Try removing that try-catch block and use the debugger to figure out where exactly this exception happens. Also 'close' doesn't seem to be a proper exception message, it must be some custom error message.
@MadanGoyal Yes. It is an issue with Windows 7. WebSocket library comes with .Net framework is not supported in Windows 7 because Microsoft has ended its support.
You have to use the complete trading symbol in the API. For Nifty50 it is "NIFTY 50". So the API call should be:
"https://api.kite.trade/instruments/NSE/NIFTY 50?api_key=xxx&access_token=yyy"
@vnaymatam Yes. You can create multiple apps with each using different IDs. When you use it with APIs you will have to use the corresponding API key, secret and user sessions for that app.
@RP3436 "tag" is an identifier you can give to uniquely identify a particular order or categorizing a set of orders etc. Check out the documentation here.
You can measure the time required to execute your code using methods described here. I would suggest you profile your code like that to figure out which part of your code takes more time to execute.
You can try this function to create checksum:
public String sha256(String str) {
byte[] a = DigestUtils.sha256(str);
StringBuilder sb = new StringBuilder(a.length * 2);
for(byte b: a)
sb.append(String.format("%02…
After calling the requestAccessToken function you will get complete user session info in the userModel variable. You will get the public token from userModel.publicToken variable.
You can find instrument token for any scrip from the instrument dump. For eg: Nifty50's instrument token is 265256.
UPDATE: Nifty50's instrument token is 256265.
You can actually integrate that python script into yours. Instead of writing it into a file you can call another function with that request data for further processing. The above gist can be reduced to:
from flask import Flask, request
app = Flask(_…
I believe you are using pandas. If you are collecting the instrument tokens from any panda data structure it will be of a different type. You will have to convert that to native python integers to subscribe to WebSocket.
PlaceOrder function signature goes like:
kite.PlaceOrder(Exchange, TradingSymbol, TransactionType, Quantity, Price, Product...)
Your order of parameters is wrong. Optionally to reduce mistakes you can specify parameters with their names like:
kite…
/instruments gives entire list of instruments
/instruments/:exchange gives list of instruments in the given exchange
You can check the documentation here.
We have checked at our end. We haven't received any response from the bank for this transaction. I would suggest contacting your bank support for further assistance on this.
Have you created a handler for OnError event? This will give the reason for closing the connection. Can you please post the error message you get from that event?
Can you post the error message you are getting back to PlaceOrder function? You can also provide Debug param as True while you create a new object of Kite. This will print more debug information to console.
Currently, not all these things are in the same source. Our current WebSocket subscription will provide most of these excluding Last Updated Time, Open Interest etc.. But our next version of WebSocket which is going to be released very shortly will …
Are you using any client library or directly calling the API?
Also in this case product should be either MIS or CNC for equity. For others, it will be either NRML or MIS.
For more info check the manual.
The request token is just to generate an access token. Request token expires immediately after that. And it cannot be reused. You must persist generated access token somewhere like in database and use that for subsequent requests.
The login process…
When you cancel a BO order you have to send the variety as "bo".
If you are using our API directly you can find the example in documentation directly below the one you posted:
# Exit / cancel a bracket order.
curl --request DELETE \
"https://a…
Redirect URL is for getting the request token after login. You can create a local web server and give its address as redirect URL.
For postbacks, you will need a public server or you can try this to setup a local server that can be linked to a publ…
After access token and request token becomes invalid the next request to Kite Connect will result in a 403 error with TokenException as error type. You can have a check to detect this. If you are using official client library then there will be a se…
@tahseen, thanks for your feedback. From your experience, we can observe that our documentation clearly need some improvements. We are currently working hard on it for our new version 3 APIs.
As an answer to your question, from the document,
Some …
@tahseen, it is mentioned in the orders section.
We have a couple of other modifications to the documentation as well. We are currently working on it and will be updated soon.
Also, you can use our official python client library pykiteconnect for …
@amit_aggrawal321,
I believe you are running Windows 7. Unfortunately, WebSocket feature that comes with .Net framework is not supported on Windows 7 and earlier. And there is no update or patch for this in Windows 7 since Microsoft stopped the sup…
1. Expiry of the public token is at the same time as the access token. When you get logged out both expire. And yes you can use the same public token to initialize two instances of the ticker client.
2. There is no issue with using multiple connect…
Hi @bobbydreamsforu,
You can use pandas data frames to store tick data for further processing. Here is a basic example to convert ticks to panda DataFrame:
from kiteconnect import WebSocket
import datetime
import pandas as pd
#columns in data fram…
The code is working at our end. The only issue we found was the console closing immediately I run it. For that, you have to put
Console.ReadKey();
at end of your main function which will wait the program until you press any key.
AccessToken is collected using RequestAccessToken function.
This value is then set to the global variable so that user can reuse it and don't have to do log in again.
Watch this webinar to know more about login flow.
Can you try initializing your kite instance like
Kite kite = new Kite(MyAPIKey, Debug: true);
And try calling historical API. Please post the logs for that.
As I mentioned earlier you have to give more information to debug the issue. We tried to reproduce the issue on our end and we couldn't find any.
Kindly try initializing your kite instance like this which will print more information to console on …
Hi @Som,
We are getting that error only if we send trading symbol instead of instrument token. When we send proper data we are getting data correctly every time. Can you try enabling the debug mode like:
Kite kite = new Kite(MyAPIKey, Debug: true)…
Hi @shortwire,
Right now we are rebuilding the documentation and client libraries. There are some breaking changes and some new features coming to the client libraries. It will be live shortly. Thank you for your patience.
Hi @shortwire,
New WebSocket API is not live yet. It is undergoing final phase of development and testing. We will update the docs and client libraries once it is completed.
Hi @YQ9152,
If you have a server to accept request token you can set it as your redirect URL. You can use the same server for postbacks which will give you order status updates.
Read more about:
Login flow
Postbacks
Postback example
Hi @Som,
Can you give me more details like the parameters you gave, the key which you are trying to access from the historical data etc. so that we can try to reproduce it on our end?
Hi @DA1077,
This code is running fine at our end without any issues. I would suggest you to double check whether other parts of your program is interfering with it.
Hi @Prem,
You can try this python implementation. Read the comment on top of the code to setup postbacks.
If you want to use Java you might need to set up a local tomcat server and create a JSP page to process post back information.
Hi @DA1077,
You can try splitting that string concatenation into different lines to narrow down the cause
I believe this is due to unavailability of bids and orders in that array. So when you subscribe to a token server immediately sends a quote t…
Hi @DA1077,
You don't have to do both AddHandler and Handles. Only one is required. Since you are doing both here it adds two event handlers to the tick event.
Either comment out these lines
AddHandler tickerPredefined.OnTick, AddressOf Ontick
Add…
Hi @DA1077,
Can you explain what is "Thread 0" in the log file?
Also, I would suggest you try a simple program with just ticker to see if this is an issue with the library. If the issue still persists even in that situation let us know.
Hi @DA1077,
OnTick event gives data for one instrument. So if the server sends data for 10 instruments in a packet OnTick will be called 10 times with corresponding instruments.
And as you inferred, it is different from python implementation where…
Hi @vicktr,
You are calling the API in a while loop and this is leading to rate limiting. There is a limit of 3 requests/second. You can put a delay in the loop to avoid this.
Hi @sunny,
setSessionHook accepts a callback function. You can try something like:
setSessionHook(() => {
console.log('session expired. login again')
})
Hi @sunny,
Which API client are you using?
If you are continuously requesting data for 10 instruments you might get rate limited. The limit is 3 requests/second.
Hi @Encrypted,
Did you renew or create a new app? If you are creating a new app credentials will be different. Also, I would suggest you check whether your app credentials match with details in the dashboard.
Hi @unawatuna,
You can have multiple login sessions. But you should be using Kite for monitoring purposes. If you log in to Pi or Nest your tokens will expire.
Hi @unawatuna,
If you are using AWS it is better to check with Amazon because we couldn't find any issue with our SSL connections. Also, I would suggest you try with an Ubuntu image instead of Linux AMI to check if that makes any difference.
Hi @unawatuna,
It seems there is some issue with SSL on your machine. Can you give us more information like:
Your Operating System
OS Version
OS Architecture
Are you able to open https://kite.trade in your browser?
Hi @unawatuna,
Can you try curl --compressed "https://api.kite.trade/orders?api_key=${API_KEY}&access_token=${ACCTOK}" --verbose and post the response here?