com.dukascopy.api.system
Interface ITesterClient

All Superinterfaces:
IClient

public interface ITesterClient
extends IClient

Contains methods to control testing process


Nested Class Summary
static class ITesterClient.InterpolationMethod
          Different technics of how to convert bars into ticks
 
Method Summary
 void createReport(File file)
          Deprecated. use createReport(long, File) instead
 void createReport(long processId, File file)
          Will create and write report into the given file.
 Future<?> downloadData(LoadingProgressListener loadingProgressListener)
          Downloads data into the local cache.
 Commissions getCommissions()
          Returns Commissions object filled with limits and corresponding commissions for deposit, equity and turnover amounts
 boolean getEventLogEnabled()
          Returns true if event log enabled
 boolean getGatherReportData()
          Returns true if tester is set to gather report data
 double getInitialDeposit()
          Returns initial deposit
 Currency getInitialDepositCurrency()
          Return deposit currency
 int getLeverage()
          Returns leverage
 int getMarginCutLevel()
          Returns margin cut level in percents
 double getMCEquity()
          Returns minimum equity amount
 Overnights getOvernights()
          Returns Overnights object
 boolean getProcessingStats()
          Returns true if processing stats enabled
 void setCommissions(Commissions commissions)
          Sets the commissions information.
 void setDataInterval(Period period, OfferSide side, ITesterClient.InterpolationMethod interpolationMethod, long from, long to)
          Sets the period to use for ticks generation and time interval when to start and end testing process.
 void setEventLogEnabled(boolean eventLogEnabled)
          If true then event log information will be collected when strategy is run.
 void setGatherReportData(boolean gatherReportData)
          Set to true to tell the tester to gather report data.
 void setInitialDeposit(Currency currency, double deposit)
          Sets initial deposit amount and currency.
 void setLeverage(int leverage)
          Sets leverage.
 void setMarginCutLevel(int mcLevel)
          Sets level in percents, exceeding which the system will start margin cut procedure reducing use of leverage.
 void setMCEquity(double mcEquity)
          Sets minimum equity amount.
 void setOvernights(Overnights overnights)
          Sets the overnight vales.
 void setProcessingStatsEnabled(boolean processingStats)
          If true then the tester will collect statistics about processing time in different subsystems.
 long startStrategy(IStrategy strategy, IStrategyExceptionHandler exceptionHandler, LoadingProgressListener testerProgressListener)
          Starts the strategy
 long startStrategy(IStrategy strategy, LoadingProgressListener testerProgressListener)
          Starts the strategy
 
Methods inherited from interface com.dukascopy.api.system.IClient
addNewsFilter, connect, connect, getCaptchaImage, getNewsFilter, getStartedStrategies, getSubscribedInstruments, isConnected, loadStrategy, reconnect, removeNewsFilter, setCacheDirectory, setErr, setOut, setSystemListener, setSubscribedInstruments, startStrategy, startStrategy, stopStrategy
 

Method Detail

setDataInterval

void setDataInterval(Period period,
                     OfferSide side,
                     ITesterClient.InterpolationMethod interpolationMethod,
                     long from,
                     long to)
Sets the period to use for ticks generation and time interval when to start and end testing process. Changing this value will take effect only if called before testing process is started

Parameters:
period - defines period that will be used for ticks generation. Default value Period.TICK will be used if this parameter is null
from - when to start testing process. Default value will be previous day start
to - when to stop testing process. Default value will be previous day end

downloadData

Future<?> downloadData(LoadingProgressListener loadingProgressListener)
Downloads data into the local cache. It's not necessary to download data before starting your testing process, If there is no data in local cache tester will download data while testing, this can slow down testing process significantly. Method runs asynchronously returning before the data is actually loaded. You can use ruturned future to wait for the loading process to complete

Parameters:
loadingProgressListener - listener to control downloading process

startStrategy

long startStrategy(IStrategy strategy,
                   LoadingProgressListener testerProgressListener)
                   throws IllegalStateException,
                          NullPointerException
Starts the strategy

Parameters:
strategy - strategy to run
testerProgressListener - provides progress information, allows to cancel strategy
Returns:
returns process id assigned to the strategy
Throws:
IllegalStateException - if not connected
NullPointerException - if one of the parameters is null

startStrategy

long startStrategy(IStrategy strategy,
                   IStrategyExceptionHandler exceptionHandler,
                   LoadingProgressListener testerProgressListener)
                   throws IllegalStateException,
                          NullPointerException
Starts the strategy

