|
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.
Historical traded volumes |
BogdanIvaniuk
|
Post subject: Historical traded volumes |
Post rating: 0
|
Posted: Wed 08 Jan, 2014, 18:22
|
|
User rating: 0
Joined: Sun 23 Oct, 2011, 22:41 Posts: 24 Location: Ukraine,
|
Hello dear support. I tried to download traded volumes data (like as indicator "Volume") via IIndicators.volume method, but received information looks like wrong or broken. I've try to download volumes data day-by-day and compare volumes amount with ticks amount. My results: MYDEBUG Downloading data for specific day: 20 Dec 2013 00:00:00 GMT MYDEBUG Ticks count in period: 56213 MYDEBUG Volumes count in period: 79198 MYDEBUG MYDEBUG Downloading data for specific day: 21 Dec 2013 00:00:00 GMT MYDEBUG Ticks count in period: 0 MYDEBUG Volumes count in period: 86400 MYDEBUG MYDEBUG Downloading data for specific day: 22 Dec 2013 00:00:00 GMT MYDEBUG Ticks count in period: 1457 MYDEBUG Volumes count in period: 86387 MYDEBUG MYDEBUG Downloading data for specific day: 23 Dec 2013 00:00:00 GMT MYDEBUG Ticks count in period: 29635 MYDEBUG Volumes count in period: 86400 MYDEBUG MYDEBUG Downloading data for specific day: 24 Dec 2013 00:00:00 GMT MYDEBUG Ticks count in period: 29624 MYDEBUG Volumes count in period: 86400 MYDEBUG MYDEBUG Downloading data for specific day: 25 Dec 2013 00:00:00 GMT MYDEBUG Ticks count in period: 9143 MYDEBUG Volumes count in period: 86399 MYDEBUG MYDEBUG Downloading data for specific day: 26 Dec 2013 00:00:00 GMT MYDEBUG Ticks count in period: 38751 MYDEBUG Volumes count in period: 86400 MYDEBUG MYDEBUG Downloading data for specific day: 27 Dec 2013 00:00:00 GMT MYDEBUG Ticks count in period: 44405 MYDEBUG Volumes count in period: 79196 MYDEBUG MYDEBUG Downloading data for specific day: 28 Dec 2013 00:00:00 GMT MYDEBUG Ticks count in period: 0 MYDEBUG Volumes count in period: 86400 MYDEBUG MYDEBUG Downloading data for specific day: 29 Dec 2013 00:00:00 GMT MYDEBUG Ticks count in period: 3033 MYDEBUG Volumes count in period: 86397 MYDEBUG MYDEBUG Downloading data for specific day: 30 Dec 2013 00:00:00 GMT MYDEBUG Ticks count in period: 37276 MYDEBUG Volumes count in period: 86400 MYDEBUG MYDEBUG Downloading data for specific day: 31 Dec 2013 00:00:00 GMT MYDEBUG Ticks count in period: 27945 MYDEBUG Volumes count in period: 79197 MYDEBUG Code: public void collectAllVolumes(IContext context) { this.history = context.getHistory(); IIndicators ii = context.getIndicators(); while (currentDate.getTime() <= stopDate.getTime()) { Date localStopDate = new Date(); localStopDate.setTime(currentDate.getTime() + 1 * 24 * 60 * 60 * 1000 - 1);
System.out.println("Collecting start");
List<ITick> ticks = null; double[] volumes = null; try { ticks = history.getTicks(instrument, currentDate.getTime(), localStopDate.getTime()); volumes = ii.volume(instrument, Period.TICK, OfferSide.BID, currentDate.getTime(), localStopDate.getTime()); } catch (JFException ex) { Logger.getLogger(HistoryCollector.class.getName()).log(Level.SEVERE, null, ex); } System.out.println("MYDEBUG Downloading data for specific day: " + currentDate.toGMTString()); System.out.println("MYDEBUG Ticks count in period: " + ticks.size()); System.out.println("MYDEBUG Volumes count in period: " + volumes.length); System.out.println("MYDEBUG"); currentDate.setTime(currentDate.getTime() + 1 * 24 * 60 * 60 * 1000); } } I don't understand why some days have volumes amount different from 86400. Theoretically, all days contains 86400 seconds and I don't understand why somewhere such "gaps" occurred. Also volumes sum for 1 second isn't comfortable format for me. Is it possible to receive historical traded volumes (like as indicator "Volume") for each tick? Thank you.
|
|
|
|
 |
hebasto
|
Post subject: Re: Historical traded volumes |
Post rating: 0
|
Posted: Wed 08 Jan, 2014, 19:17
|
|
User rating: 96
Joined: Mon 09 Sep, 2013, 07:09 Posts: 287 Location: Ukraine, SHostka
|
|
|
|
 |
