com.dukascopy.api
Interface IContext


public interface IContext

Gives access to the various parts of the system

Author:
Denis Larka

Method Summary
<T> Future<T>
executeTask(Callable<T> callable)
          Every strategy executes in it's own thread.
 IChart getChart(Instrument instrument)
          Returns first chart for specified instrument.
 IConsole getConsole()
          Returns interface that allows to write messages into the Messages table
 IEngine getEngine()
          Returns interface of the main engine (order submitting, merging etc)
 IHistory getHistory()
          Returns interface that allows access to history data
 IIndicators getIndicators()
          Returns interface that allows to calculate indicator values
 IUserInterface getUserInterface()
          Returns an interface which provides control to custom strategy tabs in the main and bottom panels
 boolean isFullAccessGranted()
          Returns true if strategy is granted full access.
 boolean isStopped()
          Returns true if strategy were stopped.
 void stop()
          Stops strategy execution.
 

Method Detail

getEngine

IEngine getEngine()
Returns interface of the main engine (order submitting, merging etc)

Returns:
main engine

getChart

IChart getChart(Instrument instrument)
Returns first chart for specified instrument. If there is more than one chart for this instrument, then method returns one of them, but always the same.

Parameters:
instrument - currency pair
Returns:
chart

getUserInterface

IUserInterface getUserInterface()
Returns an interface which provides control to custom strategy tabs in the main and bottom panels

Returns:
singleton instance of the IUserInterface

getHistory

IHistory getHistory()
Returns interface that allows access to history data

Returns:
interface for history access

getConsole

IConsole getConsole()
Returns interface that allows to write messages into the Messages table

Returns:
interface for messages sending

getIndicators

IIndicators getIndicators()
Returns interface that allows to calculate indicator values

Returns:
interface for indicator calculations

stop

void stop()
Stops strategy execution. Current task will be completed. This method doesn't work in IStrategy.onStart()


isStopped

boolean isStopped()
Returns true if strategy were stopped. Since stop method allow to complete started function, by using this function you can evaluate if stop was called earlier


isFullAccessGranted

boolean isFullAccessGranted()
Returns true if strategy is granted full access.

Returns:
true of false depending on access level

executeTask

<T> Future<T> executeTask(Callable<T> callable)
Every strategy executes in it's own thread. This will ensure single threaded model: Any handle method of IStrategy will be executed in order. Submission of orders can be called only from these thread. If some critical action like submitting order needs to be called from other thread, you need to use this method to access strategy thread.

Type Parameters:
T - type of the return value
Parameters:
callable - task to execute
Returns:
Future that can be used to get result of execution


Copyright © 2009. All Rights Reserved.