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.

tick latency
 Post subject: tick latency Post rating: 0   New post Posted: Mon 28 Nov, 2011, 06:03 

User rating: 0
Joined: Tue 22 Nov, 2011, 12:47
Posts: 130
Location: United States,
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.


 
 Post subject: Re: tick latency Post rating: 0   New post Posted: Mon 28 Nov, 2011, 08:38 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
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?


 
 Post subject: Re: tick latency Post rating: 0   New post Posted: Mon 28 Nov, 2011, 09:07 

User rating: 0
Joined: Tue 22 Nov, 2011, 12:47
Posts: 130
Location: United States,
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??


 
 Post subject: Re: tick latency Post rating: 0   New post Posted: Mon 28 Nov, 2011, 09:09 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Could you please provide a sample strategy which replicates the issue?


 
 Post subject: Re: tick latency Post rating: 0   New post Posted: Mon 28 Nov, 2011, 09:13 

User rating: 0
Joined: Tue 22 Nov, 2011, 12:47
Posts: 130
Location: United States,
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??


 
 Post subject: Re: tick latency Post rating: 0   New post Posted: Mon 28 Nov, 2011, 09:50 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
It looks as if your pc clock were ~46 secs off. Could you please run the strategy and meanwhile change your pc clock time?


 
 Post subject: Re: tick latency Post rating: 0   New post Posted: Mon 28 Nov, 2011, 10:44 

User rating: 0
Joined: Tue 22 Nov, 2011, 12:47
Posts: 130
Location: United States,
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?


 
 Post subject: Re: tick latency Post rating: 0   New post Posted: Mon 28 Nov, 2011, 10:48 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Nothing in particular


 

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