BogdanIvaniuk
|
Post subject: Re: Historical traded volumes |
Post rating: 0
|
Posted: Wed 08 Jan, 2014, 19:44
|
|
User rating: 0
Joined: Sun 23 Oct, 2011, 22:41 Posts: 24 Location: Ukraine,
|
hebasto wrote: BogdanIvaniuk wrote: Is it possible to receive historical traded volumes (like as indicator "Volume") for each tick? If you mean 'TRADED volume' is volume of transactions the answer is: No. See more: Volume transacted at the Bid vs volume transacted at the askAs I understand, indicator Volume (in Dukascopy trading terminal) shows actual TRADED volume. Isn't it? My question is how to technically fetch this indicator data for each tick. Also thank you for interesting link.
|
|
|
|
 |
hebasto
|
Post subject: Re: Historical traded volumes |
Post rating: 0
|
Posted: Wed 08 Jan, 2014, 20:05
|
|
User rating: 96
Joined: Mon 09 Sep, 2013, 07:09 Posts: 287 Location: Ukraine, SHostka
|
BogdanIvaniuk wrote: As I understand, indicator Volume (in Dukascopy trading terminal) shows actual TRADED volume. Isn't it? Volumes of transactions are unavailable at all by API and for any indicator. The reason is that Forex is an OTC market.
|
|
|
|
 |
BogdanIvaniuk
|
Post subject: Re: Historical traded volumes |
Post rating: 0
|
Posted: Wed 08 Jan, 2014, 20:20
|
|
User rating: 0
Joined: Sun 23 Oct, 2011, 22:41 Posts: 24 Location: Ukraine,
|
hebasto wrote: BogdanIvaniuk wrote: As I understand, indicator Volume (in Dukascopy trading terminal) shows actual TRADED volume. Isn't it? Volumes of transactions are unavailable at all by API and for any indicator. The reason is that Forex is an OTC market. Sure nobody can provide full Forex traded volume, but some bank/broker/marketplace can provide local traded volumes on local marketplace. And in my understanding, Volume indicator is likely displays Dukascopy marketplace traded volume.
|
|
|
|
 |
BogdanIvaniuk
|
Post subject: Re: Historical traded volumes |
Post rating: 0
|
Posted: Thu 09 Jan, 2014, 16:00
|
|
User rating: 0
Joined: Sun 23 Oct, 2011, 22:41 Posts: 24 Location: Ukraine,
|
The issue remains actual. I would be very grateful for any technical support help. Thank you.
|
|
|
|
 |
API Support
|
Post subject: Re: Historical traded volumes |
Post rating: 0
|
Posted: Thu 09 Jan, 2014, 17:23
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
Did you spot any particular second (i.e., timestamp) when the volume value is missing?
|
|
|
|
 |
BogdanIvaniuk
|
Post subject: Re: Historical traded volumes |
Post rating: 0
|
Posted: Thu 09 Jan, 2014, 18:44
|
|
User rating: 0
Joined: Sun 23 Oct, 2011, 22:41 Posts: 24 Location: Ukraine,
|
API Support wrote: Did you spot any particular second (i.e., timestamp) when the volume value is missing? Thank you for reply. Unfortunately, no. Method IIndicators.volume returns only array of doubles (without linked timestamps). Maybe you can explain how I can receive historical volumes for each tick? Is it possible?
|
|
|
|
 |
API Support
|
Post subject: Re: Historical traded volumes |
Post rating: 0
|
Posted: Tue 14 Jan, 2014, 08:23
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
BogdanIvaniuk wrote: Maybe you can explain how I can receive historical volumes for each tick? Is it possible? Yes, by using the asynchronous read approach, see the example in javadocs: IHistory.readTicks. In the LoadingDataListener.newTick method you would fetch either the getBid or the getAsk value and proceed.
|
|
|
|
 |
BogdanIvaniuk
|
Post subject: Re: Historical traded volumes |
Post rating: 0
|
Posted: Tue 14 Jan, 2014, 10:46
|
|
User rating: 0
Joined: Sun 23 Oct, 2011, 22:41 Posts: 24 Location: Ukraine,
|
API Support wrote: BogdanIvaniuk wrote: Maybe you can explain how I can receive historical volumes for each tick? Is it possible? Yes, by using the asynchronous read approach, see the example in javadocs: IHistory.readTicks. In the LoadingDataListener.newTick method you would fetch either the getBid or the getAsk value and proceed. As I understand, Volume indicator displays Dukascopy marketplace traded volume, that's why this indicator can't be calculated from bid/ask values. Am I right? If I'm wrong, where I can read indicator's specification or description? Maybe existed some method for subscribing on indicator and receiving data each tick? Also I can't find something like this in your example, this method provides fetching bid/ask and market depth data only.
|
|
|
|
 |
API Support
|
Post subject: Re: Historical traded volumes |
Post rating: 0
|
Posted: Tue 14 Jan, 2014, 11:01
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
BogdanIvaniuk wrote: As I understand, Volume indicator displays Dukascopy marketplace traded volume, that's why this indicator can't be calculated from bid/ask values. Am I right? If I'm wrong, where I can read indicator's specification or description? The indicator works with the same values that you: - See on the chart
- Receive from API IHistory methods.
Hence it does not make much sense to use the indicator if your goal is to collect or aggregate the volumes. BogdanIvaniuk wrote: Maybe existed some method for subscribing on indicator and receiving data each tick? We don't see point in doing that - use the IHistory methods for that purpose.
|
|
|
|
 |
