Dukascopy Support Board
http://www.dukascopy.com/swiss/english/forex/jforex/forum/

ITesterClient using multiple accounts
http://www.dukascopy.com/swiss/english/forex/jforex/forum/viewtopic.php?f=65&t=35436
Page 1 of 1

Author:  gururise [ Thu 02 Jun, 2011, 17:33 ]
Post subject:  ITesterClient using multiple accounts

Hi,

I would like to run multiple strategies simultaneously in ITesterClient. It seems this is possible via:
for (int i=0;i<10;i++) {
   ITesterClient.startStrategy(strategy[i]);
}


I thought perhaps instantiating several ITesterClient instances would work, however, it seems ITesterClient must be a singleton, and that there can only be one. Any suggestions?

Author:  API Support [ Thu 09 Jun, 2011, 10:00 ]
Post subject:  Re: ITesterClient running multiple strategies

gururise wrote:
it seems ITesterClient must be a singleton, and that there can only be one.
That is the case. In fact the javadoc for ClientFactory.getDefaultClient states "Returns default instance of Dukascopy IClient. Instance is created only once, each call will return the same instance".
gururise wrote:
Any suggestions?
You might consider running a separate process for each account. The steps could be the following:
    1) Modify your code, which works with ITesterClient, such that it takes as arguments username and password.
    2) Export your project to a jar file.
    3) Make a bat file for each account which executes the jar file, for instance:
    cd C:\temp
    java -jar JforexMain.jar username1 password1
    4) Make a bat file which executes in parallel account bat files, for instance:
    start "account 1" "C:\temp\RunAccount1.bat"
    start "account 2" "C:\temp\RunAccount2.bat"
    5) Execute the bat file of 4).


Attachments:
MultipleAccountLaunchingExampleSmall.rar [3.27 KiB]
Downloaded 1395 times

Author:  Isak [ Thu 19 Jun, 2014, 08:31 ]
Post subject:  Re: ITesterClient using multiple accounts

gururise, the API seems to have been designed top-down as a component of their JForex Client rather than bottom-up as a flexible API. I tried running backtests as part of a strategy decision-making algorithm once, assuming that IClient instances (and the singleton ITesterClient instance) are independent objects, only to discover that they have undocumented side-effects on each other, seemingly arising from some shared state between them. I hope Dukascopy can add to their documentation what state exactly is shared between which classes.

  Page 1 of 1