Closed sanind closed 3 months ago
From Orderbook & Positions api call it can be done....In python its simple, Do u need a demo ?
def exit_all_positions():
position_dict = api.get_positions() or []
for position in position_dict:
api.place_order(
buy_or_sell="S" if int(position["netqty"]) > 0 else "B",
product_type=position["prarr"],
exchange=position["exch"],
tradingsymbol=position["tsym"],
quantity=position["netqty"],
discloseqty=position["netqty"],
price_type="MKT",
retention="DAY",
remarks="my_order_001",)
Greetings from Shoonya!
Please refer to the below-attached link for closing the positions:
https://github.com/Shoonya-Dev/ShoonyaApi-py/blob/master/README.md#md-place_order
Do we have API to close all open positions?
Say I ordered
Now I want to close all open positions...