|
Attention! Read the forum rules carefully before posting a topic.
Submit JForex API bug reports in this forum only. Submit Converter issues in Converter Issues. Off topics are strictly forbidden.
Any topics which do not satisfy these rules will be deleted.
Historical Data is broken |
MobNaga
|
Post subject: Historical Data is broken |
Post rating: 0
|
Posted: Sun 02 Feb, 2014, 10:30
|
|
User rating: 7
Joined: Tue 28 Feb, 2012, 09:45 Posts: 45 Location: JapanJapan
|
I think, I found Bugs in Dukascopy's Historical Data(between 1st October 2004 and 25th October 2004). e.g. Historical Data of Period.ONE_HOUR was broken. Please check this strategy. package jforex;
import com.dukascopy.api.*; import java.text.SimpleDateFormat; import java.util.TimeZone; import java.util.Locale; import java.util.Calendar; import java.util.List; import java.util.ArrayList; import java.util.Arrays;
public class getBarsCheck implements IStrategy { private static Calendar myCalendarFrom; private static Calendar myCalendarTo; static { myCalendarFrom = Calendar.getInstance(TimeZone.getTimeZone("GMT")); myCalendarFrom.set(2004, Calendar.OCTOBER, 1, 0, 0, 0); myCalendarFrom.set(Calendar.MILLISECOND, 0); myCalendarTo = Calendar.getInstance(TimeZone.getTimeZone("GMT")); myCalendarTo.set(2004, Calendar.OCTOBER, 25, 0, 0, 0); myCalendarTo.set(Calendar.MILLISECOND, 0); } @Configurable(value="Check Time: From", obligatory=true, description="1st October 00:00 (include this time)") public Calendar calFrom = myCalendarFrom; @Configurable(value="Check Time: To", obligatory=true, description="25th October 00:00 (not include this time)") public Calendar calTo = myCalendarTo; @Configurable(value="Check Instrument", obligatory=true) public Instrument instrument = Instrument.EURUSD; @Configurable(value="Check Period", obligatory=true) public List<Period> checkPeriods = new ArrayList<Period>(Arrays.asList(new Period[]{Period.DAILY, Period.FOUR_HOURS, Period.ONE_HOUR, Period.FIFTEEN_MINS, Period.FIVE_MINS})); public void onStart(IContext context) throws JFException { IHistory history = context.getHistory(); IConsole console = context.getConsole(); console.getOut().println("getBarsCheck: Started"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss",Locale.US); sdf.setTimeZone(TimeZone.getTimeZone("GMT")); long timeFrom = calFrom.getTimeInMillis(), timeTo; console.getOut().println("from: "+sdf.format(timeFrom)); console.getOut().println("to: "+sdf.format(calTo.getTimeInMillis())); for(Period period: checkPeriods){ timeTo = history.getPreviousBarStart(period, calTo.getTimeInMillis()); List<IBar> barList = history.getBars(instrument, period, OfferSide.BID, timeFrom, timeTo); double volumeSum = 0; for(IBar bar: barList){volumeSum += bar.getVolume();} console.getOut().println("[" + period + "]" + " List Size = " +barList.size() + ", Volume Total = " + volumeSum); } console.getOut().println("getBarsCheck: Done"); context.stop(); }
public void onAccount(IAccount account) throws JFException {} public void onMessage(IMessage message) throws JFException {} public void onStop() throws JFException {} public void onTick(Instrument instrument, ITick tick) throws JFException {} public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {} } Result is this.  And also, Historical Data of Period.FIVE_MINS(between 19th October 2004 and 25th October 2004) was broken.  List size = 0! What is this!! Regards.
Attachments: |
getBarsTestPicsB.JPG [56.97 KiB]
Downloaded 399 times
|
getBarsTestPics.JPG [59.82 KiB]
Downloaded 395 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.
|
|
|
|
|
 |
MobNaga
|
Post subject: Re: Historical Data is broken |
Post rating: 0
|
Posted: Sun 02 Feb, 2014, 13:03
|
|
User rating: 7
Joined: Tue 28 Feb, 2012, 09:45 Posts: 45 Location: JapanJapan
|
And There is something Bug in IHistory.getBars(Instrument instrument, Period period, OfferSide side, Filter filter, int numberOfCandlesBefore, long time, int numberOfCandlesAfter). e.g. package jforex;
import com.dukascopy.api.*; import java.text.SimpleDateFormat; import java.util.TimeZone; import java.util.Locale; import java.util.Calendar; import java.util.List; import java.util.ArrayList; import java.util.Arrays;
public class getBarsCheck2 implements IStrategy { private static Calendar myCalendarFrom; private static Calendar myCalendarTo; static { myCalendarFrom = Calendar.getInstance(TimeZone.getTimeZone("GMT")); myCalendarFrom.set(2004, Calendar.NOVEMBER, 19, 21, 55, 0); myCalendarFrom.set(Calendar.MILLISECOND, 0); myCalendarTo = Calendar.getInstance(TimeZone.getTimeZone("GMT")); myCalendarTo.set(2004, Calendar.NOVEMBER, 19, 22, 00, 0); myCalendarTo.set(Calendar.MILLISECOND, 0); } @Configurable(value="Check Time: From", obligatory=true, description="15th Octber 22:00 (include this time)") public Calendar calFrom = myCalendarFrom; @Configurable(value="Check Time: To", obligatory=true, description="15th Octber 23:00 (not include this time)") public Calendar calTo = myCalendarTo; @Configurable(value="Check Instrument", obligatory=true) public Instrument instrument = Instrument.EURUSD; @Configurable(value="Check Period", obligatory=true) public Period checkPeriod = Period.FIVE_MINS; public void onStart(IContext context) throws JFException { IHistory history = context.getHistory(); IConsole console = context.getConsole(); console.getOut().println("getBarsCheck2: Started"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss",Locale.US); sdf.setTimeZone(TimeZone.getTimeZone("GMT")); long timeFrom = calFrom.getTimeInMillis(), timeTo; console.getOut().println("from: "+sdf.format(timeFrom)); console.getOut().println("to: "+sdf.format(calTo.getTimeInMillis())); timeTo = history.getPreviousBarStart(checkPeriod, calTo.getTimeInMillis()); List<IBar> askBars = history.getBars(instrument, checkPeriod, OfferSide.ASK, Filter.NO_FILTER, timeFrom, timeTo); List<IBar> bidBars = history.getBars(instrument, checkPeriod, OfferSide.BID, Filter.NO_FILTER, timeFrom, timeTo); console.getOut().println("[" + checkPeriod + "]" + " AskBar Size = " +askBars.size() + ", BidBar Size = " + bidBars.size()); askBars = history.getBars(instrument, checkPeriod, OfferSide.ASK, Filter.ALL_FLATS, 1, timeFrom, 1); bidBars = history.getBars(instrument, checkPeriod, OfferSide.BID, Filter.ALL_FLATS, 1, timeFrom, 1); console.getOut().println("[" + checkPeriod + "]" + " BidBar Size = " +askBars.size() + ", AskBar Size = " + bidBars.size()); console.getOut().println("getBarsCheck2: Done"); context.stop(); }
public void onAccount(IAccount account) throws JFException {} public void onMessage(IMessage message) throws JFException {} public void onStop() throws JFException {} public void onTick(Instrument instrument, ITick tick) throws JFException {} public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {} }  P.S. At least before this weekend, this error didn't exist. regards.
Attachments: |
getBarsCheck2.JPG [45.15 KiB]
Downloaded 379 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.
|
|
|
|
|
 |
|
Pages: [
1
]
|
|
|
|
|