BogdanIvaniuk
|
Post subject: Re: Historical traded volumes |
Post rating: 0
|
Posted: Tue 14 Jan, 2014, 11:30
|
|
User rating: 0
Joined: Sun 23 Oct, 2011, 22:41 Posts: 24 Location: Ukraine,
|
API Support wrote: The indicator works with the same values that you: - See on the chart
- Receive from API IHistory methods.
Hence it does not make much sense to use the indicator if your goal is to collect or aggregate the volumes. My goal is to operate with historical data of Volume indicator. I can't find algorithm or description how this indicator calculates from bid/ask or market depth data. In the file com/dukascopy/indicators/VolumeIndicator.java (in JForex API sources, file attached) I can only observe that this indicator already receive fully prepared data: public void setInputParameter(int index, Object array) { inputs[index] = (double[][]) array; } public IndicatorResult calculate(int startIndex, int endIndex) { int i, j; for (i = startIndex, j = 0; i <= endIndex; i++, j++) { outputs[0][j] = inputs[0][4][i]; } return new IndicatorResult(startIndex, j); } How I can calculate Volume indicator data in your opinion?
Attachments: |
VolumeIndicator.java [2.84 KiB]
Downloaded 103 times
|
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on
this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control
on their content. Anyone accessing this webpage and downloading or otherwise making use of any document,
data or information found on this webpage shall do it on his/her own risks without any recourse against
Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from
the use and/or reliance on any document, data or information found on this webpage.
|
|
|
|
|
 |
API Support
|
Post subject: Re: Historical traded volumes |
Post rating: 0
|
Posted: Tue 14 Jan, 2014, 11:58
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
BogdanIvaniuk wrote: My goal is to operate with historical data of Volume indicator. I can't find algorithm or description how this indicator calculates from bid/ask or market depth data. We reiterate that from a strategy it does not make much sense to work with the volume indicator, since you can access the same data more efficiently by using the IHistory methods. BogdanIvaniuk wrote: In the file com/dukascopy/indicators/VolumeIndicator.java (in JForex API sources, file attached) I can only observe that this indicator already receive fully prepared data: public void setInputParameter(int index, Object array) { inputs[index] = (double[][]) array; } //... public IndicatorResult calculate(int startIndex, int endIndex) { int i, j; for (i = startIndex, j = 0; i <= endIndex; i++, j++) { outputs[0][j] = inputs[0][4][i]; } return new IndicatorResult(startIndex, j); } How I can calculate Volume indicator data in your opinion? The indicator simply outputs volume of the bars that it receives as input. For tick case it is not ticks, rather 1 second bars which are aggregated from ticks.
|
|
|
|
 |
BogdanIvaniuk
|
Post subject: Re: Historical traded volumes |
Post rating: 0
|
Posted: Tue 14 Jan, 2014, 12:25
|
|
User rating: 0
Joined: Sun 23 Oct, 2011, 22:41 Posts: 24 Location: Ukraine,
|
I would like to build trading system exactly on Volume indicator. Sure I want to test it on historical data. My issue can be fixed by two ways: - Fetch historical calculated data of Volume indicator.
- Or understand calculation algorithm of Volume indicator and manually calculate historical data of indicator using IHistory methods (to receive bid/ask/bars/market depth information/etc).
API Support wrote: We reiterate that from a strategy it does not make much sense to work with the volume indicator, since you can access the same data more efficiently by using the IHistory methods. How IHistory methods can be useful for me without calculation algorithm understanding? Please explain how I can fix this issue.
|
|
|
|
 |
API Support
|
Post subject: Re: Historical traded volumes |
Post rating: 0
|
Posted: Tue 14 Jan, 2014, 14:00
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
BogdanIvaniuk wrote: How IHistory methods can be useful for me without calculation algorithm understanding? What do you mean by "calculation algorithm understanding"? If you mean algorithm how the volumes are constructed, see the link from the topic's second post, where there is an elaborate discussion on the matter. If you don't find IHistory usage useful, how do you expect the volume indicator which is exactly based on IHistory data to be useful? Also why should you add an extra layer by calling the volume indicator if you can get the same value right away from the history? 
Attachments: |
volumeIndVsBars.png [35.26 KiB]
Downloaded 469 times
|
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on
this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control
on their content. Anyone accessing this webpage and downloading or otherwise making use of any document,
data or information found on this webpage shall do it on his/her own risks without any recourse against
Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from
the use and/or reliance on any document, data or information found on this webpage.
|
|
|
|
|
 |
BogdanIvaniuk
|
Post subject: Re: Historical traded volumes |
Post rating: 0
|
Posted: Tue 14 Jan, 2014, 16:37
|
|
User rating: 0
Joined: Sun 23 Oct, 2011, 22:41 Posts: 24 Location: Ukraine,
|
Issue was fixed. Volume indicator shows sum of volumes on best bid price during some period. This information explains everything. Now I can calculate/construct historical Volume indicator data for any TF and test my system. Thank you for suggestive thoughts and patience 
|
|
|
|
 |
|
Pages: [
1
]
|
|
|
|
|