Parameters:
strategy - strategy to run
exceptionHandler - if not null then passed exception handler will be called when strategy throws exception
testerProgressListener - provides progress information, allows to cancel strategy
Returns:
returns process id assigned to the strategy
Throws:
IllegalStateException - if not connected
NullPointerException - if one of the parameters is null

setGatherReportData

void setGatherReportData(boolean gatherReportData)
Set to true to tell the tester to gather report data. Default value is false. Changing this value will take effect only if called before testing process is started

Parameters:
gatherReportData - true to gather report data

getGatherReportData

boolean getGatherReportData()
Returns true if tester is set to gather report data

Returns:
true if report data will be gathered

setEventLogEnabled

void setEventLogEnabled(boolean eventLogEnabled)
If true then event log information will be collected when strategy is run. Event log eats some memory and should be disabled if not needed. Default value is false. Changing this value will take effect only if called before testing process is started

Parameters:
eventLogEnabled - true to enable event log

getEventLogEnabled

boolean getEventLogEnabled()
Returns true if event log enabled

Returns:
true if event log enabled

setProcessingStatsEnabled

void setProcessingStatsEnabled(boolean processingStats)
If true then the tester will collect statistics about processing time in different subsystems. Collecting information slows down the testing process and should be enabled only when needed. Default value is false Changing this value will take effect only if called before testing process is started

Parameters:
processingStats - if true then processing statistics will be collected by the tester

getProcessingStats

boolean getProcessingStats()
Returns true if processing stats enabled

Returns:
true if processing stats enabled

createReport

void createReport(File file)
                  throws IOException,
                         IllegalStateException
Deprecated. use createReport(long, File) instead

Throws:
IOException
IllegalStateException
See Also:
createReport(long, File)

createReport

void createReport(long processId,
                  File file)
                  throws IOException,
                         IllegalStateException
Will create and write report into the given file. This method should be called after testing process is complete, otherwise it will throw an exception

Parameters:
processId - process id assigned to the strategy
file - file where to save report
Throws:
IOException - if file cannot be written
IllegalStateException - when there is not report data available

setInitialDeposit

void setInitialDeposit(Currency currency,
                       double deposit)
                       throws IllegalArgumentException
Sets initial deposit amount and currency. The last parameter will affect commission calculation. Changing this values will take effect only if called before testing process is started

Parameters:
currency - deposit currency. Must be one of the accepted currencies for deposit. Default value USD
deposit - deposit amount. Default 50,000
Throws:
IllegalArgumentException - if currency is not one of accepted currencies for deposits

getInitialDeposit

double getInitialDeposit()
Returns initial deposit

Returns:
initial deposit

getInitialDepositCurrency

Currency getInitialDepositCurrency()
Return deposit currency

Returns:
deposit currency

setLeverage

void setLeverage(int leverage)
Sets leverage. Default value is 100. Changing this value will take effect only if called before testing process is started

Parameters:
leverage - leverage

getLeverage

int getLeverage()
Returns leverage

Returns:
leverage

setCommissions

void setCommissions(Commissions commissions)
Sets the commissions information. If left untouched or new Commissions(false) object is passed, the commission will be calculated as described in Commission Policy document using "Deposit with Dukascopy" column values. Changing this value will take effect only if called before testing process is started

Parameters:
commissions - commission in usd per 1mil

getCommissions

Commissions getCommissions()
Returns Commissions object filled with limits and corresponding commissions for deposit, equity and turnover amounts

Returns:
Commissions object

setOvernights

void setOvernights(Overnights overnights)
Sets the overnight vales. If left untouched or new Overnights(false) object is passed, the default overnights will be used Changing this value will take effect only if called before testing process is started

Parameters:
overnights - commission in usd per 1mil

getOvernights

Overnights getOvernights()
Returns Overnights object

Returns:
Overnights object

setMarginCutLevel

void setMarginCutLevel(int mcLevel)
Sets level in percents, exceeding which the system will start margin cut procedure reducing use of leverage. Default value is 200. Changing this value will take effect only if called before testing process is started

Parameters:
mcLevel - margin cut level

getMarginCutLevel

int getMarginCutLevel()
Returns margin cut level in percents

Returns:
margin cut level

setMCEquity

void setMCEquity(double mcEquity)
Sets minimum equity amount. If actual equity becomes less than minimum equity set by this method, then all positions will be merged, closed and all pending orders will be canceled. Default value is 0. Changing this value will take effect only if called before testing process is started

Parameters:
mcEquity - minimum equity amount

getMCEquity

double getMCEquity()
Returns minimum equity amount

Returns:
minimum equity amount


Copyright © 2011. All Rights Reserved.