|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface IEngine
Interface to the main engine, that allows orders submission, merging etc
| Nested Class Summary | |
|---|---|
static class |
IEngine.OrderCommand
Specifies type of the order |
static class |
IEngine.StrategyMode
Specifies strategy running mode. |
static class |
IEngine.Type
Type of the engine |
| Method Summary | |
|---|---|
void |
broadcast(java.lang.String topic,
java.lang.String message)
Broadcast message |
void |
closeOrders(IOrder... orders)
Mass close. |
java.lang.String |
getAccount()
Returns account name |
IOrder |
getOrder(java.lang.String label)
Returns order by label, or null if no order was found |
IOrder |
getOrderById(java.lang.String orderId)
Returns order in IOrder.State.CREATED, IOrder.State.OPENED and IOrder.State.FILLED state by id, or null if no order was found |
java.util.List<IOrder> |
getOrders()
Returns list of orders in IOrder.State.CREATED, IOrder.State.OPENED and IOrder.State.FILLED state |
java.util.List<IOrder> |
getOrders(Instrument instrument)
Returns list of orders in IOrder.State.CREATED, IOrder.State.OPENED and IOrder.State.FILLED state for
specified instrument |
IEngine.StrategyMode |
getStrategyMode()
Returns strategy running mode, one of the IEngine.StrategyMode.INDEPENDENT or IEngine.StrategyMode.SIGNALS. |
IEngine.Type |
getType()
Returns type of the engine, one of the IEngine.Type.LIVE, IEngine.Type.DEMO or IEngine.Type.TEST for tester. |
java.lang.String |
groupToOCO(IOrder order1,
IOrder order2)
|
void |
mergeOrders(IOrder... orders)
Deprecated. use mergeOrders(String label,IOrder... orders) throws JFException; |
IOrder |
mergeOrders(java.lang.String label,
IOrder... orders)
Merges orders. |
IOrder |
submitOrder(java.lang.String label,
Instrument instrument,
IEngine.OrderCommand orderCommand,
double amount)
Submits new order. |
IOrder |
submitOrder(java.lang.String label,
Instrument instrument,
IEngine.OrderCommand orderCommand,
double amount,
double price)
Submits new order. |
IOrder |
submitOrder(java.lang.String label,
Instrument instrument,
IEngine.OrderCommand orderCommand,
double amount,
double price,
double slippage)
Submits new order. |
IOrder |
submitOrder(java.lang.String label,
Instrument instrument,
IEngine.OrderCommand orderCommand,
double amount,
double price,
double slippage,
double stopLossPrice,
double takeProfitPrice)
Submits new order. |
IOrder |
submitOrder(java.lang.String label,
Instrument instrument,
IEngine.OrderCommand orderCommand,
double amount,
double price,
double slippage,
double stopLossPrice,
double takeProfitPrice,
long goodTillTime)
Submits new order. |
IOrder |
submitOrder(java.lang.String label,
Instrument instrument,
IEngine.OrderCommand orderCommand,
double amount,
double price,
double slippage,
double stopLossPrice,
double takeProfitPrice,
long goodTillTime,
java.lang.String comment)
Submits new order. |
java.lang.String |
ungroupOCO(IOrder order)
|
| Method Detail |
|---|
IOrder submitOrder(java.lang.String label,
Instrument instrument,
IEngine.OrderCommand orderCommand,
double amount,
double price,
double slippage,
double stopLossPrice,
double takeProfitPrice,
long goodTillTime,
java.lang.String comment)
throws JFException
IOrder.State.CREATED status and will be updated to IOrder.State.OPENED status
after server confirmation
label - user defined identifier for the order. Label must be unique for the given user account among the current orders.
Allowed characters: letters, numbers and "_". Label must have at most 256 characters.instrument - instrumentorderCommand - type of submitted orderamount - amount in millions for the orderprice - preferred price for order. If zero, then last market price visible on the JForex will be used.
Price should be divisible by 0.1 pips or order will be rejected.
In case of market orders, incorrect price (worse than current market) will be changed to current price and slippageslippage - slippage. The value of slippage means following:
stopLossPrice - price of the stop loss. Price should be divisible by 0.1 pips or order will be rejectedtakeProfitPrice - price of the take profit. Price should be divisible by 0.1 pips or order will be rejectedgoodTillTime - how long order should live if not executed. Only if > 0, then orderCommand should be
IEngine.OrderCommand.PLACE_BID or IEngine.OrderCommand.PLACE_OFFERcomment - comment that will be saved in order
IOrder.State.CREATED state
JFException - if label is not valid or already exists, if goodTillTime > 0 and orderCommand is not BID/OFFER, if amount is less
than minimum allowed, if some of the required parameters is null
IOrder submitOrder(java.lang.String label,
Instrument instrument,
IEngine.OrderCommand orderCommand,
double amount,
double price,
double slippage,
double stopLossPrice,
double takeProfitPrice,
long goodTillTime)
throws JFException
IOrder.State.CREATED status and will be updated to IOrder.State.OPENED status
after server confirmation
label - user defined identifier for the order. Label must be unique for the given user account among the current orders.
Allowed characters: letters, numbers and "_". Label must have at most 256 characters.instrument - instrumentorderCommand - type of submitted orderamount - amount in millions for the orderprice - preferred price for order. If zero, then last market price visible on the JForex will be used.
Price should be divisible by 0.1 pips or order will be rejected.
In case of market orders, incorrect price (worse than current market) will be changed to current price and slippageslippage - slippage. The value of slippage means following:
stopLossPrice - price of the stop loss. Price should be divisible by 0.1 pips or order will be rejectedtakeProfitPrice - price of the take profit. Price should be divisible by 0.1 pips or order will be rejectedgoodTillTime - how long order should live if not executed. Only if > 0, then orderCommand should be
IEngine.OrderCommand.PLACE_BID or IEngine.OrderCommand.PLACE_OFFER
IOrder.State.CREATED state
JFException - if label is not valid or already exists, if goodTillTime > 0 and orderCommand is not BID/OFFER, if amount is less
than minimum allowed, if some of the required parameters is null
IOrder submitOrder(java.lang.String label,
Instrument instrument,
IEngine.OrderCommand orderCommand,
double amount,
double price,
double slippage,
double stopLossPrice,
double takeProfitPrice)
throws JFException
IOrder.State.CREATED status and will be updated to IOrder.State.OPENED status
after server confirmation
label - user defined identifier for the order. Label must be unique for the given user account among the current orders.
Allowed characters: letters, numbers and "_". Label must have at most 256 characters.instrument - instrumentorderCommand - type of submitted orderamount - amount in millions for the orderprice - preferred price for order. If zero, then last market price visible on the JForex will be used.
Price should be divisible by 0.1 pips or order will be rejected.
In case of market orders, incorrect price (worse than current market) will be changed to current price and slippageslippage - slippage. The value of slippage means following:
stopLossPrice - price of the stop loss. Price should be divisible by 0.1 pips or order will be rejectedtakeProfitPrice - price of the take profit. Price should be divisible by 0.1 pips or order will be rejected
IOrder.State.CREATED state
JFException - if label is not valid or already exists, if amount is less than minimum allowed, if some of the required
parameters is null
IOrder submitOrder(java.lang.String label,
Instrument instrument,
IEngine.OrderCommand orderCommand,
double amount,
double price,
double slippage)
throws JFException
IOrder.State.CREATED status and will be updated to IOrder.State.OPENED status
after server confirmation
label - user defined identifier for the order. Label must be unique for the given user account among the current orders.
Allowed characters: letters, numbers and "_". Label must have at most 256 characters.instrument - instrumentorderCommand - type of submitted orderamount - amount in millions for the orderprice - preferred price for order. If zero, then last market price visible on the JForex will be used.
Price should be divisible by 0.1 pips or order will be rejected.
In case of market orders, incorrect price (worse than current market) will be changed to current price and slippageslippage - slippage. The value of slippage means following:
IOrder.State.CREATED state
JFException - if label is not valid or already exists, if amount is less than minimum allowed, if some of the required
parameters is null
IOrder submitOrder(java.lang.String label,
Instrument instrument,
IEngine.OrderCommand orderCommand,
double amount,
double price)
throws JFException
IOrder.State.CREATED status and will be updated to IOrder.State.OPENED status
after server confirmation.
submitOrder(...) methods.
label - user defined identifier for the order. Label must be unique for the given user account among the current orders.
Allowed characters: letters, numbers and "_". Label must have at most 256 characters.instrument - instrumentorderCommand - type of submitted orderamount - amount in millions for the orderprice - preferred price for order. If zero, then last market price visible on the JForex will be used.
Price should be divisible by 0.1 pips or order will be rejected.
In case of market orders, incorrect price (worse than current market) will be changed to current price and slippage
IOrder.State.CREATED state
JFException - if label is not valid or already exists, if amount is less than minimum allowed, if some of the required
parameters is nullsubmitOrder(String, Instrument, OrderCommand, double, double, double),
submitOrder(String, Instrument, OrderCommand, double, double, double, double, double),
submitOrder(String, Instrument, OrderCommand, double, double, double, double, double, long),
submitOrder(String, Instrument, OrderCommand, double, double, double, double, double, long, String)
IOrder submitOrder(java.lang.String label,
Instrument instrument,
IEngine.OrderCommand orderCommand,
double amount)
throws JFException
IOrder.State.CREATED status and will be updated to IOrder.State.OPENED status
after server confirmation.
submitOrder(...) methods.
label - user defined identifier for the order. Label must be unique for the given user account among the current orders.
Allowed characters: letters, numbers and "_". Label must have at most 256 characters.instrument - instrumentorderCommand - type of submitted order. Only IEngine.OrderCommand.BUY and IEngine.OrderCommand.SELL allowed in this methodamount - amount in millions for the order
IOrder.State.CREATED state
JFException - if label is not valid or already exists, if amount is less than minimum allowed, if some of the required
parameters is null or if orderCommand is not BUY or SELLsubmitOrder(String, Instrument, OrderCommand, double, double, double),
submitOrder(String, Instrument, OrderCommand, double, double, double, double, double),
submitOrder(String, Instrument, OrderCommand, double, double, double, double, double, long),
submitOrder(String, Instrument, OrderCommand, double, double, double, double, double, long, String)
IOrder getOrder(java.lang.String label)
throws JFException
label - order's label
IOrder.State.CREATED, IOrder.State.OPENED and IOrder.State.FILLED state or null
JFExceptionIOrder getOrderById(java.lang.String orderId)
IOrder.State.CREATED, IOrder.State.OPENED and IOrder.State.FILLED state by id, or null if no order was found
orderId - order's id
java.util.List<IOrder> getOrders(Instrument instrument)
throws JFException
IOrder.State.CREATED, IOrder.State.OPENED and IOrder.State.FILLED state for
specified instrument
instrument - instrument
JFException
java.util.List<IOrder> getOrders()
throws JFException
IOrder.State.CREATED, IOrder.State.OPENED and IOrder.State.FILLED state
JFException
void mergeOrders(IOrder... orders)
throws JFException
IMessage.Type.ORDERS_MERGE_OK type and resulting order or
null if there is no amount left for order. If there is less than 2 orders, then method exits after checking conditions, which are one
instrument, IOrder.State.FILLED state and no stop loss/take profit conditions
orders - orders to merge
JFException - if orders not in IOrder.State.FILLED state, have stop loss or take profit set or doesn't belong to one instrument
IOrder mergeOrders(java.lang.String label,
IOrder... orders)
throws JFException
IMessage.Type.ORDERS_MERGE_OK type and resulting order, which can
be in closed state if there is no amount left for order. If there is less than 2 orders, then method exits after checking conditions,
which are one instrument, IOrder.State.FILLED state and no stop loss/take profit conditions
label - user defined identifier for the resulting order. Label must be unique for the given user account among the current ordersorders - orders to merge
JFException - if orders not in IOrder.State.FILLED state, have stop loss or take profit set or doesn't belong to one instrument
void closeOrders(IOrder... orders)
throws JFException
orders - orders to close
JFException - if orders not in IOrder.State.FILLED state.IEngine.Type getType()
IEngine.Type.LIVE, IEngine.Type.DEMO or IEngine.Type.TEST for tester.
java.lang.String getAccount()
void broadcast(java.lang.String topic,
java.lang.String message)
throws JFException
JFException
java.lang.String groupToOCO(IOrder order1,
IOrder order2)
throws JFException
JFException
java.lang.String ungroupOCO(IOrder order)
throws JFException
JFExceptionIEngine.StrategyMode getStrategyMode()
IEngine.StrategyMode.INDEPENDENT or IEngine.StrategyMode.SIGNALS.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||