NexusFi: Find Your Edge


Home Menu

 





How to measure data feed latencies between continents?


Discussion in Traders Hideout

Updated
      Top Posters
    1. looks_one Koepisch with 22 posts (5 thanks)
    2. looks_two Big Mike with 18 posts (6 thanks)
    3. looks_3 artemiso with 11 posts (1 thanks)
    4. looks_4 gomi with 7 posts (21 thanks)
      Best Posters
    1. looks_one gomi with 3 thanks per post
    2. looks_two Fat Tails with 3 thanks per post
    3. looks_3 Big Mike with 0.3 thanks per post
    4. looks_4 Koepisch with 0.2 thanks per post
    1. trending_up 28,002 views
    2. thumb_up 48 thanks given
    3. group 8 followers
    1. forum 66 posts
    2. attach_file 15 attachments




 
Search this Thread

How to measure data feed latencies between continents?

  #41 (permalink)
 artemiso 
New York, NY
 
Experience: Beginner
Platform: Vanguard 401k
Broker: Yahoo Finance
Trading: Mutual funds
Posts: 1,152 since Jul 2012
Thanks Given: 784
Thanks Received: 2,685


Big Mike View Post
Just zip it first for exe. Let me know when you are ready.

Mike

Voila, ported with mingw, had to make some fixes to get it working, e.g. use some of the tools in windows.h.

Ranges about 1.8~80 ms on my VPS, averaging about 11 ms.



(See post below for revised attachment.)

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Deepmoney LLM
Elite Quantitative GenAI/LLM
ZombieSqueeze
Platforms and Indicators
Exit Strategy
NinjaTrader
Ninja Mobile Trader VPS (ninjamobiletrader.com)
Trading Reviews and Vendors
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
  #42 (permalink)
 Koepisch 
@ Germany
 
Experience: Beginner
Platform: NinjaTrader
Broker: Mirus Futures/Zen-Fire
Trading: FDAX
Posts: 569 since Nov 2011
Thanks Given: 440
Thanks Received: 518


artemiso View Post
Voila, ported with mingw, had to make some fixes to get it working, e.g. use some of the tools in windows.h.

Ranges about 1.8~80 ms on my VPS, averaging about 11 ms.


Sorry to repeat me again and again. Time measurements in windows are a complex issue. You have to code it plattform dependent to get some reliable results. The windows timer ticks with 15.6ms at default, so all SystemTime calls, Sleeps and the thread slices are aligned to that. So you aren't aware of these issues. Next issue is core swapping - you can't measure time precise when your program thread is switched between the cores.

Started this thread Reply With Quote
  #43 (permalink)
 artemiso 
New York, NY
 
Experience: Beginner
Platform: Vanguard 401k
Broker: Yahoo Finance
Trading: Mutual funds
Posts: 1,152 since Jul 2012
Thanks Given: 784
Thanks Received: 2,685



Koepisch View Post
Time measurements in windows are a complex issue. You have to code it plattform dependent to get some reliable results. The windows timer ticks with 15.6ms at default, so all SystemTime calls, Sleeps and the thread slices are aligned to that. So you aren't aware of these issues. Next issue is core swapping - you can't measure time precise when your program thread is switched between the cores.

Which is why I needed the windows header file - QueryPerformanceCounter function (Windows)

Reply With Quote
  #44 (permalink)
 Koepisch 
@ Germany
 
Experience: Beginner
Platform: NinjaTrader
Broker: Mirus Futures/Zen-Fire
Trading: FDAX
Posts: 569 since Nov 2011
Thanks Given: 440
Thanks Received: 518

@Big Mike, @artemiso: I have to mention that i'm a little bit annoyed, that the first source code isn't easily readable for no reason. For the EXE we have no source code, so we can't control how this latencies are grabbed and it's a security problem also.

Started this thread Reply With Quote
  #45 (permalink)
 
ratfink's Avatar
 ratfink 
Birmingham UK
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: TST/Rithmic
Trading: YM/Gold
Posts: 3,633 since Dec 2012
Thanks Given: 17,423
Thanks Received: 8,425


