Position closing endpoints

Please consider making the cancellation of existing orders a default action included in the DELETE positions endpoints. I would expect that if a trader wants to rapidly exit a position at market, they would not want to have to worry about finding and cancelling existing orders. That seems like a backend job.

Currently an error is returned if there are competing open orders, like so:

    "available": "0",
    "code": 40310000,
    "existing_qty": "1000",
    "held_for_orders": "1000",
    "message": "insufficient qty available for order (requested: 1000, available: 0)",
    "related_orders": [
    "symbol": "AMD"
1 Like

That makes sense. It could be additional parameter to do the extra work in backend.

1 Like

Yes, that would be a great solution.

Seconding this. Close all positions should just close all positions, full stop. I can only see the usefulness of this endpoint being akin to a killswitch, but it doesn’t really serve that purpose if the positions have associated orders. As I’m building AlpacaforR, I’m going to have the function that calls this endpoint cancel all orders first as a workaround but would like to see the endpoint modified such that it does this automatically.

1 Like

Make sense. It shouldn’t be too hard to add it…

1 Like

May I know if the feature is added ? How to check if there’s any feature updated ?

It is not added yet. We will let you know.

looking forward to seeing this implemented!