Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

ITesterClient.connect() sometimes causes IHistory.getLastTick() to start failing until a new chart is opened
 Post subject: ITesterClient.connect() sometimes causes IHistory.getLastTick() to start failing until a new chart is opened Post rating: 0   Post Posted: Mon 28 Jan, 2013, 08:54 
User avatar

User rating: 6
Joined: Thu 19 May, 2011, 11:14
Posts: 235
Location: South Africa,
The javadoc for IHistory.getLastTick(ins) says it throws
Quote:
JFException - when instrument is not active (not opened in platform)


In my application, the method
    public double getEquityInPrimaryCurrency(Instr instr) {
        Instrument i = instrumentAdaptor.adaptBack(instr);

        Currency pri = i.getPrimaryCurrency();
        Currency acc = context.getAccount().getCurrency();

        double r;

        if (pri.equals(acc)) {
            r = 1;
        } else {
            String priCode = pri.getCurrencyCode();
            String accCode = acc.getCurrencyCode();
            String sep = Instrument.getPairsSeparator();

            Instrument ratio = Instrument.fromString(priCode + sep + accCode);
            try {
                if (ratio != null) {
                    r = 1 / context.getHistory().getLastTick(ratio).getBid();
                } else {
                    ratio = Instrument.fromString(accCode + sep + priCode);
                    r = context.getHistory().getLastTick(ratio).getBid();
                }
            } catch (JFException ex) {
                Debug.error("JfContext.getEquity(): Cannot determine ratio between " + priCode + " and " + accCode + ". context.getHistory.getLastTick(" + ratio + ") threw " + ex + ". Try subscribing to the relevant instrument. Currently subscribed to " + context.getSubscribedInstruments());
                r = 0;
            }
        }
        return context.getAccount().getEquity() * r;
    }

has generated the output
Quote:
07:31:08 ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD]


So the platform is "subscribed" to [EUR/USD] but [EUR/USD] is not "opened". What is the difference and how do I "open" an instrument?


 
 Post subject: Re: JFException: Instrument [EUR/USD] not opened. Post rating: 0   Post Posted: Mon 28 Jan, 2013, 13:47 
User avatar

User rating: 6
Joined: Thu 19 May, 2011, 11:14
Posts: 235
Location: South Africa,
To summarize: My question is about why IHistory.getLastTick() throws
Quote:
JFException: Instrument [EUR/USD] not opened.

even if the platform is subscribed to EUR/USD.


 
 Post subject: Re: JFException: Instrument [EUR/USD] not opened. Post rating: 0   Post Posted: Wed 30 Jan, 2013, 08:53 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
"Instrument [EUR/USD] not opened" just means that at the particular moment the EUR/USD instrument was not subscibed or it was not tradable, see more:
https://www.dukascopy.com/wiki/#Instrument_tradability


 
 Post subject: Re: JFException: Instrument [EUR/USD] not opened. Post rating: 0   Post Posted: Wed 30 Jan, 2013, 09:57 
User avatar

User rating: 6
Joined: Thu 19 May, 2011, 11:14
Posts: 235
Location: South Africa,
Thank you. What exactly does it mean when an instrument's "status is inactive". Does it mean the same as "not tradable"?

I understood that there are three possibilities for instrument status:
1. Unsubscribed
2. Subscribed but not tradable
3. Subscribed and tradable

Are there actually more possible statuses based on whether the instrument is "active" or "inactive"? If so, what do they mean?


 
 Post subject: Re: JFException: Instrument [EUR/USD] not opened. Post rating: 0   Post Posted: Wed 30 Jan, 2013, 10:00 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
For disambiguation we adjusted our previous response.


 
 Post subject: Re: JFException: Instrument [EUR/USD] not opened. Post rating: 0   Post Posted: Wed 30 Jan, 2013, 19:04 
User avatar

User rating: 6
Joined: Thu 19 May, 2011, 11:14
Posts: 235
Location: South Africa,
API Support wrote:
"Instrument [EUR/USD] not opened" just means that at the particular moment the EUR/USD instrument was not subscibed or it was not tradable, see more:
https://www.dukascopy.com/wiki/#Instrument_tradability