Koepisch View Post
Sorry to repeat me again and again. Time measurements in windows are a complex issue. You have to code it plattform dependent to get some reliable results. The windows timer ticks with 15.6ms at default, so all SystemTime calls, Sleeps and the thread slices are aligned to that. So you aren't aware of these issues. Next issue is core swapping - you can't measure time precise when your program thread is switched between the cores.

I think that's @artemiso's point - due to the complex interactions of Windows scheduling and any virtual hosting layer such as VMware then any average time on a VPS will be meaningless as the variability will be far larger, that's also the main message from the two articles I posted. Depending on goals it may be irrelevant to your project but cannot be ignored, important to know if variablity can cripple your strategy or whether a good average is ok.

Travel Well
Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #46 (permalink)
 artemiso 
New York, NY
 
Experience: Beginner
Platform: Vanguard 401k
Broker: Yahoo Finance
Trading: Mutual funds
Posts: 1,152 since Jul 2012
Thanks Given: 784
Thanks Received: 2,685


Koepisch View Post
@Big Mike, @artemiso: I have to mention that i'm a little bit annoyed, that the first source code isn't easily readable for no reason. For the EXE we have no source code, so we can't control how this latencies are grabbed and it's a security problem also.

I'm not a very good programmer, so I apologize if the code is incomprehensible.

I'll bow out of this thread and let you focus on the clock synchronization issues.

Reply With Quote
  #47 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,399 since Jun 2009
Thanks Given: 33,177
Thanks Received: 101,541

For fun I tried to run the EXE.

Unfortunately, no joy. I don't have gcc or g++ installed on the box and it is a requirement looks like, the EXE is not stand-alone.



Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #48 (permalink)
 Koepisch 
@ Germany
 
Experience: Beginner
Platform: NinjaTrader
Broker: Mirus Futures/Zen-Fire
Trading: FDAX
Posts: 569 since Nov 2011
Thanks Given: 440
Thanks Received: 518

Too make some further practical contribition to the VPS topic, i've contrived another test bench:

Question: How big is the delta time of an round trip when an UDP packet going into Win7 vs. Win7 on VMWare?

Using Raspberry PI (with precise clock) to alternately send a packet to Win7 and Win7VPS (on the same machine). On both systems the packet will be replied and the time of arrival (at Raspberry) will be noticed.

Started this thread Reply With Quote
Thanked by:
  #49 (permalink)
 artemiso 
New York, NY
 
Experience: Beginner
Platform: Vanguard 401k
Broker: Yahoo Finance
Trading: Mutual funds
Posts: 1,152 since Jul 2012
Thanks Given: 784
Thanks Received: 2,685


Big Mike View Post
For fun I tried to run the EXE.

Unfortunately, no joy. I don't have gcc or g++ installed on the box and it is a requirement looks like, the EXE is not stand-alone.



Mike

That's embarrassing. I think the mingw dependencies are bin\libgcc_s_dw2-1.dll and bin\libstdc++-6.dll. Added to this new zip file.

Attached Files
Elite Membership required to download: LatencyTestWin64.zip
Reply With Quote
Thanked by:
  #50 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,399 since Jun 2009
Thanks Given: 33,177
Thanks Received: 101,541



artemiso View Post
That's embarrassing. I think the mingw dependencies are bin\libgcc_s_dw2-1.dll and bin\libstdc++-6.dll. Added to this new zip file.

Yup, worked. This is a extremely simple VirtualBox 4.1.18 VM using Windows 7 x64 on Debian Wheezy, Kernel 3.13.1. It has also some charts running in the background with Sierra Chart, plus the IQFeed client. But load was small since we are after hours.



I can't speak to the other timing stuff being mentioned in the last couple of posts. Except to say that I would imagine VirtualBox on top of Debian is one of the worst ways to minimize latency inside Windows. I would imagine Hyper-V would be near best, then possibly VMWare or maybe KVM for a kernel virtualization layer.

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:




Last Updated on February 17, 2014


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts