Issue:
Purchase order is partially filled. Closing position also is partially performed. Targets are either ETHUSD, BTCUSD, or LTCUSD.
For example, trigger to buy 5 BTCUSD ends up getting filled at 4.985. Plenty of buying power so no explanation why Alpaca chose to not return it filled for the full amount. Sell order triggers and I’m using a liquidation approach so it just calls the base url /v2/positions/BTCUSD which should close out everything in my account for that asset. Result is it liquidates all but 0.0061 BTCUSD. Attempts to close out the position manually return a qty must be >= 0.0001 error.
Is this behavior related to the recent crypto changes and will be getting fixed?
Regarding the fill discrepancy that is solved by using the new symbol pattern. ETH/USD, BTC/USD, etc. As noted in the other forum entries regarding the recent crypto changes the positions api is where I’m stuck as since it only accepts the older style of symbols. When they fix the positions api then I’ll revisit to see if the liquidation is back on track.
I’ll update this thread once they fix their end. Since I’m new to Alpaca thought I was missing something, but this is 100% an issue on their end. Appears to me they got their lines crossed when trying to support fractional shares and also crypto assets via the same positions endpoint which doesn’t batch the exit orders how we expect. For example, try to liquid a BTC/USD position and it will get rid of everything except for 0.000095 which then finds us in the position where attempts to clear that off the ledgers hits their API restrictions that you can’t execute an order with the error being qty must be >= 0.0001. Try the same action for ETH/USD and the precision they allow for the sale is almost the same with the error being qty must be >= 0.001. All in all, they must be working on it since this has real implications for customers. Just wish we could get a general idea of when they hope to find a solution.
I got a reply from alpaca support team
“
Thanks for waiting.
We got a confirmation from the engineering team, this is the known limitation. For the record, some other platforms like (cex, binance) have similar limitation where decimal qty remains even after liquidating a position in crypto.
We have started working on crypto prop feature where users can trade quantity less than allowed decimals with FTX.
We will reach you back once the function, thank you
Sincerely,
I seems like there’s no way to solve this with crypto if you place orders using notional value and/or use the IOC time-in-force. That’s because you could end up filling with an qty that isn’t divisible by minimum order size.
In theory, if I use GTC orders with QTY instead of notional, and QTY is divisible by the asset’s min_order_size (meaning no remainder) then theoretically, you might not run into this problem.
Brett and MadTrader. The fix is still pending. Joined their discord and they stated it was still being worked on.
@Brett I’ve gone through the same journey you did with a few other possible workarounds that all end the same. Nothing we can do from our end to normalize the qty or force a sell order that always returns the asset to zero held.