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 backtesting ERROR AbstractHTFlowDataCreator - to(2014-09-07 19:47:59:999) > last tick time (292269055-12-0
 Post subject: ITesterClient backtesting ERROR AbstractHTFlowDataCreator - to(2014-09-07 19:47:59:999) > last tick time (292269055-12-0 Post rating: 0   New post Posted: Fri 17 Oct, 2014, 09:34 
User avatar

User rating: 1
Joined: Mon 27 Jan, 2014, 14:03
Posts: 7
Location: TaiwanTaiwan
If I commented this line, that error would disapear.
client.setDataInterval(Period.ONE_HOUR, OfferSide.ASK, InterpolationMethod.FOUR_TICKS, from, to); 


Why did I get this strange last tick time (292269055-12-02 16:47:04:192)?

2014-10-17 15:51:26.079 ERROR AbstractHTFlowDataCreator - to(2014-09-07 19:47:59:999) > last tick time (292269055-12-02 16:47:04:192 -9223372036854775808)
java.lang.IllegalArgumentException: to(2014-09-07 19:47:59:999) > last tick time (292269055-12-02 16:47:04:192 -9223372036854775808)
   at com.dukascopy.charts.data.datacache.customticks.AbstractLoadCustomTicksFromCandlesAction.validateFromTo(AbstractLoadCustomTicksFromCandlesAction.java:65)
   at com.dukascopy.charts.data.datacache.customticks.AbstractLoadCustomTicksFromCandlesAction.<init>(AbstractLoadCustomTicksFromCandlesAction.java:59)
   at com.dukascopy.charts.data.datacache.customticks.LoadCloseTicksAction.<init>(LoadCloseTicksAction.java:36)
   at com.dukascopy.charts.data.datacache.FeedDataProvider.createCustomTicksLoadingAction(FeedDataProvider.java:2602)
   at com.dukascopy.charts.data.datacache.FeedDataProvider.loadCustomTicksSynched(FeedDataProvider.java:2564)
   at com.dukascopy.dds2.greed.agent.strategy.tester.dataload.AbstractHTFlowDataCreator.performDataLoad(AbstractHTFlowDataCreator.java:147)
   at com.dukascopy.dds2.greed.agent.strategy.tester.dataload.AbstractHTFlowDataCreator.loadNextDataChunk(AbstractHTFlowDataCreator.java:137)
   at com.dukascopy.dds2.greed.agent.strategy.tester.dataload.HTCandlesCreator.loadNextDataChunk(HTCandlesCreator.java:171)
   at com.dukascopy.dds2.greed.agent.strategy.tester.dataload.HistoricalTesterDataManager$1.run(HistoricalTesterDataManager.java:193)
   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
   at java.util.concurrent.FutureTask.run(FutureTask.java:266)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
   at java.lang.Thread.run(Thread.java:745)


package jforex.main;

import java.io.File;
import java.util.HashSet;

import com.dukascopy.api.*;
import com.dukascopy.api.system.*;
import com.dukascopy.api.system.ITesterClient.*;

import strategies.XOverTrade.XOverAgent;

class TradeAccount {
   // url of the DEMO jnlp
   private String jnlpUrl;
   // user name
   private String userName;
   // password
   private String password;

   public IClient client = null;
   private Long strategyID = new Long(0);

   TradeAccount(String jnlpUrl, String userName, String password) {
      this.jnlpUrl = jnlpUrl;
      this.userName = userName;
      this.password = password;
      while (true) {
         try {
            if (client == null)
               client = ClientFactory.getDefaultInstance();
            break;
         } catch (Exception e) {
            client = null;
         }
      }
   }

   public void run(final IStrategy strategy) {
      new Thread() {
         @Override
         public void run() {
            while (true) {
               try {
                  Thread.sleep(5000);
               } catch (InterruptedException e) {

               }

               if (!client.isConnected())
                  conn();

               if (client.isConnected()
                     && (!client.getStartedStrategies().containsKey(
                           strategyID))) {
                  strategyID = client.startStrategy(strategy);
               }
            }
         }
      }.start();
   }

   void conn() {
      // connect to the server using jnlp, user name and password
      while (true) {
         try {
            Thread.sleep(5000);
         } catch (InterruptedException e) {
         }
         try {
            client.connect(jnlpUrl, userName, password);
            break;
         } catch (Exception e) {

         }
      }
      // wait for it to connect
      int i = 10; // wait max ten seconds
      while (i > 0 && !client.isConnected()) {
         try {
            Thread.sleep(1000);
         } catch (InterruptedException e) {

         }
         i--;
      }
      if (!client.isConnected())
         client.disconnect();
   }
}

class TestAccount {
   // url of the DEMO jnlp
   private String jnlpUrl;
   // user name
   private String userName;
   // password
   private String password;

   public ITesterClient client = null;

   TestAccount(String jnlpUrl, String userName, String password) {
      this.jnlpUrl = jnlpUrl;
      this.userName = userName;
      this.password = password;
      while (true) {
         try {
            if (client == null)
               client = TesterFactory.getDefaultInstance();
            break;
         } catch (Exception e) {
            client = null;
         }
      }
   }

   void conn() {
      // connect to the server using jnlp, user name and password
      while (true) {
         try {
            Thread.sleep(5000);
         } catch (InterruptedException e) {
         }
         try {
            client.connect(jnlpUrl, userName, password);
            break;
         } catch (Exception e) {

         }
      }
      // wait for it to connect
      int i = 10; // wait max ten seconds
      while (i > 0 && !client.isConnected()) {
         try {
            Thread.sleep(1000);
         } catch (InterruptedException e) {

         }
         i--;
      }
      if (!client.isConnected())
         client.disconnect();
   }

   void run(final IStrategy strategy) {

      class SL implements ISystemListener {

         @Override
         public void onStart(long processId) {
         }

         @Override
         public void onStop(long processId) {
            File reportFile = new File("/home/t3485/strategyReport/" + processId
                  + ".html");
            try {
               client.createReport(processId, reportFile);
            } catch (Exception e) {
               e.printStackTrace();
            }
            if (client.getStartedStrategies().size() == 0) {
               System.exit(0);
            }
         }

         @Override
         public void onConnect() {
         }

         @Override
         public void onDisconnect() {
         }
      };

      client.setInitialDeposit(JFCurrency.getInstance("EUR"), 100);
      client.setLeverage(100);
      client.setMCEquity(20);
      client.setMarginCutLevel(200);
      client.setSystemListener(new SL());

      long day = 1000 * 60 * 60 * 24;
      long to = System.currentTimeMillis() - day;
      long from = to - 30 * day;

      //HashSet<Instrument> ins = new HashSet<Instrument>();
      //ins.add(Instrument.EURJPY);
      //client.setSubscribedInstruments(ins);
      client.setDataInterval(Period.ONE_HOUR, OfferSide.ASK, InterpolationMethod.FOUR_TICKS, from, to);
      
      client.startStrategy(strategy);
   }
}

public class Main {
   public static void main(String[] args) throws Exception {

      String jnlp = "https://www.dukascopy.com/client/%s/jclient/jforex.jnlp";
      String username = "";
      String password = "";

      if (args.length >= 3) {
         jnlp = String.format(jnlp, args[0]);
         username = args[1];
         password = args[2];
      } else {
         jnlp = "https://www.dukascopy.com/client/live/jclient/jforex.jnlp";
         username = "ABCD";
         password = "DEFG";
/*
         jnlp = "https://www.dukascopy.com/client/demo/jclient/jforex.jnlp";
         username = "DEMO10037uZkNHEU";
         password = "uZkNH";
*/
      }
      if (username == "" || password == "") {
         System.out.println("Examples:");
         System.out
               .println("java -jar EvolvingRuleTrader.jar live YourUsername YourPassword");
         System.out
               .println("java -jar EvolvingRuleTrader.jar demo YourUsername YourPassword");
      }

      TestAccount tdac = new TestAccount(jnlp, username, password);
      tdac.conn();

      tdac.run(new XOverAgent());
   }
}


 
 Post subject: Re: ITesterClient backtesting ERROR AbstractHTFlowDataCreator - to(2014-09-07 19:47:59:999) > last tick time (292269055-12-0 Post rating: 0   New post Posted: Tue 21 Oct, 2014, 15:12 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
We are going to investigate this.

It would be really helpful, if you can provide sdk application + strategy pair, that replicates the case. If you don't want to post it here, then you can send it to [email protected] email.


 

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