In my case I am getting this error even though the instrument is both subscribed (as evidenced by the end of line 121 in the console snippet below) and tradable (as evidenced by line 123 below).
Console snippet in reverse chronological order:
2013-01-30 17:42:09   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:09   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:09   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:09   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:09   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:09   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:09   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:09   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:09   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:09   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:09   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:09   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:09   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:09   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:09   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:09   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:09   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:08   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   DEBUG: StatelessStrategyProc std_F,ST,TIP(D1,1,-,1),EURUSD,M5,K(30),T(4),LR(2): All requisite symbols are now defined. Can start trading.
2013-01-30 17:42:07   DEBUG: StatelessStrategyProc std_F,ST,TIP(D1,1,-,1),EURUSD,M5,K(20),T(4),LR(2): All requisite symbols are now defined. Can start trading.
2013-01-30 17:42:07   DEBUG: StatelessStrategyProc std_F,ST,TIP(D1,1,-,1),EURUSD,M5,K(20),T(2),LR(2): All requisite symbols are now defined. Can start trading.
2013-01-30 17:42:07   DEBUG: StatelessStrategyProc std_F,ST,TIP(D1,1,+,1),EURUSD,M5,K(50),T(4),LR(2): All requisite symbols are now defined. Can start trading.
2013-01-30 17:42:07   DEBUG: StatelessStrategyProc std_F,ST,TIP(D1,1,+,1),EURUSD,M5,K(50),T(2),LR(2): All requisite symbols are now defined. Can start trading.
2013-01-30 17:42:07   DEBUG: StatelessStrategyProc std_F,ST,TIP(D1,1,+,1),EURUSD,M5,K(30),T(4),LR(2): All requisite symbols are now defined. Can start trading.
2013-01-30 17:42:07   DEBUG: StatelessStrategyProc std_F,ST,TIP(D1,1,+,1),EURUSD,M5,K(30),T(2),LR(2): All requisite symbols are now defined. Can start trading.
2013-01-30 17:42:07   DEBUG: StatelessStrategyProc std_F,ST,TIP(D1,1,+,1),EURUSD,M5,K(20),T(4),LR(2): All requisite symbols are now defined. Can start trading.
2013-01-30 17:42:07   ERROR: JfContext.getEquity(): Cannot determine ratio between EUR and USD. context.getHistory.getLastTick(EUR/USD) threw com.dukascopy.api.JFException: Instrument [EUR/USD] not opened. Try subscribing to the relevant instrument. Currently subscribed to [GBP/USD, EUR/USD].
2013-01-30 17:42:07   DEBUG: StatelessStrategyProc std_F,ST,TIP(D1,1,+,1),EURUSD,M5,K(20),T(2),LR(2): All requisite symbols are now defined. Can start trading.
2013-01-30 17:42:08   TRACE: *S* MessageType : INSTRUMENT_STATUS Instument : EUR/USD Tradable : true
2013-01-30 17:42:07   TRACE: *S* MessageType : INSTRUMENT_STATUS Instument : GBP/USD Tradable : true
2013-01-30 17:42:08   TRACE: *S* ... 50% complete
2013-01-30 17:42:08   TRACE: *S* ... 50% complete
2013-01-30 17:42:08   TRACE: *S* MessageType : INSTRUMENT_STATUS Instument : EUR/USD Tradable : true
2013-01-30 17:42:08   TRACE: *S* MessageType : INSTRUMENT_STATUS Instument : GBP/USD Tradable : true
2013-01-30 17:42:08   TRACE: *S* MessageType : INSTRUMENT_STATUS Instument : EUR/USD Tradable : true
2013-01-30 17:42:08   TRACE: *S* MessageType : INSTRUMENT_STATUS Instument : GBP/USD Tradable : true
2013-01-30 17:42:08   TRACE: *S* MessageType : INSTRUMENT_STATUS Instument : EUR/USD Tradable : true
2013-01-30 17:42:07   TRACE: *S* MessageType : INSTRUMENT_STATUS Instument : GBP/USD Tradable : true
2013-01-30 17:42:08   TRACE: *S* MessageType : INSTRUMENT_STATUS Instument : EUR/USD Tradable : true
2013-01-30 17:42:07   TRACE: *S* MessageType : INSTRUMENT_STATUS Instument : GBP/USD Tradable : true
2013-01-30 17:42:09   TRACE: *S* ... 25% complete
2013-01-30 17:42:09   TRACE: *S* ... 25% complete
2013-01-30 17:42:08   TRACE: *S* MessageType : INSTRUMENT_STATUS Instument : EUR/USD Tradable : true
2013-01-30 17:42:07   TRACE: *S* MessageType : INSTRUMENT_STATUS Instument : GBP/USD Tradable : true
2013-01-30 17:42:08   TRACE: *S* MessageType : INSTRUMENT_STATUS Instument : EUR/USD Tradable : true
2013-01-30 17:42:07   TRACE: *S* MessageType : INSTRUMENT_STATUS Instument : GBP/USD Tradable : true
2013-01-30 17:42:08   TRACE: *S* MessageType : INSTRUMENT_STATUS Instument : EUR/USD Tradable : true
2013-01-30 17:42:08   TRACE: *S* MessageType : INSTRUMENT_STATUS Instument : GBP/USD Tradable : true
2013-01-30 17:42:08   TRACE: *S* MessageType : INSTRUMENT_STATUS Instument : EUR/USD Tradable : true
2013-01-30 17:42:08   TRACE: *S* MessageType : INSTRUMENT_STATUS Instument : GBP/USD Tradable : true
2013-01-30 17:42:01   TRACE: *S* ... 0% complete
2013-01-30 17:42:01   TRACE: *S* ... 0% complete
2013-01-30 17:42:08   TRACE: *S* MessageType : INSTRUMENT_STATUS Instument : GBP/USD Tradable : true
2013-01-30 17:42:08   TRACE: *S* MessageType : INSTRUMENT_STATUS Instument : EUR/USD Tradable : true


