alpaca-java icon indicating copy to clipboard operation
alpaca-java copied to clipboard

get latest trade price in Crypto API is not working

Open Andys52621 opened this issue 1 year ago • 3 comments

I tried the latest quote and latest traded bars , but getPrice() method is not returning correct last traded price for the crypto (BTC/USD) however getAsk or getBid are correctly working.

Is this a known issue ?

Andys52621 avatar Feb 12 '24 01:02 Andys52621

Thanks for reporting this. I will look into this later this week.

Petersoj avatar Feb 12 '24 06:02 Petersoj

Hi Jacob, please let us know when this issue is fixed. Currently the last traded prices is not working. Ask and Bid prices are working correctly.

Map<String, CryptoSnapshot> latestSnapShotMap =null; latestSnapShotMap = alpacaAPI.cryptoMarketData().getSnapshots(a).getSnapshots();

Double currentPrice = Double.parseDouble(String.format("%.2f", latestSnapShotMap.get(Property.stockSymbol).getLatestTrade().getPrice()));

Double askPrice = Double.parseDouble(String.format("%.2f", latestSnapShotMap.get(Property.stockSymbol).getLatestQuote().getAskPrice()));

Double bidPrice = Double.parseDouble(String.format("%.2f", latestSnapShotMap.get(Property.stockSymbol).getLatestQuote().getBidPrice()));

Andys52621 avatar Feb 18 '24 19:02 Andys52621

Also cryptoSnapShot.getLatestTrade().getSize();

the latest trade size is not coming correctly. its coming as a huge large negative number like riceSize: 1.949E-5

Andys52621 avatar Feb 18 '24 21:02 Andys52621

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

Petersoj avatar Mar 08 '24 19:03 Petersoj