I have short position of 40 shares bracket order with NVDA. I am trying to close the position using the below API but it does not work.
Closing all the positions works using this https://paper-api.alpaca.markets/v2/positions
However closing individual positions does not work using this one 'https://paper-api.alpaca.markets/v2/positions/NVDA?percentage=100
Blockquote
curl --request DELETE
–url ‘https://paper-api.alpaca.markets/v2/positions/NVDA?percentage=100’
–header ‘APCA-API-KEY-ID: ********’
–header ‘APCA-API-SECRET-KEY: **********’
–header ‘accept: application/json’
Response is
Blockquote
{
“available”: “0”,
“code”: 40310000,
“existing_qty”: “40”,
“held_for_orders”: “40”,
“message”: “insufficient qty available for order (requested: 40, available: 0)”,
“symbol”: “NVDA”
}
I tried to using different percentages 100, -100,
Changes quantity to 40, -40. However it does not work. Please update the above API and also add a flag to cancel open orders for that symbol like we have for close all positions API.
If there is any alternative in the mean time that would be helpful.
Thanks and appreciate your help.