Hi,
When iterating over a List of
WEEKEND filtered bidBar/s as follows:
java.util.List<IBar> chunk = history.getBars(instrument, period, OfferSide.BID, Filter.WEEKENDS, 0, chunkStartBarTime, chunkBarsCount);
for (IBar bidBar : chunk) {//--------------- Write chunk data to a csv file
bidBarOTCal.setTimeInMillis(bidBar.getTime());
bidBarCTCal.setTimeInMillis(bidBar.getTime()+period.getInterval());
IBar askBar = history.getBars(instrument, period, OfferSide.ASK, bidBar.getTime(), bidBar.getTime()).askBars.get(0);
if (askBar != null){
askBarOTCal.setTimeInMillis(askBar.getTime());
if (bidBar.getTime() != askBar.getTime()){
console.getOut().println("WRONG askBAR");
}
try {
fw.append(timeFormatter.format(bidBarOTCal.getTimeInMillis()) + "," +
instrument.toString().replaceFirst("/","") + "," +
period.getInterval()/60000L + "," +
bidBar.getOpen() + "," +
bidBar.getHigh() + "," +
bidBar.getLow() + "," +
bidBar.getClose() + "," +
bidBar.getVolume() + "," +
askBar.getVolume() + "," +
0 + ","
0 + ","
0 + ","
timeFormatter.format(System.currentTimeMillis())+"\n");
totalBarsInPeriod++;
} catch (Exception e) {
e.printStackTrace(console.getErr());
}
}
}
I get non filtered WEEKEND bars as follows (two sample lines):
2010.08.22 21:00:00,GBPUSD,5,1.55335,1.55335,1.55335,1.55335,
0.0,25.9,0,0,0,2010.08.26 07:46:26
2010.08.22 21:05:00,GBPUSD,5,1.55335,1.55335,1.55335,1.55335,
0.0,10.0,0,0,0,2010.08.26 07:46:26
Note the red bidVolume and askVolume numbers (respectively). As you can see the askVolume is not zero - which might be why these bars are not filtered as they should. It goes on like that for the whole weekend where the first "real" non zero bar is on Sunday midnight GMT - here's the last two lines:
2010.08.22 23:55:00,GBPUSD,5,1.55335,1.55335,1.55335,1.55335,
0.0,652.5,0,0,0,2010.08.26 07:46:26
2010.08.23 00:00:00,GBPUSD,5,1.55515,1.5557,1.55485,1.55555,
686.0,1012.0,0,0,0,2010.08.26 07:46:26
Is it something in the way I handle it or is it a bug?
Thanks.