Petersoj / alpaca-java

A Java API for Alpaca, the commission free, algo friendly, stock trading broker. https://alpaca.markets
https://petersoj.github.io/alpaca-java/
MIT License
198 stars 84 forks source link

Issue with not able to get correct quantity of BTC (crypto) from Alpaca after the buy trade is filled. #148

Closed Andys52621 closed 6 months ago

Andys52621 commented 7 months ago

Dear Jacob,

Hope you are doing well, I am writing to bring to your attention an issue I have encountered with Alpaca's market order execution for cryptocurrencies.

It has come to my notice that when executing a market order, Alpaca deducts 0.25% as fees, resulting in a fractional reduction in the purchased quantity. For instance, if I initially buy 0.5 shares of BTC, the actual quantity reflected in the Alpaca portfolio is approximately 0.4956233, as opposed to the expected 0.5.

When querying the order details using the Java Crypto API, I observed that both the Quantity and QtyFilled fields display the original quantity (0.5), rather than the adjusted quantity (e.g., 0.4956233). This inconsistency becomes problematic when attempting to place a sell order, as the API rejects the order, citing a discrepancy between the attempted sale quantity (0.5) and the available quantity (0.49562...).

I kindly request your assistance in investigating and resolving this discrepancy. It would be greatly appreciated if the API could provide the most recent adjusted quantity, aligning with the adjusted quantity displayed on the Alpaca dashboard.

Thank you for your prompt attention to this matter. I look forward to your guidance and resolution.

Best regards,

Andy

Petersoj commented 6 months ago

Should be fixed in 10.0.0. Re-open if not.