Class Order

java.lang.Object
com.bank.trading.Order

public class Order extends Object
Represents an order to market. This order is Sent from the Algo to the Smart Order Router to the Execution Service.
  • Constructor Details

    • Order

      public Order(Long orderId, String symbol, Order.OrderType orderType, Order.OrderStatus orderStatus, Double price, Integer quantity)
      Constructor to initialize the order with the required parameters.
      Parameters:
      orderId - The unique identifier for the order.
      symbol - The stock symbol for the order.
      orderType - The type of the order (e.g., MARKET_BUY, LIMIT_SELL).
      orderStatus - The initial status of the order (e.g., OPEN).
      price - The price at which to execute the order.
      quantity - The quantity of stocks to be traded.
    • Order

      public Order(byte[] order)
  • Method Details

    • getOrderId

      public Long getOrderId()
      Returns the unique identifier for the order.
      Returns:
      The order ID.
    • getSymbol

      public String getSymbol()
      Returns the stock symbol for the order.
      Returns:
      The stock symbol.
    • getOrderType

      public Order.OrderType getOrderType()
      Returns the type of the order.
      Returns:
      The order type (e.g., MARKET_BUY, LIMIT_SELL).
    • getOrderStatus

      public Order.OrderStatus getOrderStatus()
      Returns the current status of the order.
      Returns:
      The order status (e.g., OPEN, FILLED, CANCELLED).
    • getExchange

      public Order.Exchange getExchange()
      Returns the exchange on which the order is to be executed.
      Returns:
      The exchange (e.g., NYSE, NASDAQ).
    • getPrice

      public Double getPrice()
      Returns the price at which the order is to be executed.
      Returns:
      The price for the order.
    • getQuantity

      public Integer getQuantity()
      Returns the quantity of stocks to be traded.
      Returns:
      The quantity of stocks.
    • setExchange

      public void setExchange(Order.Exchange exchange)
      Sets the exchange on which the order is to be executed.
      Parameters:
      exchange - The exchange to set for the order (e.g., NYSE, NASDAQ).
    • setOrderStatus

      public void setOrderStatus(Order.OrderStatus orderStatus)
      Sets the order status of the order.
      Parameters:
      orderStatus - The new status for the order (e.g., OPEN, FILLED, CANCELLED).
    • getTimeToExecute

      public long getTimeToExecute()
      Gets the time to execute the order.
      Returns:
      The Unix timestamp of when the order should be executed.
    • setTimeToExecute

      public void setTimeToExecute(Long timeToExecute)
      Sets the time to execute the order. This should be set to a Unix timestamp indicating when the order should be executed.
      Parameters:
      timeToExecute - The Unix timestamp for execution.
    • toByteArray

      public byte[] toByteArray()
      Converts the order to a byte array for transmission. This is a simple string representation of the order.
      Returns:
      The byte array representation of the order.