Thanks @themohammedfaisal for the detailed explanation. Yes I had 2 other orders - One for NIFTY and other for INDUSIND future. As you said, probably there was a fluctuation in the margin requirement and I was just short of few thousand rupees. I wi…
@rakeshr - I did not have any open orders for Bandhan at that point of time. The issue again happened again this morning. my position book was completely empty. The order went through after I added 1 more lakh to my account.
@sujith - I have attac…
Thanks. Already went through the same. But bhavcopy does not have the lot size information. At least the recent ones I downloaded does not have that information.
Interesting. Do you know the charges for a month for running in AWS EC2? Assume it is about running a EC2 instance from 9AM to 330PM IST for approximately 22 trading days. I am running currently on my laptop and would like to transfer this to AWS so…
Please use below to calculate stochastics %k and %d line that matches kite web interface. This is in python but you can convert to any other programming language. I will update the @arkochhar github indicators.py file via a pull request so everyone …
You can use below to pass a pandas dataframe and get back updated result.
def calculate_stochastics(df, period=14, smooth_k_period=3, d_period=3):
highest_high = df["high"].rolling(center=False, window=period).max()
lowest_low = df["low"].r…
@sujith - thanks for this. I was looking for piece of code on how to find out if an instrument is part of today's position. I figured it out myself. I still have a question.
How do I know whether the position is closed or still open? Is there a st…
hi Snehan, Not sure I understand fully. You can use historical API to query for 15minute candle and store them in pandas dataframe and then calculate the RSI using the function in the github page. This is what I am doing.
Thanks @sujith. In that case if you have minute candle for longer period (I don't know how long) then can you extend the 5 minute candle query interval for more than 100 days? Understand that historical api performance may slow down but at least it …
@Gafoor - Zerodha historical api does not provide expired option contracts data. You have to store it at your end. This is one of the reason I switched from option trading to futures as zerodha has the index and futures data for a longer period. It …
@rakeshr - however I have a request. If the historical api can provide 5 minute candle for a period of 6 months then it will be really great. Currently I am able to query only 15 minute candle if the period is more than 2 months. 15 minute candle wi…
Thanks @rakeshr. Completely aware that historical api may have timeouts and may not be as fast as websocket streaming but you know our limitations too. I have added exception handling so program does not support in between.I am monitoring historical…
@Snehan - I had the same question earlier too. Websockets give tick data and you have to construct the candle at your end. Not sure why the algo traders have to do all the coding themselves for the deficiencies in kiteConnect API. But this is what Z…
@kapilaggr - Threads in python share the same global variable of MainThread. You may check if there is a conflict which might cause your threads to use the values interchangeably. Instead you can think of subprocess module which will run as a separa…
Thanks @sujith. Appreciated.
I have just written to your data team to look at providing historical weekly option data at least for few months so it is useful for back testing option strategies. FYERS (tied up with Truedata) provides this and it is …
@sujith - If the data is not 100% accurate and you know about it then it is better to put that as a disclaimer in your main documentation page. Because we are paying 2000 rupees for historical data API. Not saying that it has to be 100% accurate but…
@addalaus - 60 days of data if you minute chart. 100 days if you use 5minute chart. I tried to download using 60minute interval for BANK NIFTY for last 6 months. It comes back with results however the same will not work if you use minute interval …
Refer to this library. It has few indicators that we use commonly.
https://github.com/arkochhar/Technical-Indicators/blob/master/indicator/indicators.py
Hi @kaushalmalkan,
You can refer to @arkochhar indicator library in github.
https://github.com/arkochhar/Technical-Indicators/tree/master/indicator
It does not match 100% but very close to the actual which is fine I think. I have been using it. My…
hi @pnsudesh - For your case, you can use bracket order instead of normal order. BO has has price, trigger price, stop loss points and target points. Also it can help to trail your stoploss. This will be just one order and everything is taken care b…
ok thanks @rakeshr. I will investigate on my end and let you know if it recurs.
To catch the read timeout exception is below good enough?
def get_ltp(kite, trading_exchange, contract_name):
while True:
try:
temp_list = [tra…
Ok. I get what you mean. I am not able to place bracket order from my algo script. Zerodha keeps blocking BO and CO and that is helpful for algo traders. At least they should limit the quantity rather than completely blocking it.
I just found that we can use this short form and don't necessarily need to use the class variables. We can close this thread. Thanks.
def place_order(kite, variety='amo', exchange='NFO', transaction_type='BUY', product='NRML', order_type='LIMIT', …
hi @zweyn - If you have sold an call option that is a sell order and you would have used kite.place_order with transaction type as SELL. If you want to exit that position then you need to buy the same contract with either MARKET or LIMIT price. Kind…
You can query historical data using kite.historical_data() api for this purpose. But you need separate kite subscription to do that. Let me know if you need further help.
If you pass the order id, you get a list in return. The list contains the different travel history of the ORDER like PUT ORDER RECEIVED, VALIDATION PENDING, OPEN, COMPLETE etc. You need to take the last record from the list which will be the current…
I have recently started working on ALGO trading. I am concentrating on coding Intraday option buying for BANK NIFTY/NIFTY. We can work together and come up with a strategy and also code together. If you are really keen, we can create a telegram grou…
@ccc - I think, if you are logging in from your mobile, you need to hit this URL - "https://kite.zerodha.com/connect/login?v=3&api_key=xxx" with your API key. After you login, you will be able to see request_token in the address bar. Don't think…
@Sanchay - I am doing similar thing in python. I get the 1 minute chart into a python pandas dataframe and calculate EMA, MACD, RSI, SMA realtime. The loop continues until my entry criteria is met. Except the last candle all other candles EMA will b…
Hi Guys, I also have similar requirement. @Imran - most of the day, zerodha blocksboth CO and BO.
I trade in options using API. I either place the SL sell order or TGT sell order. Only one of this. I have to monitor the LTP and update this order sa…
@rakeshr - Thanks for your response. The reason for using historical data api is - I need to calculate MACD (26,12,9) and RSI(14) for example so I need at least one month of data to get accurate figures. Isn't it ?
hi @sujith , you keep asking to refer to that thread which has very little useful info.
Can you please tell us what is the purpose of the refresh_token?
Are the request_token and refresh_token one and the same?
Can I get a new access token every…