I get this error quite often at any time of the day, when there is no reason for EURUSD to be untradable.


 
 Post subject: Re: JFException: Instrument [EUR/USD] not opened. Post rating: 0   Post Posted: Thu 31 Jan, 2013, 19:53 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
In what cases/how often do you use IContext.setSubscribedInstruments()? Does the issue persist when you set the instruments only on strategy start? We could not replicate this, could you please provide an example strategy which would replicate the case?


 
 Post subject: Re: JFException: Instrument [EUR/USD] not opened. Post rating: 0   Post Posted: Fri 01 Feb, 2013, 09:21 
User avatar

User rating: 6
Joined: Thu 19 May, 2011, 11:14
Posts: 235
Location: South Africa,
API Support wrote:
In what cases/how often do you use IContext.setSubscribedInstruments()?
Does the issue persist when you set the instruments only on strategy start?

I never call IContext.setSubscribedInstruments(),
but I do call ITesterClient.setSubscribedInstruments() twice (see methods below). Might that be a problem?

Instead of calling IContext.setSubscribedInstruments()
I require the relevant instruments to already be subscribed before strategy is started
(and if not I throw an exception so that the user can subscribe, and restart).

This thread illustrates why I call ITesterClient.setSubscribedInstruments().
    public static void downloadData(Set<Instrument> instruments, long start, long end, LoadingProgressListener progressListener) throws ClientFailedException{
        ITesterClient client = waitForConnection();

        EnumSet<Instrument> instrumentsCopy = EnumSet.noneOf(Instrument.class);
        instrumentsCopy.addAll(instruments);
       
        client.setSubscribedInstruments(instrumentsCopy);
        client.setDataInterval(Period.TICK, OfferSide.BID, ITesterClient.InterpolationMethod.OPEN_TICK, start, end);

        Debug.trace("Starting download of historical data" + intervalStr(start, end) + "...");
        client.downloadData(progressListener);
    }

    public static void startStream(Set<Instrument> instruments, long start, long end, final PreambleListener listener) throws ClientFailedException {
        ITesterClient client = waitForConnection();

        EnumSet<Instrument> instrumentsCopy = EnumSet.noneOf(Instrument.class);
        instrumentsCopy.addAll(instruments);

        client.setSubscribedInstruments(instrumentsCopy);
        client.setDataInterval(Period.TICK, OfferSide.BID, ITesterClient.InterpolationMethod.OPEN_TICK, start, end);

        Debug.trace("Starting stream of historical data" + intervalStr(start, end) + "...");
        //final AtomicBoolean completed = new AtomicBoolean(false);
        client.startStrategy(new IStrategy(){
            @Override
            public void onTick(Instrument i, ITick itick) throws JFException {
                listener.onPreambleTick(i, itick);
            }
            @Override
            public void onBar(Instrument i, Period period, IBar ibar, IBar ibar1) throws JFException {
                listener.onPreambleBar(i, period, ibar, ibar1);
            }
            @Override
            public void onMessage(IMessage im) throws JFException {
            }
            @Override
            public void onAccount(IAccount ia) throws JFException {
            }
            @Override
            public void onStart(IContext ic) throws JFException {
            }
            @Override
            public void onStop() throws JFException {
                listener.onPreambleEnd();
            }
        });
    }


API Support wrote:
We could not replicate this, could you please provide an example strategy which would replicate the case?

