I wrote some simple code, found some problems, took the day's opening price, and the closing price was different from by the platform displayed:
Please tell me what the reason is
Examples are as follows:
public class GetBarsExample implements IStrategy {
@Configurable("Instrument")
public Instrument Curinstrument = Instrument.AUDJPY;
private IContext context;
private IConsole console;
private IHistory history;
private IBar prevDailyBar;
private SimpleDateFormat gmtSdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
public void onStart(IContext context) throws JFException {
this.context = context;
console = context.getConsole();
history = context.getHistory();
context.setSubscribedInstruments(java.util.Collections.singleton(Instrument.EURUSD), true);
//today BARS
prevDailyBar = history.getBar(Curinstrument, Period.DAILY, OfferSide.ASK, 0);
console.getInfo().format(" today open price=%.5f ", prevDailyBar .getOpen()).println();
console.getInfo().format(" today time=%s open price=%.5f close price=%.5f ",gmtSdf.format(prevDailyBar.getTime()),prevDailyBar .getOpen(), prevDailyBar .getClose()).println();
}
console printinfo:
today time=2018-04-17 08:00:00 open price=83.24000 close price=83.21800
but he platform displayed:
4-17 (aud/jpy today open price is 83.312
