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.

IEngine.RunMode vs. @RequiresFullAccess
 Post subject: IEngine.RunMode vs. @RequiresFullAccess Post rating: 0   New post Posted: Wed 15 Jul, 2015, 12:37 
User avatar

User rating: 164
Joined: Mon 08 Oct, 2012, 10:35
Posts: 676
Location: NetherlandsNetherlands
Dear Support,

I need some tips about how to prepare a strategy to able to discover if it is running Local or Remote?
If it runs Local, it has to write data to an output file.
If it runs Remote, it is not possible to write to a file, so the file output functions must be not executed.

I know about IEngine.RunMode(), so technically we should be able to discover the platform type, and allow/disallow the file writing functions.

The problem is that the strategy definition starts with
...
@RequiresFullAccess
public class MyStrategy implements IStrategy {
...


And this @RequiresFullAccess gives troubles under Remote mode.

Is the place of this @RequiresFullAccess line must be the 1st line before the strategy's class definition? Or I could move this line into the onStart() function, and call it after context.getEngine() was called.


Or what else could I do?

As I said, I want the same strategy to be used, no matter where it is running.


 
 Post subject: Re: IEngine.RunMode vs. @RequiresFullAccess Post rating: 0   New post Posted: Wed 15 Jul, 2015, 13:10 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
One option would be to use JForex SDK
https://www.dukascopy.com/wiki/#JForex_SDK

Strategies can be started remotely with the help of IClient.getRemoteStrategyManager()
Two strategies can be created. One would hold all the functionality.
The other would extend first one and include @RequiresFullAccess annotation.

public StrategyRemote implements IStrategy {}

@RequiresFullAccess
public StrategyLocal extends StrategyRemote  {}


 
 Post subject: Re: IEngine.RunMode vs. @RequiresFullAccess Post rating: 0   New post Posted: Wed 15 Jul, 2015, 14:01 
User avatar

User rating: 164
Joined: Mon 08 Oct, 2012, 10:35
Posts: 676
Location: NetherlandsNetherlands
Dear Support,

Thanks for the fast follow-up!

I am not sure if I follow your logic properly, so bare with me a bit more...
Does this mean that two separate strategies will be created?
Remote version, without output creation
Local version, extending the remote version with output creation

This means 2 separate files, one for the remote run and one for locally.


Or rather create a big, 'container' strategy that will be responsible for instantiating the appropriate strategy type (remote, local) upon detecting the engine.RunMode()?

I prefer not to use the SDK to create an application/strategy that will be responsible to start the remote strategy. I would like to have a strategy file, that can be started remotely, or locally, or even in the Historical tester.


 
 Post subject: Re: IEngine.RunMode vs. @RequiresFullAccess Post rating: 0   New post Posted: Wed 15 Jul, 2015, 15:22 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
If SDK is not used then the easiest way would be to keep 2 separate files - one for remote, one for local run.


 

Jump to:  

cron
  © 1998-2025 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