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.

ERROR AbstractHTFlowDataCreator - Wrong parameters
 Post subject: ERROR AbstractHTFlowDataCreator - Wrong parameters Post rating: 0   New post Posted: Sat 08 Jun, 2013, 20:22 
User avatar

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

I have some issues with in the latest SDK with the following line:
client.setDataInterval(DataLoadingMethod.ALL_TICKS, dateFrom.getTime(), dateTo.getTime());


If I have this line, I got the following error:
ERROR AbstractHTFlowDataCreator - Wrong parameters: EUR/USD / 1293840000000, -9223372036854775808 / com.dukascopy.dds2.greed.agent.strategy.tester.dataload.HistoricalTesterDataManager$1@28ee5194
java.lang.IllegalArgumentException: Wrong parameters: EUR/USD / 1293840000000, -9223372036854775808 / com.dukascopy.dds2.greed.agent.strategy.tester.dataload.HistoricalTesterDataManager$1@28ee5194
   at com.dukascopy.charts.data.datacache.LoadDataAction.<init>(LoadDataAction.java:136)
   at com.dukascopy.charts.data.datacache.FeedDataProvider.getLoadTicksDataAction(FeedDataProvider.java:1141)
   at com.dukascopy.charts.data.datacache.FeedDataProvider.createCustomTicksLoadingAction(FeedDataProvider.java:2454)
   at com.dukascopy.charts.data.datacache.FeedDataProvider.loadCustomTicksSynched(FeedDataProvider.java:2417)
   at com.dukascopy.dds2.greed.agent.strategy.tester.dataload.AbstractHTFlowDataCreator.performDataLoad(AbstractHTFlowDataCreator.java:155)
   at com.dukascopy.dds2.greed.agent.strategy.tester.dataload.AbstractHTFlowDataCreator.run(AbstractHTFlowDataCreator.java:131)
   at java.lang.Thread.run(Unknown Source)


I am doing some test with the latest SDK as a Maven project in Eclipse, as described in the wiki.
This is the TesterMain class:
public class TesterMain {
    private static final Logger LOGGER = LoggerFactory.getLogger(Main.class);

    private static String jnlpUrl = "https://www.dukascopy.com/client/demo/jclient/jforex.jnlp";
    private static String userName = "username";
    private static String password = "password";
    static int     reportNr = 1;
   
    public static void main(String[] args) throws Exception {
       Locale.setDefault(new Locale("en", "US"));
       //set date format
       final SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
       dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
       final SimpleDateFormat reportDateFormat = new SimpleDateFormat("ddMMyyyy_HHmm");       
       reportDateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
       Date dateFrom = dateFormat.parse("01/01/2011 00:00:00");
       Date dateTo = dateFormat.parse("02/01/2011 00:00:00");       
        //get the instance of the IClient interface
        final ITesterClient client = TesterFactory.getDefaultInstance();
        //set cache path
        File cacheDir = new File("E:\\work\\JForex\\cache\\.cache");       
        //set the listener that will receive system events
        client.setSystemListener(new ISystemListener() {
            @Override
            public void onStart(long processId) {
                LOGGER.info("Strategy started: " + processId);
            }

            @Override
            public void onStop(long processId) {
                LOGGER.info("Strategy stopped: " + processId);
                File reportFile = new File("E:\\work\\JForex\\Messages\\report_" + reportDateFormat.format(new Date()) + "_" + reportNr++ + ".html");
                try {
                    client.createReport(processId, reportFile);
                } catch (Exception e) {
                    LOGGER.error(e.getMessage(), e);
                }
                if (client.getStartedStrategies().size() == 0) {
                    System.exit(0);
                }
            }

            @Override
            public void onConnect() {
                LOGGER.info("Connected");
            }

            @Override
            public void onDisconnect() {
                //tester doesn't disconnect
            }
        });

        LOGGER.info("Connecting...");
        //connect to the server using jnlp, user name and password
        //connection is needed for data downloading
        client.connect(jnlpUrl, userName, password);

        //wait for it to connect
        int i = 10; //wait max ten seconds
        while (i > 0 && !client.isConnected()) {
            Thread.sleep(1000);
            i--;
        }
        if (!client.isConnected()) {
            LOGGER.error("Failed to connect Dukascopy servers");
            System.exit(1);
        }

        //set instruments that will be used in testing
        Set<Instrument> instruments = new HashSet<Instrument>();
        instruments.add(Instrument.EURUSD);
        LOGGER.info("Subscribing instruments...");
        client.setSubscribedInstruments(instruments);
        //setting initial deposit
        client.setInitialDeposit(Instrument.EURUSD.getSecondaryCurrency(), 50000);
        //set period
        client.setDataInterval(DataLoadingMethod.ALL_TICKS, dateFrom.getTime(), dateTo.getTime());
        client.setCacheDirectory(cacheDir);
        //load data
        LOGGER.info("Downloading data");
        Future<?> future = client.downloadData(null);
        //wait for downloading to complete
        future.get();
       
        //workaround for LoadNumberOfCandlesAction for JForex-API versions > 2.6.64
        Thread.sleep(5000);
       
        //start the strategy
        LOGGER.info("Starting strategy");
        client.startStrategy(new MA_Play(), new LoadingProgressListener() {
            @Override
            public void dataLoaded(long startTime, long endTime, long currentTime, String information) {
                LOGGER.info(information);
            }

            @Override
            public void loadingFinished(boolean allDataLoaded, long startTime, long endTime, long currentTime) {
            }

            @Override
            public boolean stopJob() {
                return false;
            }
        });
        //now it's running
    }
}


What`s wrong with my from and to parameters? The above code was working fine with a previous (2.7.7) SDK version.


 
The Best Answer  Post subject: Re: ERROR AbstractHTFlowDataCreator - Wrong parameters Post rating: 1   New post Posted: Sun 09 Jun, 2013, 13:55 
User avatar

User rating: 70
Joined: Sat 22 Sep, 2012, 17:43
Posts: 118
Location: Brazil, Fortaleza, Ceará
Have a go with from = 02/01/2011 and to = 03/01/2011 and report back.

01/01/2011 00:00:00 is a Saturday morning.


 
 Post subject: Re: ERROR AbstractHTFlowDataCreator - Wrong parameters Post rating: 0   New post Posted: Tue 11 Jun, 2013, 21:18 
User avatar

User rating: 164
Joined: Mon 08 Oct, 2012, 10:35
Posts: 676
Location: NetherlandsNetherlands
You`ve nailed it!

Thanks!


 

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