Class Trade
java.lang.Object
eds.model.Trade
- All Implemented Interfaces:
ISimulationEntity
Represents a single executed trade in the simulation.
Trade is an immutable execution record created by the matching engine
when a buy and a sell order successfully match.
-
Constructor Details
-
Trade
public Trade(String buyOrderId, String sellOrderId, double price, int shareSize, double conclusionTime) Constructs a new Trade.- Parameters:
buyOrderId- id of the buy ordersellOrderId- id of the sell orderprice- execution price (must be positive)shareSize- executed quantity (must be positive)conclusionTime- simulation time at which the trade occurred- Throws:
IllegalArgumentException- if order IDs are equal
-
-
Method Details
-
getId
- Returns:
- unique trade identifier
-
getBuyOrderId
- Returns:
- buy order identifier
-
getSellOrderId
- Returns:
- sell order identifier
-
getPrice
public double getPrice()- Returns:
- execution price
-
getConclusionTime
public double getConclusionTime()- Returns:
- simulation time at which trade occurred
-
toString
-