com.lmax.api.order
Class MarketOrderSpecification

java.lang.Object
  extended by com.lmax.api.internal.order.AbstractOrderSpecification
      extended by com.lmax.api.order.MarketOrderSpecification
All Implemented Interfaces:
com.lmax.api.internal.Request, OrderSpecification

public class MarketOrderSpecification
extends com.lmax.api.internal.order.AbstractOrderSpecification

Market Order Request.


Constructor Summary
MarketOrderSpecification(long instrumentId, FixedPointNumber quantity, TimeInForce timeInForce)
          Construct a market order request with no stops.
MarketOrderSpecification(long instrumentId, FixedPointNumber quantity, TimeInForce timeInForce, FixedPointNumber stopLossPriceOffset, FixedPointNumber stopProfitPriceOffset)
          Construct a market order request.
MarketOrderSpecification(long instrumentId, java.lang.String instructionId, FixedPointNumber quantity, TimeInForce timeInForce)
          Construct a market order request with no stops.
MarketOrderSpecification(long instrumentId, java.lang.String instructionId, FixedPointNumber quantity, TimeInForce timeInForce, FixedPointNumber stopLossPriceOffset, FixedPointNumber stopProfitPriceOffset)
          Construct a market order request.
 
Method Summary
protected  FixedPointNumber getPrice()
           
 void setTimeInForce(TimeInForce timeInForce)
          The time in force policy for the market order.
 java.lang.String toString()
          A readable String representation of the MarketOrderSpecification.
 
Methods inherited from class com.lmax.api.internal.order.AbstractOrderSpecification
getUri, setInstructionId, setInstrumentId, setQuantity, setStopLossPriceOffset, setStopProfitPriceOffset, writeTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MarketOrderSpecification

public MarketOrderSpecification(long instrumentId,
                                java.lang.String instructionId,
                                FixedPointNumber quantity,
                                TimeInForce timeInForce,
                                FixedPointNumber stopLossPriceOffset,
                                FixedPointNumber stopProfitPriceOffset)
Construct a market order request.

Parameters:
instrumentId - The id of the instrument for the order book to place the order onto.
instructionId - The user-defined correlation id
quantity - The quantity to trade. A signed value, where the sign indicates the side of the market that order is placed. Positive implies a buy order, where as negative is a sell
timeInForce - The time in force policy for the market order. This can be "Fill or Kill" or "Immediate or Cancel". An IllegalArgumentException will be thrown if an invalid time in force policy is used.
stopLossPriceOffset - Use null if you do not want to specify a stop.
stopProfitPriceOffset - Use null if you do not want to specify a stop.

MarketOrderSpecification

public MarketOrderSpecification(long instrumentId,
                                FixedPointNumber quantity,
                                TimeInForce timeInForce,
                                FixedPointNumber stopLossPriceOffset,
                                FixedPointNumber stopProfitPriceOffset)
Construct a market order request.

Parameters:
instrumentId - The id of the instrument for the order book to place the order onto.
quantity - The quantity to trade. A signed value, where the sign indicates the side of the market that order is placed. Positive implies a buy order, where as negative is a sell
timeInForce - The time in force policy for the market order. This can be "Fill or Kill" or "Immediate or Cancel". An IllegalArgumentException will be thrown if an invalid time in force policy is used.
stopLossPriceOffset - Use null if you do not want to specify a stop.
stopProfitPriceOffset - Use null if you do not want to specify a stop.

MarketOrderSpecification

public MarketOrderSpecification(long instrumentId,
                                FixedPointNumber quantity,
                                TimeInForce timeInForce)
Construct a market order request with no stops.

Parameters:
instrumentId - The id of the instrument for the order book to place the order onto.
quantity - The quantity to trade. A signed value, where the sign indicates the side of the market that order is placed. Positive implies a buy order, where as negative is a sell
timeInForce - The time in force policy for the market order. This can be "Fill or Kill" or "Immediate or Cancel". An IllegalArgumentException will be thrown if an invalid time in force policy is used.

MarketOrderSpecification

public MarketOrderSpecification(long instrumentId,
                                java.lang.String instructionId,
                                FixedPointNumber quantity,
                                TimeInForce timeInForce)
Construct a market order request with no stops.

Parameters:
instrumentId - The id of the instrument for the order book to place the order onto.
instructionId - The user-defined correlation id
quantity - The quantity to trade. A signed value, where the sign indicates the side of the market that order is placed. Positive implies a buy order, where as negative is a sell
timeInForce - The time in force policy for the market order. This can be "Fill or Kill" or "Immediate or Cancel". An IllegalArgumentException will be thrown if an invalid time in force policy is used.
Method Detail

setTimeInForce

public void setTimeInForce(TimeInForce timeInForce)
The time in force policy for the market order. This can be "Fill or Kill" or "Immediate or Cancel".

Specified by:
setTimeInForce in interface OrderSpecification
Overrides:
setTimeInForce in class com.lmax.api.internal.order.AbstractOrderSpecification
Parameters:
timeInForce - An IllegalArgumentException will be thrown if an invalid time in force policy is used.

getPrice

protected FixedPointNumber getPrice()
Specified by:
getPrice in class com.lmax.api.internal.order.AbstractOrderSpecification

toString

public java.lang.String toString()
A readable String representation of the MarketOrderSpecification.

Overrides:
toString in class com.lmax.api.internal.order.AbstractOrderSpecification
Returns:
MarketOrderSpecification as a String