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

tick latency
http://www.dukascopy.com/swiss/english/forex/jforex/forum/viewtopic.php?f=65&t=43968
Page 1 of 1

Author:  cb888trader [ Mon 28 Nov, 2011, 06:03 ]
Post subject:  tick latency

hi,

I did a small test in order to evaluate the latency between the tick's timestamp and the current time on my system.

here is the calculation that I performed in my strategy's onTick method-

System.currentTimeMillis() - tick.getTime()


to my surprise - the results show a 46+ seconds delay between the registered tick's time and the current time.

If that is the case - I'm trading the market almost a minute into the past...

One reason might be related to DEMO servers. In Live Account could it be different??

Am I missing something?

edit: my ping time to dukascopy is roughly around 80-90 ms so I don't think it is a network issue.

Author:  API Support [ Mon 28 Nov, 2011, 08:38 ]
Post subject:  Re: tick latency

We tested both JForex client and the latest standalone with the following strategy:
package jforex.test;

import com.dukascopy.api.*;

public class TickLatency implements IStrategy{
   IConsole console;
   
   public void onStart(IContext context) throws JFException {
      console = context.getConsole();      
   }
   
   public void onTick(Instrument instrument, ITick tick) throws JFException {
      if(instrument != Instrument.EURUSD){
         return;
      }      
      console.getOut().println((tick.getTime() - System.currentTimeMillis()) + " tick: " +tick );      
   }

   public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {}
   public void onMessage(IMessage message) throws JFException {}
   public void onAccount(IAccount account) throws JFException {}
   public void onStop() throws JFException {}
}
The tick delay in JForex client ranged from 0.1 to 0.3 seconds and in Standalone - from 0.07 to 0.15 seconds. With which JForex API version and what instruments did you obtain such results?

Author:  cb888trader [ Mon 28 Nov, 2011, 09:07 ]
Post subject:  Re: tick latency

I tested it on EUR/USD Range Bar Chart
JForex Client ver 2.13..32 (API ver 2.6.38)

Edit: just compiled and run your above example and this is the result:


08:12:27 -46182 tick: 1322467900968[2011-11-28 08:11:40.968+0000] / 1.32921 / 1.32916
08:12:26 -46178 tick: 1322467899977[2011-11-28 08:11:39.977+0000] / 1.32917 / 1.3291
08:12:24 -46174 tick: 1322467898217[2011-11-28 08:11:38.217+0000] / 1.32919 / 1.32911
08:12:24 -46173 tick: 1322467898106[2011-11-28 08:11:38.106+0000] / 1.32917 / 1.32909
08:12:24 -46135 tick: 1322467897886[2011-11-28 08:11:37.886+0000] / 1.32918 / 1.32911
08:12:23 -46163 tick: 1322467897337[2011-11-28 08:11:37.337+0000] / 1.32917 / 1.3291


like I said 46+ second delay. Any clue??

Author:  API Support [ Mon 28 Nov, 2011, 09:09 ]
Post subject:  Re: tick latency

Could you please provide a sample strategy which replicates the issue?

Author:  cb888trader [ Mon 28 Nov, 2011, 09:13 ]
Post subject:  Re: tick latency

Edit: just compiled and run your above example and this is the result:


08:12:27 -46182 tick: 1322467900968[2011-11-28 08:11:40.968+0000] / 1.32921 / 1.32916
08:12:26 -46178 tick: 1322467899977[2011-11-28 08:11:39.977+0000] / 1.32917 / 1.3291
08:12:24 -46174 tick: 1322467898217[2011-11-28 08:11:38.217+0000] / 1.32919 / 1.32911
08:12:24 -46173 tick: 1322467898106[2011-11-28 08:11:38.106+0000] / 1.32917 / 1.32909
08:12:24 -46135 tick: 1322467897886[2011-11-28 08:11:37.886+0000] / 1.32918 / 1.32911
08:12:23 -46163 tick: 1322467897337[2011-11-28 08:11:37.337+0000] / 1.32917 / 1.3291


like I said 46+ second delay. Any clue??

Author:  API Support [ Mon 28 Nov, 2011, 09:50 ]
Post subject:  Re: tick latency

It looks as if your pc clock were ~46 secs off. Could you please run the strategy and meanwhile change your pc clock time?

Author:  cb888trader [ Mon 28 Nov, 2011, 10:44 ]
Post subject:  Re: tick latency

yes - that was the case. So how do I sync my computer time? I know that there are a few methods but I was wondering if you have any recommendations?

Author:  API Support [ Mon 28 Nov, 2011, 10:48 ]
Post subject:  Re: tick latency

Nothing in particular

  Page 1 of 1