import java.util.concurrent.ConcurrentHashMap;
import net.openhft.collections.SharedHashMap;
import net.openhft.collections.SharedHashMapBuilder;
public class HFTTrader {
private SharedHashMap<String, Double> orderBook;
public HFTTrader() {
orderBook = new SharedHashMapBuilder<String, Double>()
.entries(100000)
.create();
}
public void placeOrder(String symbol, double price) {
orderBook.put(symbol, price);
}
public double getOrderPrice(String symbol) {
return orderBook.get(symbol);
}
public static void main(String[] args) {
HFTTrader trader = new HFTTrader();
trader.placeOrder("AAPL", 150.50);
double orderPrice = trader.getOrderPrice("AAPL");
System.out.println("Order Price: " + orderPrice);
}
}