From 8380486af41d412641eae4e832f0a2fbcaf18003 Mon Sep 17 00:00:00 2001 From: skynetcap <100323448+skynetcap@users.noreply.github.com> Date: Sun, 19 Nov 2023 02:22:37 -0800 Subject: [PATCH] Phoenix tests: phoenixGetMarketDetailStreamingTest --- phoenix/src/test/java/PhoenixTest.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/phoenix/src/test/java/PhoenixTest.java b/phoenix/src/test/java/PhoenixTest.java index 995fed9..adda281 100644 --- a/phoenix/src/test/java/PhoenixTest.java +++ b/phoenix/src/test/java/PhoenixTest.java @@ -125,13 +125,23 @@ public void phoenixGetMarketDetailStreamingTest() throws InterruptedException { ).toList(); bids = bids.subList(0, 3); bids.forEach(fifoOrderIdFIFORestingOrderPair -> { - log.info(String.format("Bids: $%.4f, Size: %.2f SOL, Trader: %s", + log.info(String.format("Bid: $%.4f, Size: %.2f SOL, Trader: %s", (double) fifoOrderIdFIFORestingOrderPair.getFirst().getPriceInTicks() / phoenixMarket.getBaseLotsPerBaseUnit(), (double) fifoOrderIdFIFORestingOrderPair.getSecond().getNumBaseLots() / phoenixMarket.getTickSizeInQuoteLotsPerBaseUnit(), phoenixMarket.getTradersSanitized().get((int) (fifoOrderIdFIFORestingOrderPair.getSecond().getTraderIndex() - 1)).getFirst().toBase58())); }); + var asks = phoenixMarket.getAskListSanitized().stream().sorted( + (o1, o2) -> Math.toIntExact(o1.component1().getPriceInTicks() - o2.getFirst().getPriceInTicks()) + ).toList(); + asks = asks.subList(0, 3); + asks.forEach(fifoOrderIdFIFORestingOrderPair -> { + log.info(String.format("Ask: $%.4f, Size: %.2f SOL, Trader: %s", + (double) fifoOrderIdFIFORestingOrderPair.getFirst().getPriceInTicks() / phoenixMarket.getBaseLotsPerBaseUnit(), + (double) fifoOrderIdFIFORestingOrderPair.getSecond().getNumBaseLots() / phoenixMarket.getTickSizeInQuoteLotsPerBaseUnit(), + phoenixMarket.getTradersSanitized().get((int) (fifoOrderIdFIFORestingOrderPair.getSecond().getTraderIndex() - 1)).getFirst().toBase58())); + }); } );