Even if I give you my code (20K lines - it's actually a compiler for a custom "forex trading language")
that would still not give you a reliable way to reproduce the bug, because it is an intermittent bug.
Probably the best I give you is the guarantee that the code snippet in post#1 generated the output quoted below it.

Does it really matter to IHistory.getLastTick() whether an instrument is tradable?


 
 Post subject: Re: JFException: Instrument [EUR/USD] not opened. Post rating: 0   Post Posted: Mon 04 Feb, 2013, 18:27 
User avatar

User rating: 6
Joined: Thu 19 May, 2011, 11:14
Posts: 235
Location: South Africa,
Just to summarize for your convenience: I have confirmed that IHistory.getLastTick([EUR/USD]) throws
com.dukascopy.api.JFException: Instrument [EUR/USD] not opened.
even if [EUR/USD] is subscribed and tradable.

I have also noticed a correlation with this charting bug:
IHistory.getLastTick([EUR/USD]) completes as expected when all charts are behaving correctly.


 
 Post subject: Re: JFException: Instrument [EUR/USD] not opened. Post rating: 0   Post Posted: Tue 05 Feb, 2013, 08:45 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Isak wrote:
Does it really matter to IHistory.getLastTick() whether an instrument is tradable?
We rechecked that it does not. This due to instrument subscription processing.
Isak wrote:
Even if I give you my code (20K lines - it's actually a compiler for a custom "forex trading language")
that would still not give you a reliable way to reproduce the bug, because it is an intermittent bug.
Probably the best I give you is the guarantee that the code snippet in post#1 generated the output quoted below it.
There are many factors which affect instrument subscription updates, like user manual actions/api actions, order updates, charts, historical feed. Thus, big part of what your trading system does is related to instrument subscription. Therefore it does not suffice with excerpts from your strategy to repeat the case. One would rather need a strategy, given that there is no JForex-API-using program running parallel in the same process, and the launch conditions (i.e. opened charts in SDK/platform, active orders).


 
 Post subject: Re: JFException: Instrument [EUR/USD] not opened. Post rating: 0   Post Posted: Tue 05 Feb, 2013, 22:00 
User avatar

User rating: 6
Joined: Thu 19 May, 2011, 11:14
Posts: 235
Location: South Africa,
Isak wrote:
To summarize: My question is about why IHistory.getLastTick() throws
Quote:
JFException: Instrument [EUR/USD] not opened.
even if the platform is subscribed to EUR/USD.
API Support wrote:
"Instrument [EUR/USD] not opened" just means that at the particular moment the EUR/USD instrument was not subscibed or it was not tradable...
Isak wrote:
Does it really matter to IHistory.getLastTick() whether an instrument is tradable?
API Support wrote:
We rechecked that it does not. This due to instrument subscription processing.
So IHistory.getLastTick() should never throw "JFException: Instrument [EUR/USD] not opened" while EUR/USD is subscribed, since tradability doesn't matter to it. Do I understand correctly?


 
 Post subject: Re: JFException: Instrument [EUR/USD] not opened. Post rating: 0   Post Posted: Thu 14 Feb, 2013, 12:02 
User avatar

User rating: 6
Joined: Thu 19 May, 2011, 11:14
Posts: 235
Location: South Africa,
I will try to simplify:

You confirmed that IHistory.getLastTick() does not care whether an instrument is tradable.

So as long as an instrument is subscribed, IHistory.getLastTick() will not throw an exception, even if that instrument is non-tradable.

Did I understand correctly?


 
 Post subject: Re: JFException: Instrument [EUR/USD] not opened. Post rating: 0   Post Posted: Thu 14 Feb, 2013, 12:52 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Quote:
You confirmed that IHistory.getLastTick() does not care whether an instrument is tradable.

So as long as an instrument is subscribed, IHistory.getLastTick() will not throw an exception, even if that instrument is non-tradable.
"Should not" rather than "will not". As long as there is no standalone program which replicates the case and precise launch conditions, we can only speculate what actually causes the exception in your program.


 
 Post subject: Re: JFException: Instrument [EUR/USD] not opened. Post rating: 0   Post Posted: Fri 15 Feb, 2013, 01:59 
User avatar

User rating: 6
Joined: Thu 19 May, 2011, 11:14
Posts: 235
Location: South Africa,
If the instrument is subscribed, is IHistory.getLastTick() allowed to throw that exception or not?

If yes, then what exactly does the exception mean?

If no, then we agree that IHistory.getLastTick() is violating its contract (regardless of what I, as a consumer of the API, am doing).


 
 Post subject: Re: JFException: Instrument [EUR/USD] not opened. Post rating: 0   Post Posted: Fri 15 Feb, 2013, 13:03 
User avatar

User rating: 6
Joined: Thu 19 May, 2011, 11:14
Posts: 235
Location: South Africa,
API Support wrote:
As long as there is no standalone program which replicates the case and precise launch conditions,
we can only speculate what actually causes the exception in your program.

Why don't you rather search for that exception in the call tree of IHistory.getLastTick() and inspect the logic that decides when and why to throw it.
It is a matter of asking how this logic can possibly throw the exception even while the instrument is subscribed according to IContext.getSubscribedInstruments().

(And if that exception is thrown from multiple locations, then you could modify the descriptions so that they are unique,
which would allow me to report the exact source of the exception next time I encounter it.)


 
 Post subject: Re: JFException: Instrument [EUR/USD] not opened. Post rating: 0   Post Posted: Fri 15 Feb, 2013, 13:17 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
We have already done that and conclusion was the one that we already posted - that the exception should not get thrown if the instrument is subscribed. Since we did not come up with a program which replicates the case that you have posted, we ask you already for the fourth time to provide a full example program which does replicate it.


 
 Post subject: Re: JFException: Instrument [EUR/USD] not opened. Post rating: 0   Post Posted: Fri 15 Feb, 2013, 14:48 
User avatar

User rating: 6
Joined: Thu 19 May, 2011, 11:14
Posts: 235
Location: South Africa,
Thank you for your efforts so far.
Unfortunately I cannot give you my code, just as you cannot give me yours.

You seem to agree that the bug is on your side of the JF API, just that you
say you cannot address it unless you have a way to reproduce it. This bug
is intermittent - it doesn't have a reproduction procedure. Such bugs
may be a headache but that doesn't mean they cannot be solved!

So far we know that an exception sometimes gets thrown even though it
"should not" be thrown. The question is why.


 
 Post subject: Re: JFException: Instrument [EUR/USD] not opened. Post rating: 0   Post Posted: Fri 15 Feb, 2013, 22:11 
User avatar

User rating: 6
Joined: Thu 19 May, 2011, 11:14
Posts: 235
Location: South Africa,
Just a suggestion: Why don't you insert something like

if(!context.getSubscribedInstruments().contains(ins)){
    // here be code that logs a lot of diagnostic (assumption-testing) information to the Java console
}

before

throw new JFException("Instrument " + ins + " not opened.");

If you strategically select information to log, we should know a lot more about the bug next time
I encounter it, and then you can use that information to narrow down its cause.


 
 Post subject: What does it mean if an instrument is subscribed but "not opened"? Post rating: 0   Post Posted: Tue 12 Mar, 2013, 01:13 
User avatar

User rating: 6
Joined: Thu 19 May, 2011, 11:14
Posts: 235
Location: South Africa,
IHistory.getlastTick() wrote:
com.dukascopy.api.JFException: Instrument [EUR/USD] not opened.
even while
IContext.getSubscribedInstruments() wrote:
[USD/JPY, EUR/USD]
So EUR/USD seems to be subscribed but "not opened". What does "opened" mean?

(
This situation occurs if IHistory.getLastTick() is called after the console has displayed a few messages of the following kind
Java console wrote:
12.03.2013 01:56:00.925 WARNING connect.JForexTaskManager ] Got tick for instrument [EUR/USD] that was not processed by FeedDataProvider... Instrument subscription status [false] MarketState [{"tlb":"126.3","apa":"1.30326","a":"1.30313,1.73,2.58,1.30314,1.5,6.5,1.30315,1.5,6.5,1.30318,19.7,6.5,1.30319,10.33,6.5,1.30320,10.7,6.5,1.30321,10.7,6.5,1.30322,10.13,6.5,1.30324,28.8,6.5,1.30
327,47.55,6.5","t":"1363046144939","apb":"1.30287","b":"1.30306,1.5,1.0,1.30303,2.25,1.0,1.30301,1.35,2.64,1.30300,9.75,2.64,1.30299,7.5,2.64,1.30297,3.38,2.64,1.30296,23.63,2.64,1.30295,3.75,2
.64,1.30292,5.03,2.64,1.30291,35.2,2.64","pip":"0.0001","i":"EUR/USD","type":"marketState","tla":"166.46"}]
...except if a new EUR/USD chart was opened between these console messages and the call to IHistory.getLastTick().
I have tested all these observations thoroughly.
)


 
 Post subject: Re: What does it mean if an instrument is subscribed but "not opened"? Post rating: 0   Post Posted: Tue 12 Mar, 2013, 13:08 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
We can't proceed without an example program which replicates the case and precise launch conditions.


 

Jump to:  

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