io.scalecube.examples.orderbook.service.OrderBookSnapshoot Maven / Gradle / Ivy
package io.scalecube.examples.orderbook.service;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
public class OrderBookSnapshoot {
Map bids = new HashMap();
Map asks = new HashMap();
Long currentPrice;
public OrderBookSnapshoot(OrderBook orderBook, Long currentPrice) {
Set askPrices = Collections.unmodifiableSet(orderBook.getAskPrices());
Set bidPrices = Collections.unmodifiableSet(orderBook.getBidPrices());
askPrices.forEach(price -> asks.put(price, orderBook.getAskSize(price)));
bidPrices.forEach(price -> bids.put(price, orderBook.getBidSize(price)));
this.currentPrice = currentPrice;
}
public Map bids() {
return bids;
}
public Map asks() {
return asks;
}
public Long currentPrice() {
return currentPrice;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy