You can place a market exit order when you have reached your desired price(limit is not allowed here). You can check more about the exit_order method here.
Now, I know, it usually occurs when other methods are executed in on_tick callback
This can be the culprit. Avoid blocking the main ticker thread. You can go through this thread to know more.
@ravi7009
Downloading Option data with API lags
From which API are you downloading this option data? Historical data APIs, Quote APIs. For live streaming feeds you might consider using Websocket streaming.
lags 6 second behind and that effect CE a…
__version__ file has value 3.9.2
Version looks fine.
Do you have multiple Python versions installed in your system? Is above the version for the correct package, you are accessing here.
Make sure, you are using the correct package location. You ca…
tokens = [1270529, 3771393, 3001089]
def on_connect(ws, response):
# Callback on successful connect.
# Subscribe to a list of instrument_tokens (RELIANCE and ACC here).
global tokens
ws.subscribe(tokens)
ws.set_mode(ws.MODE_QUOTE,tokens)
The code l…
Out of approx 20 contracts, around 5 dont get the Last tick data after 16:00 hrs
Can you let us know the exact contract trading symbol? It becomes difficult to debug for the whole range.
@SITPL
kiteTicker.on_ticks = self.kiteTickerOnTicks
Don't see kiteTickerOnTicks method detail above.
Are you performing any computataion inside on_tick?
Make sure, you are not blocking the ticker thread. This thread should help.
@vaibhava
INFO:root:This is main thread. Will change webosocket mode every 5 seconds.
This doesn't help, as it's your's defined logging messages.
ERROR:kiteconnect.ticker:Retrying connection. Retry attempt count: 1. Next retry in around: 3 seconds
…
I just need to understand if I'm doing anything wrong
insert_tick=insert_ticks(ticks)
Looks like, you are performing computation inside on_tick thread, which blocks whole ticker.
This thread should help to understand more on above issue.
@devajit
Your code looks fine.
$user = $kite->generateSession($zerodha_request_token, $zerodha_secret)
If either request_token or secret value is wrong, the above call would throw exception. Are you getting any error/exception here?
ImportError: cannot import name 'urljoin'
Can you try updating six package? Use pip install --upgrade six
If still facing the issue, do let us know your kiteconnect version(pip show kiteconnect) and your python version(python --version)?
@devajit
[ $zerodha_request_token = isset($_GET['request_token']) ? $_GET['request_token'] : "";
Can you print captured request_token? And check if it's reading exact same request_token as in re-diect url.
Do you know how I can subscribe to Kite connect, and whether I can pay 2k and use it as a trial for one month and discontinue if it doesn't work for me?
Yes
@nirav
We don't have a total turnover specific field in tick/quote data. But, you can create this value at your end, by multiplying the LTP of the latest tick with volume.
You can check here the list of the available fields in Quote data.
Does the open-source package which you suggested pull in point in time snapshot of the OC?
It streams option chain data. If you are just looking for a snapshot, you can maybe just disconnect stream after reading the intial option chain data.
Can multiple instances of kite ticker be used one for processing ticks and one for exclusively listening to order status in separate threads so that we don't miss any order update?
Yes, you can use upto 3 WebSocket instances per API key.
No, we don't have an inbuilt option chain in Websocket streaming. You will have to build this at your end. This thread might help. If you are using a Python client, maybe you can try this open-source package.
Failed to send http/https request (enum code: 10)
Can you re-check if you have correctly included the kite cpp client folder in your project folder(from where you are making the request)?
You can go through cpp example here.
How to use unique tag for every order?
To add a tag field, while placing an order you need to send an extra param of tag inside kite.place_order.
kite.place_order(
variety=kite.VARIETY_REGULAR,
exchange=kite.EXCHANGE_NSE,
........,
tag='your_unique_…
@akshay07
I cant use cancel method or exit order method to square off the existing position
Yes, you can use cancel_order to just cancel the pending order.
In holdings, avg price is calculated based on FIFO. Whereas on the order book, it means the price on which order is executed. You can know more about FIFO here.
Assumed the max subscription limit per websocket = 200 tokens.
No, it's max 3000 subscriptions per Websocket connection and a single API key can have 3 Websocket connections.
@akshay07
I want to Book profits by exiting the position can I cancel the regular market order which is running
Market orders are executed in real-time, it doesn't remain pending. Do you mean limit pending order here?
You can go through this articl…
@nkodela
I am not placing any orders in the on_ticks function
No, you are calling the method that uses historical data APIs and places order(strategy_check) inside on_ticks thread only.
@sharwan
We don't help in coding your strategy, we can help y…
KiteConnect.TokenException: 'Token is invalid or has expired.'
Are you sure about using the correct API key, API secret, and request_token in the user flow? Maybe re-check API key and API secret from developer dashboard.
We haven't changed anything…
Was the order rejected with status code 400?
You will receive an order postback only for 200 status order placement. You can know more about this here.
@sachinstlko09
No, we don't have official APIs for the NSE option chain. If you are using a Python client, maybe you can look to this open option chain library, using Websocket Streaming APIs.
@AakashK
I want to know that redirect URL can i mention two times
No, it accepts only one field value. You will have to change the field value every time, as per your need i.e when testing locally, change redirect URL to localhost, when pushed to p…
@brijesin
But i'm not clearly getting the signal if the lastTradeno was buy or it was sell?
A trade happens, when there is buy and sell(one user sells and the other buys the same). So, here last trade number basically means, the number of shares/un…
@prajwal
maximum number of simultaneous kite sessions allowed per user with kite connect API
By default, you can use Kite connect APIs on a single user.
@VarunAgw
Is there an API that returns it historically or at least some of it?
No, you can't get historical pay-in or P&L data. You can only fetch current p&l using holdings/position API.
@chaklin
ws.subscribe(instrument_tokens)
While subscription of instrument token, default mode is set as Quote. You can check required assignment code here.
ws.set_mode(ws.MODE_FULL, instrument_tokens)
Then immediately, your requested mode is set. …
@AakashK
Looks like sendStockUpdates function call inside ticker, is blocking main ticker thread. You can go through this thread, to know more about this issue.
closeEvent code:1006 is because of block of ticker thread.
@SAPANKHUNTIA
The first two lines should not be there I think.
By, first two lines, do you mean debug log here:
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.kite.trade:443
DEBUG:urllib3.connectionpool:https://api.kite.trade:4…
GET /portfolio/positions HTTP/1.1" 200 None
From the above log, it looks like you are making a position API request. Maybe you can re-check your code, regarding this.
@AakashK
We ran nodejs Websocket at our end for more than 30 minutes, but we weren't able to reproduce above error. Maybe you can paste your Websocket code, so we can look at it.
@chaklin
You need to paste the WebSocket code, for us to debug this further. From the above stack trace, it looks like you are not calling unsubscribe method properly.
Do I need to call the __init__ function and put the variables as my requirement or there is any other way
__init__ is KiteTicker class initialization. So, you need to set reconnect=True during class initialization.
kws = KiteTicker("api_key","access…
apparently no broadcast is being sent at 17:30 hrs on March 3, 2021
Which contract, where you subscribed to? Only the MCX exchange stream is open at the above-mentioned time.
For the rest all the exchange contracts, you will receive only the last ti…
As the documentation states here, It expects two trigger values and executes the corresponding order in
the orders array when either of the trigger value is reached, the other order is lain dormant. So, if anyone trigger price is reached, the othe…
@zaheernanji
Kite Connect is provided for a single user only. If you are developing a platform for mass then you can speak to compliance on kiteconnect(at)zerodha.com for multi-user access.
I understand that Zerodha stopped Bracket Orders through the Kite web app, but will this be allowed using KITE API?
No, BO is not allowed through APIs as well, as well including web and app-based trading terminals.
As, an alternative you can try tw…
@Saurabh007
Are you using any of the client libraries mentioned here to fetch Quote data?
If yes, then it returns a dictionary value, you can just iterate over it to fetch any of the field values.
@saran88_tanvi
exception: Error parsing response (kitetrade-oms)
could you please tell me how to handle this?
You haven't pasted the error_type in above response, but most like it would be DataException. You can know more about handling exception i…
@vijoeyz
The previous day's close sync doesn't happen on the non-trading day(including weekends). So, you are seeing Thursday's close here. Friday close sync happens on the next trading day i.e Monday morning around 6:45 AM.
@pushpak1300
No, currently we don't have a sandbox environment. You will have to place a production order, maybe you can check and place less margin contracts to test in production.
@omtechnologies
Yes, pledged won't be shown in the trading terminal(kite), as pledged shares are not in your Demat so it won’t show up on the trading terminal.
You need to check them only in Console.
@Srikrishna_Rowthu
however is there any plan to get IV too? (Or) is there some way already to get IV while getting Historical Data?
No, currently we don't have IV data. Nor, it's in our recent list.
@rishiajmera
We're running it on AWS and I have tried with two different machines as well
We tried kiteconnect==3.9.2 version on same set-up as yours(AWS EC2 instance), and WebSocket streaming is absolutely working fine for us. So, we are unable to…
@vinaydyamaklar
If there is no thread block and no other internal error in your code, it should run fine.
Maybe paste your WebSocket streaming code, we will take a look at it.
@sureshgrover321
I would like high and low points for particular scrips from 10 AM to 11 AM
No, Quote APIs only have OHLC for today till that period, not for any specific interval.
Does the placeOrder() return an array or an object?
It returns an object, with order_id.
stdClass Object
(
[order_id] => XXXXXX
)
And is this the correct code to exit a cover order?
Yes, this looks fine.
@Rajneesh_12
if I want to buy at some price higher than ltp how should I modify the above code.
To buy above LTP, you can place a Buy SL order with the price at which you want to buy. You can go through this article, which explains in detail.
@D11458
You can use Websocket streaming to fetch live data of any instrument, and each WebSocket supports up to 3000 instruments. And each individual API key supports up to 3 WebSocket connections.
@Rajneesh_12
Can you paste the complete debug log here for the above request?
We are not able to generate the above inputException of Invalid `price` at our end.
Also, re-check if you are sending correct values for transaction_type, product and qua…
Is there anyway to find link between the original buy order and the gtt sell order?
Didn't get to on this? Are you trying to find a buy price for market order and sell market GTT order?
Both of these orders are independent of each other.
so now its giving second error at last line "kws.connect()" with error ReactorNotRestartable
You can go through this thread.
note that Error snap is kept at following link: https://drive.google.com/file/d/1HX5twm8wI39ynmZxV-PXqviv3P9YA3Q6/view?usp=s…
@pavanvora
I'm very sure that the data is missing from the API response
No, it's not missing rather these candles are not formed as there was no trade during the given period.