LimitOrder
History Key
- New content
Removed content
Recent Versions
Choose two versions to compare, or click the link to view it.
LimitOrders are, for our purposes, Buy or Sell orders that do not (necessarily) execute immediately. MarketOrders are their counterpart which do execute immediately.
They are created and managed by Players. But after they are submitted to an OrderBook for execution, only the orderbook may modify them. The Player retains responsibility for checking on their execution status.
Within the context of the DoubleAuctionOrderBook, they are LimitOrders in the normal sense as found on stock markets, where a price, quantity, and possibly an expiration are specified, and it will execute if market conditions make it feasible before expiration.
Specification for LimitOrder class:
public class LimitOrder
These values are set at creation by the player:
- Enumeration type (Purchase, Sale)
- int assetID -- correlated 1-1 with the orderbook
- GenericPlayer investor -- owner of the LimitOrder
- int quantity -- requested quantity to buy or sell
- double pricePerUnit -- price at which the investor wishes to transact
- double expirationTime -- schedule time the order will expire (implicitly)
- Enumeration getStatus() (Expired, Finalized, Outstanding);
These values are modified by the OrderBook upon execution, expiration, or cancellation
- AtomicInteger quantityExecuted -- the quantity that have been executed to date
- AtomicInteger cancelled -- whether the order has been explicitly cancelled by the investor via the OrderBook
At any time, the player/investor may check the status of his orders (to do accounting for example)
- LimitStatus getStatus() where !LimitStatus is one of (Pending, Expired, Partially_Executed, Fully_Executed).