Package com.bank.trading
Class Order
java.lang.Object
com.bank.trading.Order
Represents an order to market. This order is Sent from the Algo to the Smart Order Router to the Execution Service.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumRepresents the stock exchanges where the order can be executed.static enumRepresents the status of the order.static enumRepresents the type of the order. -
Constructor Summary
ConstructorsConstructorDescriptionOrder(byte[] order) Order(Long orderId, String symbol, Order.OrderType orderType, Order.OrderStatus orderStatus, Double price, Integer quantity) Constructor to initialize the order with the required parameters. -
Method Summary
Modifier and TypeMethodDescriptionReturns the exchange on which the order is to be executed.Returns the unique identifier for the order.Returns the current status of the order.Returns the type of the order.getPrice()Returns the price at which the order is to be executed.Returns the quantity of stocks to be traded.Returns the stock symbol for the order.longGets the time to execute the order.voidsetExchange(Order.Exchange exchange) Sets the exchange on which the order is to be executed.voidsetOrderStatus(Order.OrderStatus orderStatus) Sets the order status of the order.voidsetTimeToExecute(Long timeToExecute) Sets the time to execute the order.byte[]Converts the order to a byte array for transmission.
-
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
Returns the unique identifier for the order.- Returns:
- The order ID.
-
getSymbol
Returns the stock symbol for the order.- Returns:
- The stock symbol.
-
getOrderType
Returns the type of the order.- Returns:
- The order type (e.g., MARKET_BUY, LIMIT_SELL).
-
getOrderStatus
Returns the current status of the order.- Returns:
- The order status (e.g., OPEN, FILLED, CANCELLED).
-
getExchange
Returns the exchange on which the order is to be executed.- Returns:
- The exchange (e.g., NYSE, NASDAQ).
-
getPrice
Returns the price at which the order is to be executed.- Returns:
- The price for the order.
-
getQuantity
Returns the quantity of stocks to be traded.- Returns:
- The quantity of stocks.
-
setExchange
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
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
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.
-