public interface IContext
Gives access to the various parts of the system
| Method Summary | ||
|---|---|---|
void |
addConfigurationChangeListener(java.lang.String parameter,
java.beans.PropertyChangeListener listener)
Register a listener for a strategy configuration parameter which is preceded by a Configurable annotation. |
|
void |
closeChart(IChart chart)
Close specified chart. |
|
|
executeTask(java.util.concurrent.Callable<T> callable)
Every strategy executes in it's own thread. |
|
IAccount |
getAccount()
Returns last known state of the account info. |
|
IChart |
getChart(Instrument instrument)
Returns first chart for specified instrument. |
|
java.util.Set<IChart> |
getCharts(Instrument instrument)
Returns set of charts for specified instrument. |
|
IConsole |
getConsole()
Returns interface that allows to write messages into the Messages table |
|
IDataService |
getDataService()
Returns interface that allows access to system data. |
|
IDownloadableStrategies |
getDownloadableStrategies()
Returns interface that allows to handle downloadable strategies |
|
IEngine |
getEngine()
Returns interface of the main engine (order submitting, merging etc) |
|
java.io.File |
getFilesDir()
Returns directory where reading and writing is allowed. |
|
IHistory |
getHistory()
Returns interface that allows access to history data |
|
IIndicators |
getIndicators()
Returns interface that allows to calculate indicator values |
|
IChart |
getLastActiveChart()
|
|
IReportService |
getReportService()
Returns interface that give access to reporting system |
|
IStrategies |
getStrategies()
Returns interface that allows to start/stop and control other strategies |
|
java.util.Set<Instrument> |
getSubscribedInstruments()
Returns set of the currently subscribed instruments |
|
IUserInterface |
getUserInterface()
Returns an interface which provides control to custom strategy tabs in the main and bottom panels |
|
JFUtils |
getUtils()
Returns interface with JForex utility methods, e.g., currency converter |
|
boolean |
isFullAccessGranted()
Returns true if strategy is granted full access. |
|
boolean |
isStopped()
Returns true if user requested to stop the strategy. |
|
IChart |
openChart(IFeedDescriptor feedDescriptor)
Opens new chart with specified in IFeedDescriptor parameters. |
|
void |
pause()
Pauses historical testing, doesn't have any effect if not in historical tester |
|
void |
removeConfigurationChangeListener(java.lang.String parameter,
java.beans.PropertyChangeListener listener)
Unregister a listener for a certain configuration parameter which is preceded by a Configurable annotation. |
|
void |
setSubscribedInstruments(java.util.Set<Instrument> instruments)
Checks that the instruments are subscribed and subscribes to the instrument if it's not. |
|
void |
setSubscribedInstruments(java.util.Set<Instrument> instruments,
boolean lock)
Checks that the instruments are subscribed and subscribes to the instrument if it's not. |
|
void |
stop()
Stops strategy execution. |
|
void |
subscribeToBarsFeed(Instrument instrument,
Period period,
OfferSide offerSide,
IBarFeedListener listener)
Subscribes passed listener on bars feed notification by passed instrument, period and offer side. |
|
void |
subscribeToFeed(IFeedDescriptor feedDescriptor,
IFeedListener feedListener)
Subscribes passed listener on feed notification by passed feed descriptor |
|
void |
subscribeToPointAndFigureFeed(Instrument instrument,
OfferSide offerSide,
PriceRange priceRange,
ReversalAmount reversalAmount,
IPointAndFigureFeedListener listener)
Subscribes passed listener on point and figure feed notification by passed instrument, offer side, price range and reversal amount |
|
void |
subscribeToRangeBarFeed(Instrument instrument,
OfferSide offerSide,
PriceRange priceRange,
IRangeBarFeedListener listener)
Subscribes passed listener on range bars feed notification by passed instrument, offer side and price range |
|
void |
subscribeToRenkoBarFeed(Instrument instrument,
OfferSide offerSide,
PriceRange brickSize,
IRenkoBarFeedListener listener)
Subscribes passed listener on renko bars feed notification by passed instrument, offer side and brick size |
|
void |
subscribeToTickBarFeed(Instrument instrument,
OfferSide offerSide,
TickBarSize tickBarSize,
ITickBarFeedListener listener)
Subscribes passed listener on tick bar feed notification by passed instrument, offer side and tick bar size |
|
void |
subscribeToTicksFeed(Instrument instrument,
ITickFeedListener listener)
Subscribes passed listener on ticks feed notification by passed instrument. |
|
void |
unsubscribeFromBarsFeed(IBarFeedListener listener)
Unsubscribes passed listener from bars feed notification |
|
void |
unsubscribeFromFeed(IFeedListener feedListener)
Unsubscribes passed listener from feed notification |
|
void |
unsubscribeFromPointAndFigureFeed(IPointAndFigureFeedListener listener)
Unsubscribes passed listener from point and figure feed notification |
|
void |
unsubscribeFromRangeBarFeed(IRangeBarFeedListener listener)
Unsubscribes passed listener from range bars feed notification |
|
void |
unsubscribeFromRenkoBarFeed(IRenkoBarFeedListener listener)
Unsubscribes passed listener from renko bars feed notification |
|
void |
unsubscribeFromTickBarFeed(ITickBarFeedListener listener)
Unsubscribes passed listener from tick bar feed notification |
|
void |
unsubscribeFromTicksFeed(ITickFeedListener listener)
Unsubscribes passed listener from ticks feed notification |
|
| Method Detail |
|---|
IEngine getEngine()
IChart getChart(Instrument instrument)
instrument - currency pair
java.util.Set<IChart> getCharts(Instrument instrument)
instrument - currency pair
Set<IChart>IChart getLastActiveChart()
IChart object of the last active chart, i.e., the chart which last had focusIChart openChart(IFeedDescriptor feedDescriptor)
IFeedDescriptor parameters.
feedDescriptor -
java.lang.IllegalArgumentException - when feedDescriptor not formed wellvoid closeChart(IChart chart)
chart - IUserInterface getUserInterface()
IHistory getHistory()
IConsole getConsole()
IIndicators getIndicators()
IAccount getAccount()
IStrategies getStrategies()
IDownloadableStrategies getDownloadableStrategies()
JFUtils getUtils()
IDataService getDataService()
IReportService getReportService()
void setSubscribedInstruments(java.util.Set<Instrument> instruments)
setSubscribedInstruments(Set, boolean) with lock set as false
instruments - set of instruments, that strategy needs for it's work
void setSubscribedInstruments(java.util.Set<Instrument> instruments,
boolean lock)
instruments - set of instruments, that strategy needs for it's worklock - false - method returns fast after invoking and doesn't wait for subscription will be done. true - otherwise.java.util.Set<Instrument> getSubscribedInstruments()
void stop()
boolean isStopped()
boolean isFullAccessGranted()
<T> java.util.concurrent.Future<T> executeTask(java.util.concurrent.Callable<T> callable)
IStrategy
will be executed in order.
Submission of orders can be called only from this thread.
If some critical action like submitting order needs to be called from another thread, you need to use this method to access
strategy thread. For instance:
Thread thread = new Thread(new Runnable() {
public void run() {
try {
context.executeTask(task);
} catch (Exception e) {
console.getErr().println(Thread.currentThread().getName() + " " + e);
}
}
});
thread.start();
T - type of the return valuecallable - task to execute
Future<T> that can be used to get result of executionjava.io.File getFilesDir()
void pause()
void subscribeToBarsFeed(Instrument instrument,
Period period,
OfferSide offerSide,
IBarFeedListener listener)
instrument - Instrument of bars to listenperiod - Period period of bars to listen (Tick period is not supported).offerSide - OfferSide of bars to listenlistener - IBarFeedListener listenervoid unsubscribeFromBarsFeed(IBarFeedListener listener)
listener -
void subscribeToRangeBarFeed(Instrument instrument,
OfferSide offerSide,
PriceRange priceRange,
IRangeBarFeedListener listener)
instrument - Instrument of bars to listenofferSide - OfferSide of bars to listenpriceRange - PriceRange of bars to listenlistener - IRangeBarFeedListener listenervoid unsubscribeFromRangeBarFeed(IRangeBarFeedListener listener)
listener -
void subscribeToPointAndFigureFeed(Instrument instrument,
OfferSide offerSide,
PriceRange priceRange,
ReversalAmount reversalAmount,
IPointAndFigureFeedListener listener)
instrument - Instrument of P&Fs to listenofferSide - OfferSide of P&Fs to listenpriceRange - PriceRange of P&Fs to listenreversalAmount - ReversalAmount of P&Fs to listenlistener - IPointAndFigureFeedListener listenervoid unsubscribeFromPointAndFigureFeed(IPointAndFigureFeedListener listener)
listener -
void subscribeToTickBarFeed(Instrument instrument,
OfferSide offerSide,
TickBarSize tickBarSize,
ITickBarFeedListener listener)
instrument - Instrument of tick bars to listenofferSide - OfferSide of tick bars to listentickBarSize - TickBarSize of tick bars to listenlistener - ITickBarFeedListener listenervoid unsubscribeFromTickBarFeed(ITickBarFeedListener listener)
listener -
void subscribeToRenkoBarFeed(Instrument instrument,
OfferSide offerSide,
PriceRange brickSize,
IRenkoBarFeedListener listener)
instrument - Instrument of renko bars to listenofferSide - OfferSide of renko bars to listenbrickSize - brick size of renko bars to listenlistener - IRenkoBarFeedListener listenervoid unsubscribeFromRenkoBarFeed(IRenkoBarFeedListener listener)
listener -
void addConfigurationChangeListener(java.lang.String parameter,
java.beans.PropertyChangeListener listener)
Configurable annotation.
Listener will listen changes of specified property for running strategy.
parameter - either the name of strategy field which is preceded by a Configurable annotation or
Configurable.value() - the assigned configurable parameter name that appears besides
its value in GUI.listener - Listener which will get PropertyChangeEvents
void removeConfigurationChangeListener(java.lang.String parameter,
java.beans.PropertyChangeListener listener)
Configurable annotation.
parameter - either the name of strategy field which is preceded by a Configurable annotation or
Configurable.value() - the assigned configurable parameter name that appears besides
its value in GUI.listener - Listener which will get PropertyChangeEvents
void subscribeToFeed(IFeedDescriptor feedDescriptor,
IFeedListener feedListener)
feedDescriptor - IFeedDescriptorfeedListener - IFeedListenervoid unsubscribeFromFeed(IFeedListener feedListener)
feedListener - IFeedListener
void subscribeToTicksFeed(Instrument instrument,
ITickFeedListener listener)
instrument - Instrument of ticks to listenlistener - ITickFeedListener listenervoid unsubscribeFromTicksFeed(ITickFeedListener listener)
listener -