-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTradeRecord.java
More file actions
24 lines (22 loc) · 831 Bytes
/
Copy pathTradeRecord.java
File metadata and controls
24 lines (22 loc) · 831 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
public class TradeRecord {
public final int tradeId;
public final int buyOrderId;
public final int sellOrderId;
public final double price;
public final int quantity;
public final long executedAt; // System.nanoTime() at match time
public TradeRecord(int tradeId, int buyOrderId, int sellOrderId,
double price, int quantity) {
this.tradeId = tradeId;
this.buyOrderId = buyOrderId;
this.sellOrderId = sellOrderId;
this.price = price;
this.quantity = quantity;
this.executedAt = System.nanoTime();
}
@Override
public String toString() {
return String.format("Trade #%d | BUY #%d x SELL #%d | $%.2f x %d shares",
tradeId, buyOrderId, sellOrderId, price, quantity);
}
}