Please Vote: Alpaca should replace side (Buy, Sell) with (BTO, STC, STO, BTC)

My algorithm sometimes tries to sell a position twice, which results in in liquidation of my current position and then the filling of a short order. In a perfect world, our code is so tried and tested that this could never happen by mistake. But, as we know, we do not live in a perfect world and bugs occur, regressions occur, hiccups occur.The accidental shorting of an equity due to two sell orders clearing is dangerous, unacceptable and yet, completely avoidable by a responsible API.

Recommendation: Please replace current “Buy, Sell” options with the following:

BTO = Buy To Open
STC = Sell To Close
STO = Sell To Open
BTC = Buy To Close

This will ensure orders accepted by the API are accepted as intended by the developer and it will help protect your clients equity.

Please vote on this issue if you agree:

[https://github.com/alpacahq/Alpaca-API/issues/85](http://#85 Replace side “Buy, Sell” with “BTO, STC, STO, BTC”)

2 Likes

Is this something we could support in addition to current side parameter values? If it is compatible with existing behavior, maybe it’s a good addition.

1 Like

I also would recommend this idea, having just encountered the situation myself. Moreover, as Hitoshi said, this could be implemented with current side parameter values without breaking changes: just let buy and sell default to current context depending on account position, with added parameters values for specificity only.

2 Likes

Agreed, this would be a nice feature to add to the current implementation.

1 Like