Package com.strategyquant.tradinglib
Interface ILiveOrder
public interface ILiveOrder
LiveOrder Interface - has methods to call actions over live order.
-
Method Summary
Modifier and TypeMethodDescriptionClose(byte closeType)Close.Close async.CloseAsync(com.strategyquant.tradinglib.event.ITradingEventListener orderEventListener)Close async.Compute size if missing.floatintGets the bars in trade.doubleGets the close price.longGets the close time.byteGets the close type.Gets the comment.doubleGets the comm swap.intGets the direction.intGets the error code.Gets the error message.bytelongGets the expiration.doubleGets the initial SL.Gets the instrument info.doubleGets the last open price.floatgetMAE()Gets the mae.intGets the magic number.doubleGets the max slippage.floatgetMFE()Gets the mfe.doubleGets the open price.longGets the open time.intGets the order id.byteGets the order type.doubleGets the original open price.longGets the original open time.byteGets the original order type.doublegetPL()Gets the pl.doubleGets the PL in pips.byteGets the position status.doublegetPT()method returns the active Profit Target of this order.Gets the setup name.doublegetSize()Gets the size.doublegetSL()method returns the active Stop Loss of this order.floatGets the slippage in money.bytemethod returns the active Stop Loss Type of this order.Gets the strategy name.Gets the symbol.intGets the symbol hash.byteGets the working status.booleanChecks if is closed order.booleanisFilled()Checks if is filled.booleanisLong()Checks if is long.booleanChecks if is market order.booleanchecks if something in the order (SL or PT) was modified.booleanChecks if is netting mode.booleanChecks if is pending order.booleanChecks if is refused.booleanChecks if is successful.Modify async.ModifyAsync(com.strategyquant.tradinglib.event.ITradingEventListener orderEventListener)Modify async.voidRefuse.voidregisterEvent(int eventType, IActionEventListener iActionEventListener)Register event.Send()Send.Send async.SendAsync(com.strategyquant.tradinglib.event.ITradingEventListener orderEventListener)Send async.setComment(String comment)Sets the comment.setExitIndex(byte exitIndex)setExpiration(long expirationDate)Sets the expiration.setMagicNumber(int magicNumber)Sets the magic number.setMaxSlippage(double maxSlippage)Sets the max slippage.setPT(byte ptType, double value)Sets the PT.setPT(double priceLevel)Sets the PT.setSize(double quantity)Sets the size.setSL(byte slType, double value)Sets the SL.setSL(double priceLevel)Sets the SL.setSLType(byte slType)Sets the SL type.booleanusesATM()
-
Method Details
-
getSL
double getSL()method returns the active Stop Loss of this order.- Returns:
- the sl
-
getSLType
byte getSLType()method returns the active Stop Loss Type of this order. It is a constant from SlPtTypes- Returns:
- the SL type
-
setSL
Sets the SL.- Parameters:
priceLevel- the price level- Returns:
- the i live order
-
setSL
Sets the SL.- Parameters:
slType- the sl typevalue- the value- Returns:
- the i live order
-
setSLType
Sets the SL type.- Parameters:
slType- the sl type- Returns:
- the i live order
-
getPT
double getPT()method returns the active Profit Target of this order.- Returns:
- the pt
-
setPT
Sets the PT.- Parameters:
priceLevel- the price level- Returns:
- the i live order
-
setPT
Sets the PT.- Parameters:
ptType- the pt typevalue- the value- Returns:
- the i live order
-
getComment
String getComment()Gets the comment.- Returns:
- the comment
-
setComment
Sets the comment.- Parameters:
comment- the comment- Returns:
- the i live order
-
getMagicNumber
int getMagicNumber()Gets the magic number.- Returns:
- the magic number
-
setMagicNumber
Sets the magic number.- Parameters:
magicNumber- the magic number- Returns:
- the i live order
-
getMaxSlippage
double getMaxSlippage()Gets the max slippage.- Returns:
- the max slippage
-
setMaxSlippage
Sets the max slippage.- Parameters:
maxSlippage- the max slippage- Returns:
- the i live order
-
getExpiration
long getExpiration()Gets the expiration.- Returns:
- the expiration
-
setExpiration
Sets the expiration.- Parameters:
expirationDate- the expiration date- Returns:
- the i live order
-
getSymbolHash
int getSymbolHash()Gets the symbol hash.- Returns:
- the symbol hash
-
getSymbol
String getSymbol()Gets the symbol.- Returns:
- the symbol
-
getOrderType
byte getOrderType()Gets the order type.- Returns:
- the order type
-
getCloseType
byte getCloseType()Gets the close type.- Returns:
- the close type
-
getOriginalOrderType
byte getOriginalOrderType()Gets the original order type.- Returns:
- the original order type
-
getOpenTime
long getOpenTime()Gets the open time.- Returns:
- the open time
-
getOpenPrice
double getOpenPrice()Gets the open price.- Returns:
- the open price
-
getOrderId
int getOrderId()Gets the order id.- Returns:
- the order id
-
getClosePrice
double getClosePrice()Gets the close price.- Returns:
- the close price
-
isSuccessful
boolean isSuccessful()Checks if is successful.- Returns:
- true, if is successful
-
getBarsInTrade
int getBarsInTrade()Gets the bars in trade.- Returns:
- the bars in trade
-
getCloseTime
long getCloseTime()Gets the close time.- Returns:
- the close time
-
getSize
double getSize()Gets the size.- Returns:
- the size
-
Send
Send.- Returns:
- the i live order
- Throws:
TradingException- the trading exception
-
SendAsync
Send async.- Returns:
- the i live order
- Throws:
TradingException- the trading exception
-
SendAsync
ILiveOrder SendAsync(com.strategyquant.tradinglib.event.ITradingEventListener orderEventListener) throws TradingExceptionSend async.- Parameters:
orderEventListener- the order event listener- Returns:
- the i live order
- Throws:
TradingException- the trading exception
-
isModified
boolean isModified()checks if something in the order (SL or PT) was modified.- Returns:
- true, if is modified
-
ModifyAsync
Modify async.- Returns:
- the i live order
- Throws:
TradingException- the trading exception
-
ModifyAsync
ILiveOrder ModifyAsync(com.strategyquant.tradinglib.event.ITradingEventListener orderEventListener) throws TradingExceptionModify async.- Parameters:
orderEventListener- the order event listener- Returns:
- the i live order
- Throws:
TradingException- the trading exception
-
Close
Close.- Parameters:
closeType- the close type- Returns:
- the i live order
- Throws:
TradingException- the trading exception
-
CloseAsync
Close async.- Returns:
- the i live order
- Throws:
TradingException- the trading exception
-
CloseAsync
ILiveOrder CloseAsync(com.strategyquant.tradinglib.event.ITradingEventListener orderEventListener) throws TradingExceptionClose async.- Parameters:
orderEventListener- the order event listener- Returns:
- the i live order
- Throws:
TradingException- the trading exception
-
getWorkingStatus
byte getWorkingStatus()Gets the working status.- Returns:
- the working status
-
getPositionStatus
byte getPositionStatus()Gets the position status.- Returns:
- the position status
-
getStrategyName
String getStrategyName()Gets the strategy name.- Returns:
- the strategy name
-
getSetupName
String getSetupName()Gets the setup name.- Returns:
- the setup name
-
setSize
Sets the size.- Parameters:
quantity- the quantity- Returns:
- the i live order
-
computeSizeIfMissing
Compute size if missing.- Returns:
- the i live order
- Throws:
TradingException- the trading exception
-
refuse
Refuse.- Parameters:
reason- the reason
-
isRefused
boolean isRefused()Checks if is refused.- Returns:
- true, if is refused
-
getDirection
int getDirection()Gets the direction.- Returns:
- the direction
-
getOriginalOpenPrice
double getOriginalOpenPrice()Gets the original open price.- Returns:
- the original open price
-
getOriginalOpenTime
long getOriginalOpenTime()Gets the original open time.- Returns:
- the original open time
-
isPendingOrder
boolean isPendingOrder()Checks if is pending order.- Returns:
- true, if is pending order
-
isMarketOrder
boolean isMarketOrder()Checks if is market order.- Returns:
- true, if is market order
-
isClosedOrder
boolean isClosedOrder()Checks if is closed order.- Returns:
- true, if is closed order
-
getInstrumentInfo
InstrumentInfo getInstrumentInfo()Gets the instrument info.- Returns:
- the instrument info
-
getErrorCode
int getErrorCode()Gets the error code.- Returns:
- the error code
-
getErrorMessage
String getErrorMessage()Gets the error message.- Returns:
- the error message
-
getPL
double getPL()Gets the pl.- Returns:
- the pl
-
getPLInPips
double getPLInPips()Gets the PL in pips.- Returns:
- the PL in pips
-
isLong
boolean isLong()Checks if is long.- Returns:
- true, if is long
-
getCommSwap
double getCommSwap()Gets the comm swap.- Returns:
- the comm swap
-
getMAE
float getMAE()Gets the mae.- Returns:
- the mae
-
getMFE
float getMFE()Gets the mfe.- Returns:
- the mfe
-
isFilled
boolean isFilled()Checks if is filled.- Returns:
- true, if is filled
-
isNettingMode
boolean isNettingMode()Checks if is netting mode.- Returns:
- true, if is netting mode
-
getLastOpenPrice
double getLastOpenPrice()Gets the last open price.- Returns:
- the last open price
-
registerEvent
void registerEvent(int eventType, IActionEventListener iActionEventListener) throws TradingExceptionRegister event.- Parameters:
eventType- the event typeiActionEventListener- the i action event listener- Throws:
TradingException- the trading exception
-
getSlippageInMoney
float getSlippageInMoney()Gets the slippage in money.- Returns:
- the slippage in money
-
getInitialSL
double getInitialSL()Gets the initial SL.- Returns:
- the initial SL
-
setExitIndex
-
getExitIndex
byte getExitIndex() -
usesATM
boolean usesATM() -
getATROnOpen
float getATROnOpen()
-