Hello Support Team,
JFUtils#convertPipToCurrency() does not work for */GBX instruments. Assuming account currency is USD, please, consider following code and the exception. The conversion works fine for NZDUSD but not for AALGBGBX.
@Override
public void onStart(IContext context) throws JFException {
JFUtils utils = context.getUtils();
Set<Instrument> instrumentToSubscribe = new HashSet<>();
instrumentToSubscribe.add(Instrument.AALGBGBX);
instrumentToSubscribe.add(Instrument.GBPUSD);
instrumentToSubscribe.add(Instrument.EURUSD);
instrumentToSubscribe.add(Instrument.AUDNZD);
context.setSubscribedInstruments(instrumentToSubscribe, true);
double audnzdPip = utils.convertPipToCurrency(Instrument.NZDUSD, JFCurrency.getInstance("USD"));
System.out.println(Instrument.NZDUSD + " " + String.format("%7f",audnzdPip));
double aalgbxPip = utils.convertPipToCurrency(Instrument.AALGBGBX, JFCurrency.getInstance("USD"));
System.out.println(Instrument.AALGBGBX + " " + String.format("%7f",aalgbxPip));
}
Exception:
NZD/USD 1.0E-4
2017-09-14 23:03:15.570 ERROR h$b - Exception thrown while running onStart method: Unable to make the conversion. There are no active, subscirbed instruments containing USD.
com.dukascopy.api.JFException: Unable to make the conversion. There are no active, subscirbed instruments containing USD.
at com.dukascopy.dds2.greed.util.al.convertPipToCurrency(L:274)
at com.dukascopy.dds2.greed.util.al.convertPipToCurrency(L:188)
at eu.smartfx.utils.generic.RateProviderImpl.onStart(RateProviderImpl.java:42)
at com.dukascopy.api.impl.execution.s.call(L:27)
at com.dukascopy.api.impl.execution.s.call(L:13)
at com.dukascopy.api.impl.connect.at.a(L:140)
at com.dukascopy.api.impl.connect.cm.call(L:706)
at com.dukascopy.api.impl.connect.cm.call(L:668)
at com.dukascopy.api.impl.execution.j.call(L:34)
at java.util.concurrent.FutureTask.run(Unknown Source)
at com.dukascopy.api.impl.execution.f$a.f(L:904)
at com.dukascopy.api.impl.execution.f$a.run(L:926)
at java.lang.Thread.run(Unknown Source)
Best regards,
Grzegorz