Dukascopy
 
 
Wiki JStore Search Login

Volume data inconsistent in historic data / live data
 Post subject: Volume data inconsistent in historic data / live data Post rating: 0   New post Posted: Sun 20 Nov, 2011, 22:52 
User avatar

User rating: 0
Joined: Sun 20 Nov, 2011, 22:34
Posts: 10
Hi,

I'm having troubles with volume data. While my application is running, and receiving new bars that it registered to receive, the volume reported in those bars (or the volume reported for those just finished bars via history.getBar() with shift 1), is far lower than when I get when I exit the program, delete all cache data, restart the program and get the very same bar from the history.

The volume values are up to 50% lower, while open, high and close are mostly identical. But I have had cases too where also open, high, low or close were different from the bar that was reported in the onBar method and the one that I get out of the history with a just cleaned cache.

To me it seems that the volume is calculated from all the ticks received in the Bars period and if ticks get lost due to network congestures, that the total volume of a bar is saved wrong in the local cache. Then when the application is started on an emptied cache, all data is re-loaded from the server and thus correct. Can somebody maybe confirm this assumption?

Steps to reproduce:
1. Run the WebStart application, and watch one instrument for 10min and then wait until the next 10min bar is closed. Check what volume gets reported for the now closed bar.
2. Exit the program and delete all cached data
3. Restart the program and load that same instrument. You will notice that the volume of the bar that you just watched close will be reported as MUCH higher.

Is there a way to work around this problem? Can I somehow delete all data of an instrument of the last n-minutes to force a reload from the server without having to restart my application?

And I think the problem was already reported before in this thread

viewtopic.php?f=5&t=1648

but not answered correctly.

Thanks for any help on this issue I've been fighting with for quite some time.

With kind regards

Moritz


 
 Post subject: Re: Volume data inconsistent in historic data / live data Post rating: 0   New post Posted: Mon 21 Nov, 2011, 09:04 
User avatar

User rating: 0
Joined: Sun 20 Nov, 2011, 22:34
Posts: 10
Additional information,

I wrote a little demo strategy that displays bar information every 10 minutes.

This is the code

public void onBar(Instrument instrument, Period period,
               OfferSide offerSide, IBar bar)
   {

      System.out.println("-----------------------------");
      LOGGER.info("New bar " + instrument + " period " + period
               + " offerSide " + offerSide + " bar " + bar);

      try
      {

         for (int i = 1; i < 3; i++)
         {
            IBar bars = context.getHistory().getBar(instrument, period,
               offerSide, i);
            LOGGER.info("history  " + i + "  " + bars);

            List<ITick> ticks = context.getHistory().getTicks(instrument,
               bars.getTime(), bars.getTime() + 600000l);
            double vol = 0;
            for (ITick tick : ticks)
            {
               vol += tick.getAskVolume();
            }

            LOGGER.info("total volume from ticks " + vol
                     + " number of ticks " + ticks.size());

         }
      }
      catch (JFException e)
      {
         e.printStackTrace();
      }

   }


And this is the output I get when running this strategy for 20min. I've marked the values in same color that I would assume to be identical.


