Class Trade

java.lang.Object
eds.model.Trade
All Implemented Interfaces:
ISimulationEntity

public class Trade extends Object implements 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 order
      sellOrderId - id of the sell order
      price - 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

      public String getId()
      Returns:
      unique trade identifier
    • getBuyOrderId

      public String getBuyOrderId()
      Returns:
      buy order identifier
    • getSellOrderId

      public String getSellOrderId()
      Returns:
      sell order identifier
    • getPrice

      public double getPrice()
      Returns:
      execution price
    • getShareSize

      public int getShareSize()
      Returns:
      executed quantity of shares
    • getConclusionTime

      public double getConclusionTime()
      Returns:
      simulation time at which trade occurred
    • toString

      public String toString()
      Returns a formatted string representation of the trade.
      Overrides:
      toString in class Object