Dukascopy
 
 
Wiki JStore Search Login

JFOREX-1655: IHistory.getBars(..., Filter.ALL_FLATS, ...)
 Post subject: JFOREX-1655: IHistory.getBars(..., Filter.ALL_FLATS, ...) Post rating: 0   New post Posted: Mon 12 Apr, 2010, 13:23 
User avatar

User rating: 3
Joined: Wed 18 May, 2011, 16:25
Posts: 331
Location: SwitzerlandSwitzerland
Hi,

when applying Filter.ALL_FLATS in IHistory.getbars(...) I'm assuming that by definition there should always be bars in the return list.
The only case I can think of where no bars would be returned is if bars before the start date of the historical datafeed would get retrieved.

However we are experiencing the error message
"Number of bars to load = 0 or time is not correct time for the period specified"
when working with Filter.ALL_FLATS.

Example:
history.getBars(EUR/USD, TEN_SECS, BID, ALL_FLATS, 92, Wed 2010.01.06 00:00:00.000, 0)


There's also a question that arises when looking closer into filtering flats. If e.g. during the night on a lower timeframe (TEN_SECS, etc.) there are no trade ticks, but on the HOURLY there are, would getBars consider the TEN_SECS as being a flat that will get filtered?
I.e. with Filter.ALL_FLATS do you really filter all flats depending on the timeframe, or do you filter "MARKET_CLOSED"-flats?

Looking forward to you response!
Best, RR.


 
 Post subject: Re: JFOREX-1655: IHistory.getBars(..., Filter.ALL_FLATS, ...) Post rating: 0   New post Posted: Thu 22 Apr, 2010, 14:44 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
We have the following code inside getBars:
        if (!(period != Period.TICK && DataCacheUtils.isCandleBasicFast(period) && DataCacheUtils.getCandleStartFast(period, time) == time && (before > 0 || after > 0))) {
            throw new JFException("Number of bars to load = 0 or time is not correct time for the period specified");
        }

From this code you can see that the reasons for the error can be:
1. period is TICK
2. period is not one of the currently supported periods
3. time is not the start time of the candle
4. both parameters specifying the number of candles are zero

Code that you posted cannot raise this exception. Most likely the time that you passed in real code was not correct candle start time for the period


 
 Post subject: Re: JFOREX-1655: IHistory.getBars(..., Filter.ALL_FLATS, ...) Post rating: 0   New post Posted: Fri 23 Apr, 2010, 12:30 
User avatar

User rating: 3
Joined: Wed 18 May, 2011, 16:25
Posts: 331
Location: SwitzerlandSwitzerland
Dear support team,

thanks a lot for your reply and the info.
I thought I had taken the data used in the posting directly from our error log, but it's quite some time and versions ago, so I'm not 100% sure.
When now running the following code I'm getting the correct return list with 92 bars.

List<IBar> aBars = history.getBars(Instrument.EURUSD, Period.TEN_SECS, OfferSide.BID, Filter.ALL_FLATS, 92, fDateTime.parse("2010.01.06 00:00:00.000").getTime(), 0);                


So from my side we can close this topic.

Thanks and best, RR.


 

Jump to:  

  © 1998-2024 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