Dukascopy
 
 
Wiki JStore Search Login

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.

JFUtils#convertPipToCurrency() does not work for */GBX instruments
 Post subject: JFUtils#convertPipToCurrency() does not work for */GBX instruments Post rating: 0   New post Posted: Thu 14 Sep, 2017, 22:05 
User avatar

User rating: 8
Joined: Mon 09 Jun, 2014, 21:07
Posts: 49
Location: Poland, Warsaw
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


 
 Post subject: Re: JFUtils#convertPipToCurrency() does not work for */GBX instruments Post rating: 0   New post Posted: Thu 28 Sep, 2017, 08:22 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
This is fixed and will be available in the next version.


 
 Post subject: Re: JFUtils#convertPipToCurrency() does not work for */GBX instruments Post rating: 0   New post Posted: Fri 29 Sep, 2017, 10:27 
User avatar

User rating: 8
Joined: Mon 09 Jun, 2014, 21:07
Posts: 49
Location: Poland, Warsaw
Thank you!


 

Jump to:  

cron
  © 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