|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface IOrder
Contains order data and allows order manipulation
| Nested Class Summary | |
|---|---|
static class |
IOrder.State
Indicates state of the order |
| Method Summary | |
|---|---|
void |
close()
Sends a request to fully close position by market price or cancel entry order. |
void |
close(double amount)
Sends a request to close the position with specified amount, by market price and default slippage. |
void |
close(double amount,
double price)
Sends a request to close the position with specified amount, price and default slippage. |
void |
close(double amount,
double price,
double slippage)
Sends a request to close the position with specified amount, price and slippage. |
boolean |
compare(IOrder order)
Compares order to current one |
double |
getAmount()
Returns amount of the order. |
double |
getClosePrice()
Returns price at which order was closed or 0 if order or order part wasn't closed. |
long |
getCloseTime()
Returns time when server closed the order |
java.lang.String |
getComment()
Returns comment that was set when order was submitted |
double |
getCommission()
Return order commission in account currency. |
double |
getCommissionInUSD()
Return order commission in USD |
long |
getCreationTime()
Returns creation time. |
long |
getFillTime()
Returns time of the fill |
long |
getGoodTillTime()
Returns time when order will be cancelled or 0 if order is "good till cancel" |
java.lang.String |
getId()
Returns position or entry ID |
Instrument |
getInstrument()
Returns instrument of the order |
java.lang.String |
getLabel()
Returns label |
double |
getOpenPrice()
Returns entry level price for conditional orders in IOrder.State.CREATED and IOrder.State.OPENED state or price at which order was
filled for orders in IOrder.State.FILLED or IOrder.State.CLOSED states |
IEngine.OrderCommand |
getOrderCommand()
Returns IEngine.OrderCommand of this message |
double |
getOriginalAmount()
Returns original constant amount of the order. |
double |
getProfitLossInAccountCurrency()
Returns profit/loss in account currency |
double |
getProfitLossInPips()
Returns profit/loss in pips |
double |
getProfitLossInUSD()
Returns profit/loss in USD |
double |
getRequestedAmount()
Returns requested amount |
IOrder.State |
getState()
Returns current IOrder.State of the order |
double |
getStopLossPrice()
Returns price of stop loss condition or 0 if stop loss condition is not set. |
OfferSide |
getStopLossSide()
Returns side that is used to check stop loss condition |
double |
getTakeProfitPrice()
Returns price of take profit condition or 0 if take profit condition is not set. |
double |
getTrailingStep()
Returns current trailing step or 0 if no trailing step is set |
boolean |
isLong()
Returns true if order is LONG. |
void |
setGoodTillTime(long goodTillTime)
Sets "good till time" for BIDs and OFFERs |
void |
setOpenPrice(double price)
Sets open price for order in IOrder.State.OPENED state |
void |
setRequestedAmount(double amount)
Sets amount of order in IOrder.State.OPENED state or cancels pending part of partially
filled order when amount equals to zero is set |
void |
setStopLossPrice(double price)
Sets stop loss price. |
void |
setStopLossPrice(double price,
OfferSide side)
Sets stop loss price. |
void |
setStopLossPrice(double price,
OfferSide side,
double trailingStep)
Sets stop loss price. |
void |
setTakeProfitPrice(double price)
Sets take profit price. |
IMessage |
waitForUpdate(IOrder.State... states)
Blocks until order changes it's state value to one of the expected states (or to any value if expected states are not specified). (unblocks when system receives message related to this order which changes order's state to one of expected). All the ticks and bars that platform received while waiting will be dropped. Method shouldn't be used for waiting long running events, like closing the order by stop loss, else buffer with messages will overflow and strategy will be stopped. |
void |
waitForUpdate(long timeoutMills)
Blocks until order changes it's state, values or until timeout is elapsed (unblocks when system receives any message related to this order). |
IMessage |
waitForUpdate(long timeoutMills,
IOrder.State... states)
Blocks until order changes it's state value to one of the expected states (or to any value if expected states are not specified). (unblocks when system receives message related to this order which changes order's state to one of expected). All the ticks and bars that platform received while waiting will be dropped. Method shouldn't be used for waiting long running events, like closing the order by stop loss, else buffer with messages will overflow and strategy will be stopped. |
IMessage |
waitForUpdate(long timeout,
java.util.concurrent.TimeUnit unit)
Blocks until order changes it's state, values or until timeout is elapsed (unblocks when system receives any message related to this order). |
IMessage |
waitForUpdate(long timeout,
java.util.concurrent.TimeUnit unit,
IOrder.State... states)
Blocks until order changes it's state value to one of the expected states (or to any value if expected states are not specified). (unblocks when system receives message related to this order which changes order's state to one of expected). All the ticks and bars that platform received while waiting will be dropped. Method shouldn't be used for waiting long running events, like closing the order by stop loss, else buffer with messages will overflow and strategy will be stopped. |
| Method Detail |
|---|
Instrument getInstrument()
java.lang.String getLabel()
java.lang.String getId()
long getCreationTime()
long getCloseTime()
IEngine.OrderCommand getOrderCommand()
IEngine.OrderCommand of this message
boolean isLong()
getOrderCommand().isLong()
long getFillTime()
double getOriginalAmount()
IEngine.submitOrder(String, Instrument, com.dukascopy.api.IEngine.OrderCommand, double)double getAmount()
IOrder.State.OPENED state returns amount requested. For orders in IOrder.State.FILLED
state will return filled amount. Filled amount can be different from requested amount (partial fill).
double getRequestedAmount()
double getOpenPrice()
IOrder.State.CREATED and IOrder.State.OPENED state or price at which order was
filled for orders in IOrder.State.FILLED or IOrder.State.CLOSED states
double getClosePrice()
double getStopLossPrice()
double getTakeProfitPrice()
void setStopLossPrice(double price)
throws JFException
getStopLossPrice() method will still return old value until server
will accept this changes
price - price to set
JFException - when method fails for some reason
void setStopLossPrice(double price,
OfferSide side)
throws JFException
getStopLossPrice() method will still return old value until server will accept this changes
price - price to setside - side that will be used to check stop loss condition
JFException - when method fails for some reason
void setStopLossPrice(double price,
OfferSide side,
double trailingStep)
throws JFException
getStopLossPrice() method will still
return old value until server will accept this changes
price - price to setside - side that will be used to check stop loss conditiontrailingStep - if < 0 then adds stop loss order without trailing step. Should be 0 or >= 10
JFException - trailingStep is > 0 and < 10 or when method fails for some reasonOfferSide getStopLossSide()
double getTrailingStep()
void setTakeProfitPrice(double price)
throws JFException
getTakeProfitPrice() method will still return old value until server will accept this changes
price - price to set
JFException - when method fails for some reasonjava.lang.String getComment()
void setRequestedAmount(double amount)
throws JFException
IOrder.State.OPENED state or cancels pending part of partially
filled order when amount equals to zero is set
amount - new amount
JFException - if order is not in IOrder.State.OPENED state or amount is not 0
for IOrder.State.FILLED state or if amount is less than a minimum allowed
void setOpenPrice(double price)
throws JFException
IOrder.State.OPENED state
price - price of the opening condition
JFException - when price change fails
void close(double amount,
double price,
double slippage)
throws JFException
amount - closing amount. Can be less than opened amount, in this case partial close will take place. If 0 is provided then all
amount will be closedprice - required close price. Close will be rejected if no liquidity at this price. This parameter doesn't affect
entry (conditional) orders.slippage - required price slippage.
JFException - when called for order not in IOrder.State.FILLED state
void close(double amount,
double price)
throws JFException
amount - closing amount. Can be less than opened amount, in this case partial close will take place. If 0 is provided then all
amount will be closedprice - required close price. Close will be rejected if no liquidity at this price. This parameter doesn't affect
entry (conditional) orders.
JFException - when called for order not in IOrder.State.FILLED state
void close(double amount)
throws JFException
amount - closing amount. Can be less than opened amount, in this case partial close will take place. If 0 is provided then all
amount will be closed
JFException - when called for order not in IOrder.State.FILLED state
void close()
throws JFException
close() method for entry orders
JFExceptionIOrder.State getState()
IOrder.State of the order
void setGoodTillTime(long goodTillTime)
throws JFException
goodTillTime - time when BID or OFFER should be canceled
JFException - when order is not place bid or offerlong getGoodTillTime()
void waitForUpdate(long timeoutMills)
timeoutMills - timeout to wait for order state change
IMessage waitForUpdate(long timeout,
java.util.concurrent.TimeUnit unit)
timeout - how long to wait before giving up, in units of
unitunit - a TimeUnit determining how to interpret the
timeout parameter
IMessage waitForUpdate(IOrder.State... states)
throws JFException
JFException will be thrown due to order is in state that cannot be changed to one of expected ones.
timeoutMills - timeout to wait for order state changestates - a set of expected states. If null or empty - blocks until order changes it's state to any value.
JFException - when order is in state that cannot be changed to one of expected states
IMessage waitForUpdate(long timeoutMills,
IOrder.State... states)
throws JFException
timeoutMills - timeout to wait for order state changestates - a set of expected states. If null or empty - blocks until order changes it's state to any value.
JFException - when order is in state that cannot be changed to one of expected states
IMessage waitForUpdate(long timeout,
java.util.concurrent.TimeUnit unit,
IOrder.State... states)
throws JFException
timeout - how long to wait before giving up, in units of
unitunit - a TimeUnit determining how to interpret the
timeout parameter.states - a set of expected states. If null or empty - blocks until order changes it's state to any value.
JFException - when order is in state that cannot be changed to one of expected statesdouble getProfitLossInPips()
double getProfitLossInUSD()
double getProfitLossInAccountCurrency()
double getCommission()
double getCommissionInUSD()
boolean compare(IOrder order)
order - to compare with current
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||