I am using python sdk provided by my discount broker to place buy/sell orders, I have created separate functions for each buy and sell which looks something like this –
def buy_order():
order = api.place_order(
buy_or_sell="B",
product_type="I",
exchange="NFO",
tradingsymbol=clicked_PE.get(),
quantity=clicked_Quantity.get(),
discloseqty=0,
price_type="MKT",
price=0,
trigger_price=None,
retention="DAY",
)
Here I am getting order in return which contains order ID based which I can display order details or exit position. Currently it takes anywhere from 400-600 milliseconds to complete this 1 api call. I am just curious to know is there any way to speed up this api call ?? mind you I simply can not use cache since I have to place unique buy/sell order every single time, it’s not like I am fetching a data from some data source which I can store it in a local cache for some period of time.