order book API response vs purchase API
-
Using order book API how to identify all the order IDs related to the order ID placed using purchase API order ID. I am getting multiple partial oder IDs in the order book API related to a single purchase order place. How to I identify all related to one purchase order placed
-
HI @ronak Use orderbook() to fetch all orders.
-
@admin I am aware of that. Question is - How to identify all the orderIDs in orderbook() related to a purchase orderID. Because I am seeing multiple orderID in orderbook() for one purchase made by me. This may be due to partial execution of a buy/sell order creating multiple orderIDs in orderbook().
Please read carefully and provide a detail answer.
-
Hi @ronak post your response here for first purchase order id and partially executed order ids.
-
@admin
Response from the Purchase oder API while SELLING: {'status': True, 'message': 'SUCCESS', 'errorcode': '', 'data': {'script': 'PIONDIST', 'orderid': '210709000367264'}}Order book API ---
{'exchange': 'BSE', 'producttype': 'DELIVERY', 'tradingsymbol': 'PIONDIST', 'instrumenttype': '', 'symbolgroup': 'B', 'strikeprice': -1.0, 'optiontype': '', 'expirydate': '', 'marketlot': '1', 'precision': '2', 'multiplier': '-1', 'tradevalue': 131.0, 'transactiontype': 'SELL', 'fillprice': 131.0, 'fillsize': '1', 'orderid': '210709000367264', 'fillid': '20255800', 'filltime': '11:20:06'}, {'exchange': 'BSE', 'producttype': 'DELIVERY', 'tradingsymbol': 'PIONDIST', 'instrumenttype': '', 'symbolgroup': 'B', 'strikeprice': -1.0, 'optiontype': '', 'expirydate': '', 'marketlot': '1', 'precision': '2', 'multiplier': '-1', 'tradevalue': 262.1, 'transactiontype': 'SELL', 'fillprice': 131.05, 'fillsize': '2', 'orderid': '210709000367264', 'fillid': '20255300', 'filltime': '11:20:06'}, {'exchange': 'BSE', 'producttype': 'DELIVERY', 'tradingsymbol': 'PIONDIST', 'instrumenttype': '', 'symbolgroup': 'B', 'strikeprice': -1.0, 'optiontype': '', 'expirydate': '', 'marketlot': '1', 'precision': '2', 'multiplier': '-1', 'tradevalue': 262.0, 'transactiontype': 'SELL', 'fillprice': 131.0, 'fillsize': '2', 'orderid': '210709000367264', 'fillid': '20255600', 'filltime': '11:20:06'}, {'exchange': 'BSE', 'producttype': 'DELIVERY', 'tradingsymbol': 'PIONDIST', 'instrumenttype': '', 'symbolgroup': 'B', 'strikeprice': -1.0, 'optiontype': '', 'expirydate': '', 'marketlot': '1', 'precision': '2', 'multiplier': '-1', 'tradevalue': 1310.0, 'transactiontype': 'SELL', 'fillprice': 131.0, 'fillsize': '10', 'orderid': '210709000367264', 'fillid': '20255500', 'filltime': '11:20:06'},As you can see , why there are multiple record in the order book for same purchase? Also, for any purchase order ID, does the order ID remain same for all partial execution (as above)
-
@ronak said in order book API response vs purchase API:
210709000367264

-
HI @ronak From the response itself we can interpret that order id are same for all partial executions.
-
@admin - After placing a Delivery order at latest market price, how long (max) do we need to wait before the order gets executed completely?
I need to know when the order is fully or partially executed and there going to be no further partial execution using the trade book API. Please guide me the best way. Is there a order Time to LIVE ?
-
HI @ronak said in order book API response vs purchase API:
I need to know when the order is fully or partially executed and there going to be no further partial execution using the trade book API. Please guide me the best way. Is there a order Time to LIVE ?
This logic has to be implemented by the end user.
You can keep a track of total quantity you want to execute in a variable and try to compare the order id and the fill size till it get completely filled.
Note : Also You can find an optimize way to do this above is one of the logic that can be implemented to keep a check if the order is filled completely or partially. -
@admin I am placing order and then looking at trade book API to find the fillsize of all with same order ID. But I am not able to make a call if an order if completely executed or not in case of partial execution. I am currently waiting for 15sec before checking the trading book.
I am sure there will be a ttl (time to live) will when a purchase order can get executed as no one can wait for long for an order to finalize.
Also is there a way to set a timer within which order has to execute after placing
-
@admin - let me know an accurate method to identify if an order will further execute or not
-
Check the order book.. its much easier to monitor.
-
@rajanprabu - Will you care to explain please. How do you identify if an order will execute further or not in case of partial execution (assume trading with low volume stocks) @admin
-
I only trade in liquid counters.. otherwise automation is very difficult..
{ "status":true, "message":"SUCCESS", "errorcode":"", "data":[{ "variety":NORMAL, "ordertype":LIMIT, "producttype":INTRADAY, "duration":DAY, "price":"194.00", "triggerprice":"0", "quantity":"1", "disclosedquantity":"0", "squareoff":"0", "stoploss":"0", "trailingstoploss":"0", "tradingsymbol":"SBIN-EQ", "transactiontype":BUY, "exchange":NSE, "symboltoken":null, "instrumenttype":"", "strikeprice":"-1", "optiontype":"", "expirydate":"", "lotsize":"1", "cancelsize":"1", "averageprice":"0", "filledshares":"0", "unfilledshares":"1", "orderid":201020000000080, "text":"", "status":"cancelled", "orderstatus":"cancelled", "updatetime":"20-Oct-2020 13:10:59", "exchtime":"20-Oct-2020 13:10:59", "exchorderupdatetime":"20-Oct-2020 13:10:59", "fillid":"", "filltime":"", "parentorderid":"" }] }
This is the response one get from order book.. order id will match the one that you get during the order submission. You can check the
orderstatus
field orfilledshares
field.