Skip to content

Commit

Permalink
Phoenix: Add trader field to PhoenixOrder
Browse files Browse the repository at this point in the history
  • Loading branch information
skynetcap committed Nov 26, 2023
1 parent f155ba4 commit 40a0ed7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ private static void normalizeOrders(PhoenixMarket market) {
PhoenixOrder.builder()
.price(price)
.size(size)
.trader(market.getTraders().get((int) (order.getSecond().getTraderIndex() - 1)).getFirst())
.build()
);
});
Expand All @@ -144,6 +145,7 @@ private static void normalizeOrders(PhoenixMarket market) {
PhoenixOrder.builder()
.price(price)
.size(size)
.trader(market.getTraders().get((int) (order.getSecond().getTraderIndex() - 1)).getFirst())
.build()
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

import lombok.Builder;
import lombok.Data;
import org.p2p.solanaj.core.PublicKey;

@Data
@Builder
public class PhoenixOrder {

private double price;
private double size;
private PublicKey trader;

}
6 changes: 4 additions & 2 deletions phoenix/src/test/java/PhoenixTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,12 @@ public void orderNormalizedTest() {
log.info("Market: {}", market.getMarketId().toBase58());
// log.info("Detail: {}", market);
market.getBidListNormalized().forEach(phoenixOrder -> {
log.info(String.format("Bid: %.10f x %.4f", phoenixOrder.getPrice(), phoenixOrder.getSize()));
log.info(String.format("Bid: %.10f x %.4f, Trader: %s", phoenixOrder.getPrice(),
phoenixOrder.getSize(), phoenixOrder.getTrader().toBase58()));
});
market.getAskListNormalized().forEach(phoenixOrder -> {
log.info(String.format("Ask: %.10f x %.4f", phoenixOrder.getPrice(), phoenixOrder.getSize()));
log.info(String.format("Ask: %.10f x %.4f, Trader: %s", phoenixOrder.getPrice(),
phoenixOrder.getSize(), phoenixOrder.getTrader().toBase58()));
});
});
}
Expand Down

0 comments on commit 40a0ed7

Please sign in to comment.