2011-11-21 08:10:06.086 INFO BarWaiter - New bar EUR/CHF period 10 Mins offerSide Ask bar 1321858800000[2011-11-21 07:00:00.000+0000] O: 1.23881 C: 1.23961 H: 1.23979 L: 1.23881 V: 589.65
2011-11-21 08:10:07.024 INFO BarWaiter - history 1 1321858800000[2011-11-21 07:00:00.000+0000] O: 1.23881 C: 1.23961 H: 1.23979 L: 1.23881 V: 397.25
2011-11-21 08:10:07.112 INFO BarWaiter - total volume from ticks 372.91999999999996 number of ticks 238
2011-11-21 08:10:07.191 INFO BarWaiter - history 2 1321858200000[2011-11-21 06:50:00.000+0000] O: 1.2389 C: 1.23882 H: 1.23908 L: 1.23877 V: 474.0
2011-11-21 08:10:07.531 INFO BarWaiter - total volume from ticks 477.98999999999995 number of ticks 298
-----------------------------
2011-11-21 08:20:06.378 INFO BarWaiter - New bar EUR/CHF period 10 Mins offerSide Ask bar 1321859400000[2011-11-21 07:10:00.000+0000] O: 1.23964 C: 1.23939 H: 1.23987 L: 1.23927 V: 532.4
2011-11-21 08:20:12.416 INFO BarWaiter - history 1 1321859400000[2011-11-21 07:10:00.000+0000] O: 1.23964 C: 1.23939 H: 1.23987 L: 1.23927 V: 581.9
2011-11-21 08:20:12.417 INFO BarWaiter - total volume from ticks 532.4 number of ticks 314
2011-11-21 08:20:12.417 INFO BarWaiter - history 2 1321858800000[2011-11-21 07:00:00.000+0000] O: 1.23881 C: 1.23961 H: 1.23979 L: 1.23881 V: 372.65
2011-11-21 08:20:12.418 INFO BarWaiter - total volume from ticks 372.91999999999996number of ticks 238
-----------------------------
2011-11-21 08:30:06.260 INFO BarWaiter - New bar EUR/CHF period 10 Mins offerSide Ask bar 1321860000000[2011-11-21 07:20:00.000+0000] O: 1.23937 C: 1.23966 H: 1.2402 L: 1.23929 V: 625.1
2011-11-21 08:30:08.964 INFO BarWaiter - history 1 1321860000000[2011-11-21 07:20:00.000+0000] O: 1.23937 C: 1.23966 H: 1.2402 L: 1.23929 V: 648.1
2011-11-21 08:30:08.966 INFO BarWaiter - total volume from ticks 625.1 number of ticks 334
2011-11-21 08:30:08.966 INFO BarWaiter - history 2 1321859400000[2011-11-21 07:10:00.000+0000] O: 1.23964 C: 1.23939 H: 1.23987 L: 1.23927 V: 532.4
2011-11-21 08:30:08.967 INFO BarWaiter - total volume from ticks 532.4 number of ticks 314


The different values for volume depending on where the bar is retrieved is already very strange.
But If I clear the cache and restart the program, the values are even more out of sync.


-----------------------------
2011-11-21 08:40:05.368 INFO BarWaiter - New bar EUR/CHF period 10 Mins offerSide Ask bar 1321860600000[2011-11-21 07:30:00.000+0000] O: 1.23966 C: 1.23929 H: 1.23976 L: 1.23912 V: 882.89
2011-11-21 08:40:07.344 INFO BarWaiter - history 1 1321860600000[2011-11-21 07:30:00.000+0000] O: 1.23966 C: 1.23929 H: 1.23976 L: 1.23912 V: 714.05
2011-11-21 08:40:07.495 INFO BarWaiter - total volume from ticks 666.9899999999985 number of ticks 367
2011-11-21 08:40:07.495 INFO BarWaiter - history 2 1321860000000[2011-11-21 07:20:00.000+0000] O: 1.23939 C: 1.23966 H: 1.2402 L: 1.23929 V: 986.0
2011-11-21 08:40:07.696 INFO BarWaiter - total volume from ticks 990.51 number of ticks 512

Hope this helps to get this resolved somehow.

Thanks

Moritz


 
 Post subject: Re: Volume data inconsistent in historic data / live data Post rating: 0   New post Posted: Mon 21 Nov, 2011, 15:43 
JForex Master
User avatar

User rating:
Joined: Wed 16 Sep, 2009, 18:23
Posts: 1054
Location: Geneva, Switzerland
As already mentioned before, server and cache historical bar volumes do
differ. This is the case for an intraday buffer period, after which they
match - your local cache gets synchronized with the server. For instance,
yesterday's historical volumes for 10 min bars will match, regardless if
they are read from local cache or from server.

One more reason why the DEMO intraday buffer period cash data differ from
the server data is the following. LIVE price data differ from DEMO data
until the DEMO data are reloaded from our servers. As you may know, our
system has Place BID and Place Offer orders which influence the price feed.
The orders of more than 100K are showed in the market depth, thus making the
prices and volumes on DEMO be different than in LIVE. Until you reload the
data from the Data Feed Server, where the LIVE data is stored.

Please use LIVE acount as then the current data will have no or less difference from
the price data stored on our server.


 

Jump to:  

  © 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