@Ashok121 Did you try the above the code on your console? 1. requests does not have :meth response 2. Headers cannot be send as url params 3. URL is still wrong Please check into pykiteconnect lib
What I mean to ask is, let's say I have 100 orders in my order book and I want to check the status of only a single order using order_id.
kite.orders() : this will give me the complete order book kite.orders()[0] : this will give me the 1st order kite.orders()[0]['status'] : this will give me the status of 1st order
But what if I don't know the number of my order but just my order_id. Do I need to search all the orders I have placed so far for the day or is there any way by which I can get the status of that specific order directly?
if you want to search by only order id try using this received=kite.orders() for individual_order in received: if int(individual_order['order_id'])==181020000008348: print(individual_order['status'])
Thankyou for your response. Do you think this will affect the time of execution for the code which handles the buy and sell operations? (considering that it will have to search for this order_id from more than 100 or 200 orders)
My algo keeps on disconnecting and reconnecting to the kiteconnect servers. I am using 5 if conditions which check the status of different orders using this functions: def get_status(oid): status = kite.order_history(order_id=oid)[(len(kite.order_history(order_id=oid)))-1]['status'] return status
Is it possible that because of sending so many requests to receive order history, I might be getting disconnected and reconnected every alternate second?
@rakeshr Thank you. I will take care of this. Just to be sure, the order history request falls under Quote API, right?
Also, is it possible to use multi threading with Kite Connect? As in, I would like to make a script in which one thread takes care of the order status' while the other does buy and sell operations. If yes, can you please point me to a guide/tutorial that can help me do so?
Hi @Parva, In simple words, Kite Connect is just a library which makes HTTP API calls. Once you have access token you can make an API call from any thread. There is no restriction at the library level. You can just spin off a new thread and make API call.
please correct above code.
1. requests does not have :meth response
2. Headers cannot be send as url params
3. URL is still wrong
Please check into pykiteconnect lib
I am not much expert in coding and reading/interpreting documentation.
Can you please give me single line python code for checking order status when order_id is known.
For example my order_id is 180408000002439.
It will be great help if you provide above. I am struggling solution for this issue for long time.
With above, I am getting following error: Response[403]
https://github.com/zerodhatech/pykiteconnect is the easiest way to interact with kiteconnect APIs on python. Please check into the installation section and documentation for the same.
With bare python requests,
Yeah, you need to pass order_id as param to retrieve complete order history.Check the documentation here.
What I mean to ask is, let's say I have 100 orders in my order book and I want to check the status of only a single order using order_id.
kite.orders() : this will give me the complete order book
kite.orders()[0] : this will give me the 1st order
kite.orders()[0]['status'] : this will give me the status of 1st order
But what if I don't know the number of my order but just my order_id. Do I need to search all the orders I have placed so far for the day or is there any way by which I can get the status of that specific order directly?
if you want to search by only order id
try using this
received=kite.orders()
for individual_order in received:
if int(individual_order['order_id'])==181020000008348:
print(individual_order['status'])
Thankyou for your response. Do you think this will affect the time of execution for the code which handles the buy and sell operations? (considering that it will have to search for this order_id from more than 100 or 200 orders)
Once the data has been received it doesn't take much time to parse
Use
kite.order_history(order_id='XXXXXX')
, to retrive order history of specific order using only order_Id.My algo keeps on disconnecting and reconnecting to the kiteconnect servers. I am using 5 if conditions which check the status of different orders using this functions:
def get_status(oid):
status = kite.order_history(order_id=oid)[(len(kite.order_history(order_id=oid)))-1]['status']
return status
Is it possible that because of sending so many requests to receive order history, I might be getting disconnected and reconnected every alternate second?
Make sure you are not exceeding below rate limits.
Also, is it possible to use multi threading with Kite Connect? As in, I would like to make a script in which one thread takes care of the order status' while the other does buy and sell operations. If yes, can you please point me to a guide/tutorial that can help me do so?
Thank you
In simple words, Kite Connect is just a library which makes HTTP API calls. Once you have access token you can make an API call from any thread. There is no restriction at the library level. You can just spin off a new thread and make API call.