|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectTradeOrder
public class TradeOrder
Represents a buy or sell order for trading a given number of shares of a specified stock.
Constructor Summary | |
---|---|
TradeOrder(Trader trader,
java.lang.String symbol,
boolean buyOrder,
boolean marketOrder,
int numShares,
double price)
Constructs a new TradeOrder for a given trader, stock symbol,
a number of shares, and other parameters. |
Method Summary | |
---|---|
double |
getPrice()
Returns the price per share for this trade order (used by a limit order). |
int |
getShares()
Returns the number of shares to be traded in this trade order. |
java.lang.String |
getSymbol()
Returns the stock symbol for this trade order. |
Trader |
getTrader()
Returns the trader for this trade order. |
boolean |
isBuy()
Returns true if this is a buy order; otherwise returns false. |
boolean |
isLimit()
Returns true if this is a limit order; otherwise returns false. |
boolean |
isMarket()
Returns true if this is a market order; otherwise returns false. |
boolean |
isSell()
Returns true if this is a sell order; otherwise returns false. |
void |
subtractShares(int shares)
Subtracts a given number of shares from the total number of shares in this trade order. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TradeOrder(Trader trader, java.lang.String symbol, boolean buyOrder, boolean marketOrder, int numShares, double price)
TradeOrder
for a given trader, stock symbol,
a number of shares, and other parameters.
trader
- a trader who placed this order.symbol
- stock symbol.buyOrder
- if true this is a buy order; otherwise this is a sell order.marketOrder
- if true this is a market order; otherwise this is a limit order.numShares
- the number of shares to be traded.price
- the bid or ask price, if this is a limit order.Method Detail |
---|
public Trader getTrader()
public java.lang.String getSymbol()
public boolean isBuy()
public boolean isSell()
public boolean isMarket()
public boolean isLimit()
public int getShares()
public double getPrice()
public void subtractShares(int shares)
shares
- a number of shares to be subtracted.
java.lang.IllegalArgumentException
- if shares is greater than
the number of shares
in this order.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |