Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

ITesterClient using multiple accounts
 Post subject: ITesterClient using multiple accounts Post rating: 0   New post Posted: Thu 02 Jun, 2011, 17:33 
User avatar

User rating: 0
Joined: Fri 27 May, 2011, 18:24
Posts: 2
Location: US
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?


 
 Post subject: Re: ITesterClient running multiple strategies Post rating: 0   New post Posted: Thu 09 Jun, 2011, 10:00 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
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 1382 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
 Post subject: Re: ITesterClient using multiple accounts Post rating: 0   New post Posted: Thu 19 Jun, 2014, 08:31 
User avatar

User rating: 6
Joined: Thu 19 May, 2011, 11:14
Posts: 235
Location: South Africa,
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.


 

Jump to:  

cron
  © 1998-2024 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com