文件操作 - faqs.html
返回文件管理
返回主菜单
删除本文件
文件: E:\HostingSpaces\kimblycr\kiteconnect.xyz\wwwroot\faqs.html
编辑文件内容
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <meta name="author" content=""> <link rel="canonical" href="https://getbootstrap.com/docs/3.4/examples/jumbotron/"> <title>Zerodha Kite Connect API training</title> <link href="dist/css/bootstrap.min.css" rel="stylesheet"> <link href="assets/css/ie10-viewport-bug-workaround.css" rel="stylesheet"> <link href="jumbotron.css" rel="stylesheet"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/css/bootstrap.min.css" rel="stylesheet"> <link href="https://getbootstrap.com/docs/5.2/assets/css/docs.css" rel="stylesheet"> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/js/bootstrap.bundle.min.js"></script> <style type="text/css"> html body { font-size: 12px; } </style> </head> <body> <nav class="navbar navbar-expand-lg bg-light"> <div class="container-fluid"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <div class="collapse navbar-collapse" id="navbarNavAltMarkup"> <div class="navbar-nav"> <a class="nav-link active" aria-current="page" href="index.html">Home</a> <a class="nav-link" href="#">FAQ</a> <!-- <a class="nav-link" href="#">Getting Started</a> <a class="nav-link disabled">Consultancy Services</a> --> </div> </div> </div> </nav> <p align="center" > <h3>Frequently Asked Question</h3></p> <table class="table table-striped table-hover"> <thead> <tr> <th scope="col">Category</th> <th scope="col" colspan="3">Question</th> </tr> </thead> <tbody> <tr> <!-- General API Related --> <tr><td scope="col"> General API Related </td><td scope="col" colspan="3"> Can I use WebSocket on my local machine or do I have to purchase some web server, if yes can you guide me on this? </td> </tr><tr><td colspan="4"> You can use your local computer. </td></tr> <tr><td scope="col"> General API Related </td><td scope="col" colspan="3"> I tried using all 3 modes none of them are returning circuit limits for stocks. Is there a way to get lower_circuit_limit and upper_circuit_limit for the stocks? </td> </tr><tr><td colspan="4"> You can get it in Quote API. </td></tr> <td scope="col">General API Related</td> <td scope="col" colspan="3">When does the Closing Price get updated after the market closes? Is there any specific time?</td> </tr> <tr> <td colspan="4">Yes, it gets updated the next day BOD(Beginning of day) at around 8 AM.</td> </tr> <tr> <td scope="col">General API Related</td> <td scope="col" colspan="3">When Access Token Expires?</td> </tr> <tr> <td colspan="4">Access token flush does happen around 5:30 AM in normal circumstances. But, sometimes due to other process dependencies,it takes time to finish it completely, exceeding up till 7:30 AM a few times. So, in order to go away with such an error margin in many instances, we recommend the user to generate it post 7:30 AM.</td> </tr> <tr> <td scope="col">General API Related</td> <td scope="col" colspan="3">How Many requests can we send to API per second?</td> </tr> <tr> <td colspan="4">Current API Rate Limits: Quote API - 1r/s Order place API - 10r/s Historical API - 3r/s All other endpoints - 10r/s There is also a 200-order placement per minute limit by the API. There is also a cap on the number of times an order can be modified and it is 25. Post that user has to cancel the order and place it again. Apart from this, Zerodha RMS has an account level limit of 3000 MIS orders per day and a 2000 CO per day limit. </td> </tr> <tr> <tr><td scope="col"> General API Related </td><td scope="col" colspan="3"> How many orders can I place a day? </td> </tr><tr><td colspan="4"> There is a restriction of 5 orders per second. So, for equity, the total trading time is 6 hours 15 minutes(22500 seconds * 5(rate limit per second) =112500 orders max in a day for equity). </td></tr> <td scope="col">General API Related</td> <td scope="col" colspan="3">Is there a sandbox for testing the app?</td> </tr> <tr> <td colspan="4">https://nordible.com/zerodha-sandbox/</td> </tr> <tr> <td scope="col">General API Related</td> <td scope="col" colspan="3">Can I change the Zerodha client id associated with my app?</td> </tr> <tr> <td colspan="4">Yes, you can update Zerodha Client ID in the developer console https://developers.kite.trade/</td> </tr> <tr> <td scope="col">General API Related</td> <td scope="col" colspan="3">I want to associate my account with 2 client accounts, how can I do that?</td> </tr> <tr> <td colspan="4">Kite Connect is provided only for a single user. If you want to use it with another client id then you will have to create another Kite Connect app. </td> </tr> <tr><td scope="col"> General API Related </td><td scope="col" colspan="3"> Should I receive data, and error updates on the same WebSocket API that I opened for receiving stock updates, or else should I open another one? </td> </tr><tr><td colspan="4"> Order update will be posted on WebSocket connection as Postback. </td></tr> <tr><td scope="col"> General API Related </td><td scope="col" colspan="3"> Can I create multiple apps in Zerodha kite on the same user id and receive two different access tokens and keys? If so do my WebSocket connection and order limit per second will get doubled? </td> </tr><tr><td colspan="4"> Yes, all restrictions are made as per the API key, so creating another app will double the limits. You need to pay double the charge as well. </td></tr> <tr><td scope="col"> General API Related </td><td scope="col" colspan="3"> What are the API costs? </td> </tr><tr><td colspan="4"> Kite Connect App is a monthly subscription-based service. It will cost you Rs2000/ month and if you want to use historical data, it is an add-on subscription which is 2000/month. </td></tr> <tr><td scope="col"> General API Related </td><td scope="col" colspan="3"> What is the postback URL and redirect URL? </td> </tr><tr><td colspan="4"> The redirect URL is the page on your website where kite connect API is supposed to send the temp token after login. Postback URL is the page on your website where updated to your placed orders are supposed to be sent by kite server. </td></tr> <tr><td scope="col"> General API Related </td><td scope="col" colspan="3"> Is it possible to login into 2 different Zerodha accounts using python API? </td> </tr><tr><td colspan="4"> You need to use 2 different API keys/kite connect apps. </td></tr> <tr><td scope="col"> General API Related </td><td scope="col" colspan="3"> I noticed that holdings() has some time lag. It doesn't send the latest price during trading hours. It's unreliable since the data is not updated. Is it designed this way or it is a bug? </td> </tr><tr><td colspan="4"> Polling holdings API is not the correct way to check P&L. You need to fetch the latest LTP from Websocket API or Quote API and use that for calculating P&L. </td></tr> <tr><td scope="col"> General API Related </td><td scope="col" colspan="3"> Do we have minute data for NFO contracts as well? </td> </tr><tr><td colspan="4"> No. Don't have minute-level data for expired NFO instruments. We don't provide data for options instruments. </td></tr> <tr><td scope="col"> General API Related </td><td scope="col" colspan="3"> Any way to square off all positions instead of looping on orders and placing a square-off for each order? </td> </tr><tr><td colspan="4"> For regular(MIS, CNC, NRML) positions, you need to loop through positions to square off positions by placing an order of opposite transaction type for the same number of quantities at the market. For bo, co positions, you need to loop through the order book and find the pending orders with the parent order id and send an exit position request. For bracket order exit, the system will take care of canceling one of the orders and modifying another order to execute at the market. </td></tr> <tr><td scope="col"> General API Related </td><td scope="col" colspan="3"> When I place a Cover order and the time when it gets executed successfully, it places one more order for stop loss. How can I get the order id of that order and how to exit that order? </td> </tr><tr><td colspan="4"> If you place a cover order with entry type market then it will be filled immediately. If you place a limit type cover order then it gets filled according to the availability of the counterparty. In both cases, the stop-loss order is placed immediately when you place the first leg order. Once you place a cover order, for the successful placement you will get the order id in the response which is the parent order id for the second leg order. In order to fetch the second leg order, you need to fetch the order book and look order with the parent order id same as the first order id. </td></tr> <tr><td scope="col"> General API Related </td><td scope="col" colspan="3"> I want to convert only the product type of my position via API call and got the function which is convert_position(), we need to pass the following parameter in that. in the above parameter, we get an exchange, trading symbol, quantity, and product from the position book. where to get position_type, transaction_type to pass in the function for that position. </td> </tr><tr><td colspan="4"> Ans: The position type can be either day or overnight. Following are the steps, 1. Use the positions list from net array of positions response. 2. The formula for checking if it is day or overnight position_type, if you have only one type of Qty i.e either day or overnightQty, is as follows dayQty = qty - overnightQty if(dayQty > 0) position_type = 'day' else position_type = 'overnight' But, if you have both overnight and day qty as well, then it will be something like: 1> If you want to convert only overnight_quantity, then you will have to use position_type = overnight 2> If you want to convert only day qty, i.e qty-overnight try, then you will have to use position_type= day. The transaction type can be either BUY or SELL if (position_type == day && position.overnight_qty != 0) if(qty - overnight_qty > 0) transaction_type = 'BUY' else transaction_type = 'SELL' else if(qty > 0) transaction_type = 'BUY' else transaction_type = 'SELL </td></tr> <tr><td scope="col"> General API Related </td><td scope="col" colspan="3"> kite.exit_order(variety,order_id) is not working for cover orders </td> </tr><tr><td colspan="4"> You are using the wrong order_id here. When you place a CO order, you get 2 legs i.e order_id, 1st leg for limit/market, and the other for pending SL order. You have to use 2nd leg SL order_id here instead of executed limit/market order(1st leg order). You will find that order_id from the complete order book. </td></tr> <tr><td scope="col"> General API Related </td><td scope="col" colspan="3"> API for squaring off the trade/Exit position. </td> </tr><tr><td colspan="4"> For product types like CNC, NRML, MIS, you need to place market order with the same quantity and opposite transaction type in order to close the position. </td></tr> <tr><td scope="col"> General API Related </td><td scope="col" colspan="3"> How do we place Stop Loss and target if BO is not available temporarily, I see one of the forum links where you mention GTT. I have used GTT in manual orders, but could you please explain how we implement it in Python code? </td> </tr><tr><td colspan="4"> You can achieve this by Sell a two-leg gtt order. You have to set stop loss and target values as trigger price in two-leg GTT. Eg. Here for HDFCBANK for last_price = 1135.60 and if you want stop loss and target % = 2 % Stop loss = 1112.8 and target = 1158.3 "trigger_values":[1112.8, 1158.3] </td></tr> <tr><td scope="col"> General API Related </td><td scope="col" colspan="3"> While placing an order Bank Nifty option order of quantity 1250 using iceberg as a variety of order getting below error. '`iceberg_legs` should be between 2 and 10.' </td> </tr><tr><td colspan="4"> As, the error message states, you need to sent iceberg_legs value between 2 and 10. </td></tr> <tr><td scope="col"> General API Related </td><td scope="col" colspan="3"> I just need to know how I download Nifty 50 Stocks 1 min historical data in excel with one click as it is time-consuming to go one by one 50 symbols. </td> </tr><tr><td colspan="4"> You can check out HowUTrade. This is a third-party developers team who have built a wrapper around the Kite Connect APIs. </td></tr> <tr><td scope="col"> General API Related </td><td scope="col" colspan="3"> How to trail the Stop Loss? Is there any direct function? </td> </tr><tr><td colspan="4"> No, there is no out-of-the-box method for this. You will have to build this logic at your end. </td></tr> <tr><td scope="col"> General API Related </td><td scope="col" colspan="3"> Can someone please tell me what will be the exact string for the status of the IOC order which is partially canceled? </td> </tr><tr><td colspan="4"> It will be CANCELLED. </td></tr> <tr><td scope="col"> General API Related </td><td scope="col" colspan="3"> Can we place target and stop loss together for Options? </td> </tr><tr><td colspan="4"> Yes, you have to use two-leg GTT order. </td></tr> <tr><td scope="col"> General API Related </td><td scope="col" colspan="3"> how can I fetch Open Interest spurts data? </td> </tr><tr><td colspan="4"> You can fetch OI using quote APIs or WebSocket streaming. </td></tr> <tr><td scope="col"> General API Related </td><td scope="col" colspan="3"> How to get pending orders? </td> </tr><tr><td colspan="4"> No, you have to fetch the order book and then filter by checking the status of every order. If the status is not one of COMPLETE, CANCELLED, or REJECTED, that means it is a pending order. </td></tr> <tr><td scope="col"> General API Related </td><td scope="col" colspan="3"> Hi, I intend 2 run 2 completely separate python programs each generating its own session token, 1 for Nifty and another one for FINNIFTY. Is it possible to run both of these in parallel with a single API token but 2 different sessions? </td> </tr><tr><td colspan="4"> Only a single session is allowed per API key. You can use the same access_token/session to run multiple programs independent of each other. You need to just make sure to not cross the rate limits </td></tr> <tr><td scope="col"> General API Related </td><td scope="col" colspan="3"> When I use kite.positions() it sends a dictionary that contains two keys: net and day. each key has a value which is a list. Can you please tell me exactly the difference between these two key values? Do they contain only open positions or holdings too? </td> </tr><tr><td colspan="4"> The positions API returns two sets of positions, net and day. net is the actual, current net position portfolio, while the day is a snapshot of the buying and selling activity for that particular day. This is useful for computing intraday profits and losses for trading strategies. </td></tr> <tr><td scope="col"> General API Related </td><td scope="col" colspan="3"> At a given point in time, how do we know if there are any open positions through python? </td> </tr><tr><td colspan="4"> You can use the positions API. </td></tr> <tr><td scope="col"> General API Related </td><td scope="col" colspan="3"> How to get the live (and historical) option chain data using the kite connect? </td> </tr><tr><td colspan="4"> We don't have individual APIs to fetch the option chain for any contract. You can loop through all the required contract/strike, fetch its OI value and form the option chain at your end. You may check this link https://github.com/ranjanrak/OptionChainStream </td></tr> <!-- Web Sockets Related --> <tr><td scope="col"> Web sockets </td><td scope="col" colspan="3"> How many WebSocket connections can I open in a single API key? </td> </tr><tr><td colspan="4"> 3 connections </td></tr> <tr><td scope="col"> Web sockets </td><td scope="col" colspan="3"> What is the maximum number of instruments that can be subscribed pre Websocket connection? </td> </tr><tr><td colspan="4"> You can subscribe to up to 1000 instruments in a single WebSocket connection. A maximum of three WebSocket connections per api_key is allowed. So, three socket connections can fetch up to 3000 instruments. </td></tr> <tr><td scope="col"> Web Sockets </td><td scope="col" colspan="3"> Is it possible to change the instruments subscription list while Websocket is streaming? </td> </tr><tr><td colspan="4"> Websocket streams list/array of stocks instrument token feed. You can change this at any time, in your code logic. </td></tr> <tr><td scope="col"> Web Sockets </td><td scope="col" colspan="3"> If I opened multiple WebSocket connections (let's say 3) does it impact my order placement? </td> </tr><tr><td colspan="4"> No interference as the WebSocket endpoint is different w.r.t APIs endpoint. Check API rate limit on </td></tr> <tr><td scope="col"> Web Sockets </td><td scope="col" colspan="3"> How to close the WebSocket manually? </td> </tr><tr><td colspan="4"> You can use stop and close methods whenever you want to close the WebSocket. </td></tr> <tr><td scope="col"> Websockets </td><td scope="col" colspan="3"> How can I use Websockets In Which My Tokens are changing every minute? </td> </tr><tr><td colspan="4"> You can call subscribe and unsubscribe at any point in time. There is no special call for that. It is just the normal subscribe you use when you start the Kite Ticker connection. </td></tr> <tr><td scope="col"> Websockets Error </td><td scope="col" colspan="3"> WebSocket connection upgrade failed (429 - TooManyRequests) </td> </tr><tr><td colspan="4"> Yes, you shouldn't be having more than 3 WebSocket connections(3 KiteTicker objects). Why do you need multiple connections for multiple instruments? Just use one connection and subscribe to all the desired instruments at once. 3000 instruments can be subscribed over one WebSocket connection. </td></tr> <!-- Tick Frequency --> <tr><td scope="col"> Tick Frequency </td><td scope="col" colspan="3"> Whether I subscribe to 1 or 50 symbols, on average, I just receive only 1 tick per second, both in full and quote mode. Is this an expected behavior? My expectation was that we will receive anywhere around 2-5 ticks per second. </td> </tr><tr><td colspan="4"> You will get a maximum of 1 tick per second per instrument. As a broker, we only get level two data. To receive all ticks, you have to be on the exchange colocation. The infra + colo fees start at around Rs 18lk per annum minimum. If you are on the exchange colo, you can't use Kite connect APIs, you will have to use colo vendor TR (Reuters) API. 2. It is impossible to stream all ticks via the internet, potentially could be lakhs of ticks every second. 3. Kite servers are not on exchange colo, so not possible to collate all ticks and stream. 4. There are no data vendors in India also who give TBT data. Flow of Tick: Exchange publishes tick->Zerodha receives and publishes it->Kite Connect client receives. </td></tr> <tr><td scope="col"> Tick Frequency </td><td scope="col" colspan="3"> Why do the same technical charts for the same stock from NSE Tame, Google finance, Yahoo finance, and Amibroker, not match? </td> </tr><tr><td colspan="4"> Tick Data: Market data that shows price and volume at every print, it also includes information about every change to the best bid and asks. In a single trading day, there are millions of such ticks recorded (remember this also includes a change in best bid and ask prices) and it is technically not possible for any trading platform to show all ticks, especially live and on a normal broadband internet connection. If you really want to see all the ticks, NSE does have Tick by Tick data feed 145 which is a lot more expensive than the normal data feed, and will have to be subscribed to through any of the authorized NSE data vendors 103 (Not all of them give you tick by tick data). Also to be able to make the best use of this tick-by-tick data, you should ideally be on the NSE collocation which would mean that your systems are inside NSE itself so accepting all the millions of ticks will be quite efficient. Tick by Tick data is usually what professional High Frequency and Arbitrage trading firms use, don't think there is anything much a normal retail trader can do with it. Coming back to the question, all charting platforms are driven by data which is basically a 1-second snapshot data (unless you have spent a few lakhs to get that TBT data). So if I am looking at a 5 min chart, there could have been thousands of ticks in that 5 mins, but our charting platform would be able to recognize only a few hundred. And using those few hundred ticks, 1 Open, High, low, and the close point is chosen to plot the candle. So these few hundred points are recognized, and the 4 points (OHLC) could very easily be different from one platform to another. So none of the above charts are wrong, but the chances of any two charting platforms exactly matching each other, are very slim. But as you can see from the above charts, the difference is quite small, and the general trend of the market is captured by all the 3 charts. I am sure you can add charts from a few more platforms and they will all have some kind of variance. So if you are a trader, don't break a sweat on this. It is not possible to match two charts and find out which one is more correct. They are all most likely right. </td></tr> <tr><td scope="col"> Tick Frequency </td><td scope="col" colspan="3"> Are the 3 different modes(FULL, QUOTE, LTP) in WebSockets triggered at different frequencies? </td> </tr><tr><td colspan="4"> Ticks are sent based on changes in states. LTP mode only sends a tick when the LTP has changed. Values in the market depth can change often without the LTP changing. Similarly, when any of the values offered by any of the modes change, a tick is sent. Considering you have subscribed for a token in LTP mode, there may be a scenario wherein LTP didn't change for several seconds but market depth might have changed multiple times in that time interval. In this scenario, you will get all the ticks only if you have subscribed in FULL_MODE. For any given scrip, you will get a maximum of one tick per second. </td></tr> <tr><td scope="col"> Tick Frequency </td><td scope="col" colspan="3"> Not Getting Prices From Every Tick? </td> </tr><tr><td colspan="4"> In Websocket Streaming, new ticks for instruments are only received if there is a change in any of the WebSocket fields. Suppose, you have subscribed to 100 trading instruments and it can happen that tick change has taken place for just 50 instruments in any particular second, so you will receive ticks only for those 50 instruments. </td></tr> <!-- Postbacks --> <tr><td scope="col"> Postbacks </td><td scope="col" colspan="3"> Many times I had seen my order open in my database even when the order was complete. Further debugging revealed that the COMPLETE status is coming before UPDATE and hence status is getting reverted back to OPEN </td> </tr><tr><td colspan="4"> These post-back order updates are async calls. So, there can be instances of mismatch in sequence. You need to handle them at your end. </td></tr> <tr><td scope="col"> Postbacks </td><td scope="col" colspan="3"> When I post an order from the kite web, I don't receive any postback calls. The web order gets rejected as soon as I create it on the kite web, but don't receive any callbacks. </td> </tr><tr><td colspan="4"> You won't receive the first postback status of OPEN, COMPLETE, or REJECTED if the order is placed from the kite web interface. You receive the above status only if an order is placed from connecting APIs. For the subsequent status of UPDATE, CANCEL, if you update/cancel a pending order from either kite web or APIs, you will receive a postback status. So, you won't be getting order initiation postback status for orders placed on kite web, but only from APIs. If you are doing this for personal use then you may also try order updates via Websockets. </td></tr> <tr><td scope="col"> Postbacks </td><td scope="col" colspan="3"> Do postbacks work on the successful execution of GTT orders? </td> </tr><tr><td colspan="4"> You will receive order update status for order execution i.e when GTT order is executed to order, not for pending GTT orders. </td></tr> <tr><td scope="col"> Post Back/ Order History </td><td scope="col" colspan="3"> Is there a limit on checking order_history(). I have a script that checks the status of the order in a loop and acts if the status is changed. I am using order_history() function for that. Is it safe to continue using it in while True loop? </td> </tr><tr><td colspan="4"> The ideal solution is to use postback or Websocket order update as an event and pull the order book and check the status rather than polling order history in a loop. </td></tr> <!-- Pre Open --> <tr><td scope="col"> Pre Open </td><td scope="col" colspan="3"> Do actual trades happen during the pre-open session or only the equilibrium open price is determined from the orders placed during the pre-open session? </td> </tr><tr><td colspan="4"> Not until 9.07 to 9.08, till then equilibrium price will be arrived at using quotes. </td></tr> <tr><td scope="col"> Pre Open </td><td scope="col" colspan="3"> During the Pre-open session, what are the 'OHLC ' values that are broadcasted? Is it the days OHLC or yesterday? </td> </tr><tr><td colspan="4"> Open will be equilibrium, OHLC till 9.07 will be yesterday. After a single trade, OHLC will be the same and the close will be yesterday. </td></tr> <tr><td scope="col"> Pre Open </td><td scope="col" colspan="3"> Is the LTP value of the pre-open session updated every second? </td> </tr><tr><td colspan="4"> No, only once at 9.07 to 9.08. </td></tr> <!-- Instrument Master --> <tr><td scope="col"> Instrument Master </td><td scope="col" colspan="3"> Why there is a Change in the format of options instruments? </td> </tr><tr><td colspan="4"> NSE has introduced NIFTY weekly options with which all the weekly instruments' format has changed. Now the trading symbol BANKNIFTY14FEB1927500CE has become BANKNIFTY1921425000CE. The format is BANKNIFTY<YY><M><DD>strike<PE/CE> The month format is 1 for JAN, 2 for FEB, 3, 4, 5, 6, 7, 8, 9, O(capital o) for October, N for November, D for December. The monthly expiry naming convention won't change. Nifty MAY 15300 CE trading symbol will look like this NIFTY21MAY15300CE. You can take a look at the instrument's master for the correct trading symbol. There is no weekly expiry instrument if it is the last week of the month since the monthly expiry instrument is already there. </td></tr> <tr><td scope="col"> Instrument Master </td><td scope="col" colspan="3"> Data-Mismatch: InstrumentToken file: Not Able to find NIFTY22SEP14200CE </td> </tr><tr><td colspan="4"> The exchange allows X number of strikes to be active at one point in time. For Nifty, 30-1-30 strikes are allowed(OTM-ATM-ITM). More strikes are introduced as the contract moves in either direction to ensure 30 strikes are active at that end. In most cases, both PE and CE are active for a strike price but in this case, while 14200 PE is active, the CE strike is not active. You can refer to the kite instruments file to find the active strikes. </td></tr> <!-- Automatic Login --> <tr><td scope="col"> Automatic Login </td><td scope="col" colspan="3"> Unable to enter TOTP automatically via selenium? </td> </tr><tr><td colspan="4"> It is mandatory by the exchange that a user has to login manually at least once a day. We don't recommend automating login. </td></tr> <!-- Historical Data --> <tr><td scope="col"> Historical Data </td><td scope="col" colspan="3"> Does kite historical API provide real-time candles for options of the past minutes of the day? </td> </tr><tr><td colspan="4"> Yes, you can get all the latest data for every instrument from the historical data API. </td></tr> <tr><td scope="col"> Historical Data </td><td scope="col" colspan="3"> Do we not have the option of interval for week and month candles? </td> </tr><tr><td colspan="4"> No </td></tr> <tr><td scope="col"> Historical Data </td><td scope="col" colspan="3"> How can we get the weekly and monthly candles with this API call? </td> </tr><tr><td colspan="4"> You need to generate weekly or monthly candles at your end using day candle data. You can have the required logic/loop to accumulate 7 days or 30 days of data at your end and generate OHLC for weekly or monthly candles. </td></tr> <tr><td scope="col"> Historical Data </td><td scope="col" colspan="3"> If on today during live trading hours i.e between 9:15 and before 3:30, if I call the historical function with interval as "day". Will today's candle be included in that? If so why and what will be the values for the current day's candle? </td> </tr><tr><td colspan="4"> Yes, it will show today's candle as well, if today's date lies between to and from in the requested interval. OHLC value will be shown up till API request time. But, we strongly recommend not to use Historical data APIs for frequent polling during the live trading hours as it's not designed for that. Instead, you can form a candle at your end using streaming data from WebSocket. </td></tr> <tr><td scope="col"> Historical Data </td><td scope="col" colspan="3"> I am trying to get historical data for 100 days using the api call - kite.historical_data but I get this error: The server didn't respond in time. </td> </tr><tr><td colspan="4"> There are certain limitations for fetching historical data for the required interval as stated below(all in days): minute : 60 days 3minute : 100 days 5minute : 100 days 10minute : 100 days 15minute : 200 days 30minute : 200 days 60minute : 400 days day : 2000 days </td></tr> <tr><td scope="col"> Historical Data </td><td scope="col" colspan="3"> I am facing an issue with historical API when fetching brief periods: for example 09:15 AM to 09:20 AM. In this case, the candles do not show accurate data and it does not match with the candle data that is fetched for the full day. </td> </tr><tr><td colspan="4"> No, it won't match as there is a difference in the time period(to and from param) for the second 5-minute candle(09:20 - 09:25) in both requests. If you want complete 5-minute candle data of 09:20, you need to send to param as the last tick time(here 09:24:59) of that particular candle. Eg. For the first two 5 minute candle kite.historical_data(instrument_token='2863105', from_date='XXXX-XX-XX 09:15:00', to_date='XXXX-XX-XX 09:24:59', interval="5minute") </td></tr> <tr><td scope="col"> Historical Data </td><td scope="col" colspan="3"> I'm unable to fetch historic data. Error: 'kiteconnect.exceptions.InputException: invalid token' </td> </tr><tr><td colspan="4"> You are using the wrong instrument token used to fetch historical data for the respective contract. You can fetch the latest instrument data using the instrument list. </td></tr> <tr><td scope="col"> Historical Data </td><td scope="col" colspan="3"> Error: Insufficient permission for that call while retrieving Historical Information. </td> </tr><tr><td colspan="4"> You need a historical data subscription. </td></tr> <tr><td scope="col"> Historical Data </td><td scope="col" colspan="3"> I have faced the same Error after subscribing to the Historical API addon. </td> </tr><tr><td colspan="4"> You need to invalidate your access token. The current token doesn't have permission to access historical data. You can use 1 or 2 or 3 to invalidate the access token. 1. Call invalidateAccessToken function available in Kite connect API file and then call generateSession function. 2. You can revoke access to your app kite.trade temporarily by going to the link https://kite.zerodha.com/apps and then cancel revoke access. This would help you to invalidate the access token if you have not implemented a call to the invalidateAccessToken function 3. You can go to https://developers.kite.trade/ and regenerate the API secret. This would help you to invalidate the access token. </td></tr> <!-- Market Depth --> <tr><td scope="col"> Market Depth </td><td scope="col" colspan="3"> Currently, the market depth shows only 5 best bids and prices. To elaborate it gives bids and asks nearing the currently traded price. Is there any way I can get the bid and ask for a price that is not at all near the current trading price? </td> </tr><tr><td colspan="4"> 5 is the maximum depth available to broking clients in India. </td></tr> <!-- Errors --> <tr><td scope="col"> Error </td><td scope="col" colspan="3"> 504 Gateway Time-out </td> </tr><tr><td colspan="4"> We just checked on this, it might happen for few BSE scrip older minute data. You need to handle this Time-out at your end and make the request again. Something like: from kiteconnect import exceptions. try: # Fetch historical data except exceptions.DataException: # Handle Dataexception and make the request again with some delay/sleep </td></tr> <tr><td scope="col"> Error </td><td scope="col" colspan="3"> I am getting the following Error while fetching historical data in the loop, after a few iterations. 502 Bad Gateway </td> </tr><tr><td colspan="4"> This could be because the request could have timed out by the time data is fetched. You need to catch the exception and retry after a small delay. </td></tr> <tr><td scope="col"> Error </td><td scope="col" colspan="3"> I am using the below code to fetch the data. It says invalid token, from_ = "2018-01-03 12:00:00" to_ = "2018-01-05 12:00:00" df = kite.historical_data("SBIN", from_, to_, '30minute', True) </td> </tr><tr><td colspan="4"> You need to send the instrument token and not the trading symbol. </td></tr> <tr> <td scope="col">Error</td> <td scope="col" colspan="3">Error “The user is not enabled on the app".</td> </tr> <tr> <td colspan="4">You need to use the same client id mentioned on the developer page as Zerodha Client ID</td> </tr> <tr><td scope="col"> Errors </td><td scope="col" colspan="3"> Connection closed: 1006-connection was closed uncleanly(WebSocket connection upgrade failed (403)? </td> </tr><tr><td colspan="4"> You are entering the wrong access_token for authentication. You can go through this documentation, to understand the flow to generate a login session. </td></tr> <tr><td scope="col"> Error </td><td scope="col" colspan="3"> Why Order Failed in API but actually Triggered? </td> </tr><tr><td colspan="4"> It can happen when Kite trade doesn't receive a response from the OMS. In such cases, you need to catch the exception and check the order book before you retry placing the order. </td></tr> <tr><td scope="col"> Error </td><td scope="col" colspan="3"> kiteconnect.exceptions.InputException: Order cannot be modified as it is being processed. Try later. </td> </tr><tr><td colspan="4"> This is because you are trying to modify an order which is not open or trigger pending status. You are trying to modify an order which is already undergoing the process of modification. A 200 status code for order modification means the request for modification is placed successfully and not the modification itself. You can pull the order history and check the status before making the request. </td></tr> <tr><td scope="col"> Error </td><td scope="col" colspan="3"> Running kite ticker, when http connection is lost, I get a log error message: 2022-09-08 22:07:18,569 - kiteconnect.ticker - Thread-1 (run) - ERROR - Connection error: 1006 - connection was closed uncleanly (None) How can I catch this error and handle it? </td> </tr><tr><td colspan="4"> You don't need to handle this here, as the ticker auto reconnects by default. Just make sure not to have ws.stop() i.e force stop the ticker anywhere undesired. </td></tr> <tr><td scope="col"> Error </td><td scope="col" colspan="3"> While fetching LTP I am facing this exception('Connection to api.kite.trade timed out.(connect timeout=7)') </td> </tr><tr><td colspan="4"> For time being you can handle timeout exceptions in your code. from requests.exceptions import ReadTimeout except ReadTimeout: Pass </td></tr> <tr><td scope="col"> Error </td><td scope="col" colspan="3"> I am getting session expired on connection. </td> </tr><tr><td colspan="4"> An access token is valid for one whole day. Once you get an access token, you don't have to request it again unless you are logged out. A request token is valid for a couple of minutes and can be used only once. You should not request for access token for every run. Once you get an access token store it in a file or app preferences and re-use it. </td></tr> <tr><td scope="col"> Error </td><td scope="col" colspan="3"> I got this error today while placing the sell order for my OPEN buy order for closing the trade. “The instrument you are placing an order for has either expired or does not exist.” </td> </tr><tr><td colspan="4"> Were you trying to place an order post the auto-RMS square-off? </td></tr> <tr><td scope="col"> Error </td><td scope="col" colspan="3"> ERROR:kiteconnect.ticker:Connection error: 1006 </td> </tr><tr><td colspan="4"> Make sure to send instrument tokens as int(integer) format. </td></tr> <tr><td scope="col"> Error </td><td scope="col" colspan="3"> I am trying to import kite connect in AWS lambda function however facing the below error. can you help me? "errorMessage": "Unable to import module 'lambda_function': cannot import name 'x509' from 'cryptography.hazmat.bindings._rust' (unknown location)", "errorType": "Runtime.ImportModuleError", "stackTrace": </td> </tr><tr><td colspan="4"> Can try upgrading cryptography package in lambda </td></tr> <tr><td scope="col"> Error </td><td scope="col" colspan="3"> I got this error today while placing the sell order for my OPEN buy order for closing the trade. “The instrument you are placing an order for has either expired or does not exist.” </td> </tr><tr><td colspan="4"> Were you trying to place an order post the auto-RMS square-off? </td></tr> <tr><td scope="col"> Error </td><td scope="col" colspan="3"> ERROR:kiteconnect.ticker:Connection error: 1006 </td> </tr><tr><td colspan="4"> Make sure to send instrument tokens as int(integer) format. </td></tr> <tr><td scope="col"> Error </td><td scope="col" colspan="3"> I am trying to import kite connect in AWS lambda function however facing the below error. can you help me? "errorMessage": "Unable to import module 'lambda_function': cannot import name 'x509' from 'cryptography.hazmat.bindings._rust' (unknown location)", "errorType": "Runtime.ImportModuleError", "stackTrace": </td> </tr><tr><td colspan="4"> Can try upgrading cryptography package in lambda </td></tr> <tr><td scope="col"> Error </td><td scope="col" colspan="3"> TokenException: Token is invalid or has expired. </td> </tr><tr><td colspan="4"> A request token is valid only for a couple of minutes, after that it expires. Make sure to use the request token immediately after logging into your KiteConnect app. </td></tr> <tr><td scope="col"> Debugging </td><td scope="col" colspan="3"> How to disable DEBUG: messages in the console when the program is running? </td> </tr><tr><td colspan="4"> Ans: These are python debug logs. You can remove the required part logging.basicConfig(level=logging.DEBUG), to disable this. </td></tr> <!-- Data Integrity --> <tr><td scope="col"> Data Integrity </td><td scope="col" colspan="3"> When I call GetPositions it always gives me a value of 10 -15 seconds of old data. For example In Terminal PNL is 100 at (10:20) but through API getting 100 at (10:25) </td> </tr><tr><td colspan="4"> It is not recommended to poll positions for updated P&L. You need to calculate that at your end using this formula PNL = (sellValue - buyValue) + (netQuantity * lastPrice * multiplier); </td></tr> <tr><td scope="col"> Data Integrity Issues </td><td scope="col" colspan="3"> I am trying to download historic data for ZEEL from Zerodha. In Dec 2002, ZEEL is shown trading at ~95 Rs and in the subsequent month i.e. Jan 2003, the chart is showing ZEEL trading at ~ 30 Rs. </td> </tr><tr><td colspan="4"> There was corporate action of the name change from ZEETELE to ZEEL on 10-01-2007 and demerger in late 2006. </td></tr> <tr><td scope="col"> Data Integrity Issues </td><td scope="col" colspan="3"> The entire day of 2016-01-01 is missing for Reliance in the 1 min historical data. </td> </tr><tr><td colspan="4"> Yes, these are missing. Older historical data(prior to 2015, 2016) is populated after getting it from multiple data vendors, quite back. We had gotten data from multiple vendors and selected the best available one at that time. We can't repopulate/fix these missing minute data as of now. These missing candles are quite lesser and should convey price flow as desired. </td></tr> <tr><td scope="col"> Data Integrity </td><td scope="col" colspan="3"> historical_data throwing very strange candles. As you can see I'm getting candles after 15:30 and they also have volume! </td> </tr><tr><td colspan="4"> This is because post-market settlements happen till 04:00 PM. We remove that at EOD and keep data only till 3:30 PM for the minute candles. It is up to you, you can keep it or remove it. But sometimes exchange keeps broadcasting the same tick continuously as well after the market hours. </td></tr> <tr><td scope="col"> Data Integrity </td><td scope="col" colspan="3"> Incorrect data from kite.positions API </td> </tr><tr><td colspan="4"> You should be checking net positions if you are having overnight positions. You should always use net positions and check for non-zero Qty. The basic concept is day positions only show today's activity. It is a concept from NEST, a little complicated. To keep it simple we show only net positions on Kite mobile app but the Kite web shows both but the net positions take precedence. We would suggest you use net positions only. </td></tr> <tr><td scope="col"> Data Integrity </td><td scope="col" colspan="3"> Volume = 0 for every ticker in every tick. Why? </td> </tr><tr><td colspan="4"> The volume is actually the volume traded for the day. You would have fetched these quotes on a day when these contracts were not traded, hence 0 volume. Or maybe you are referring to the wrong column label. </td></tr> <!-- CDSL Authorization --> <tr><td scope="col"> CDSL Authorization </td><td scope="col" colspan="3"> Even while executing via Kite Publisher does it redirect the user to authorize to CDSL for a Sell order, if it is not done previously? Bcoz right now it is just showing an error, unlike how it re-directs while using the Kite main browser interface. </td> </tr><tr><td colspan="4"> No, it won't re-direct by default to the CDSL auth page. You need to add authHoldings function call while initiating such requests. It will be something like: kite.authHoldings(holding auth request_id, callback()(optional)); </td></tr> <!-- SSL --> <tr><td scope="col"> SSL </td><td scope="col" colspan="3"> SSL error “AttributeError: module 'lib' has no attribute 'SSL_CTX_set_ecdh_auto'” </td> </tr><tr><td colspan="4"> You need to upgrade the OpenSSL package. sudo pip install -U pyopenssl </td></tr> </tbody> </table> <footer> <p></p> </footer> </div> <script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ" crossorigin="anonymous"></script> <script>window.jQuery || document.write('<script src="../../assets/js/vendor/jquery.min.js"><\/script>')</script> <script src="dist/js/bootstrap.min.js"></script> <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> <script src="assets/js/ie10-viewport-bug-workaround.js"></script> </body> </html>
修改文件时间
将文件时间修改为当前时间的前一年
删除文件