Dukascopy
 
 
Wiki JStore Search Login

JFOREX-3754 "JFException: Not subscribed to the instrument"
 Post subject: JFOREX-3754 "JFException: Not subscribed to the instrument" Post rating: 1   New post Posted: Fri 20 Apr, 2012, 15:52 
User avatar

User rating: 6
Joined: Thu 19 May, 2011, 11:14
Posts: 235
Location: South Africa,
Sometimes (perhaps once a day, on average), "IEngine.submitOrder(...)" throws "JFException: Not subscribed to the instrument [EUR/USD]" even though the platform is subscribed to EURUSD.

A contiguous snippet from the console, in reverse chronological order:
11:00:10 TRACE: Currently subscribed to [EUR/USD]
11:00:10 ERROR: JfOrderManager: Thrown in trySubmitOrder, com.dukascopy.api.JFException: Not subscribed to the instrument [EUR/USD]
11:00:07 TRACE: MessageType : INSTRUMENT_STATUS Instument : EUR/USD Tradable : true

Code fragment that produced the above snippet:
        try {
            order = engine.submitOrder(
                labelPrefix + orderIndex++,
                instrument,
                orderCommand,
                orderManager.getAmount(),
                orderManager.getEntry(),
                orderManager.getAllowedSlip(),
                orderManager.getSl(),
                orderManager.getTp(),
                orderManager.getGoodTillTime(),
                comment);
        } catch (JFException ex) {
            Debug.error("JfOrderManager: Thrown in trySubmitOrder, " + ex);
            Debug.trace("Currently subscribed to " + context.getSubscribedInstruments()); // for debugging
        }

(I can provide implementations of Debug.error and Debug.trace, orderManager.getAmount etc on request.)

FURTHER INFORMATION:
When this issue occurs, it is consistent: Even if the order is submitted repeatedly, this exception is thrown repeatedly. When this happens, I have noticed in the past that opening a new EURUSD chart makes the problem go away.

UPDATE: I have confirmed what the above paragraph says many times and further noticed that subscribing the platform to a new instrument also makes the problem go away.


 
 Post subject: Re: "JFException: Not subscribed to the instrument" even when platform is subscribed Post rating: 0   New post Posted: Sat 21 Apr, 2012, 14:59 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Did you receive any error or warning messages between the moment when the IEngine.submitOrder worked fine, and when it failed with the exception?


 
 Post subject: Re: "JFException: Not subscribed to the instrument" even when platform is subscribed Post rating: 0   New post Posted: Tue 24 Apr, 2012, 10:18 
User avatar

User rating: 6
Joined: Thu 19 May, 2011, 11:14
Posts: 235
Location: South Africa,
No, there is no warning or error message (I confirmed).
I also confirmed that opening a new EURUSD chart makes the problem go away temporarily.


 
 Post subject: Re: "JFException: Not subscribed to the instrument" even when platform is subscribed Post rating: 0   New post Posted: Wed 25 Apr, 2012, 06:38 
User avatar

User rating: 6
Joined: Thu 19 May, 2011, 11:14
Posts: 235
Location: South Africa,
In the posts above, the engine seems to "unsubscribe", and resubscribe when a new chart of that instrument is opened. I've noticed some similar (possibly related problems). Sometimes...
  • ... one of the charts would stop charting (producing flats), and would resume charting when I open (another) new chart of the same instrument.
  • ... one of the strategies would stop receiving ticks (onTick not called), and would resume receiving ticks when I open a new chart of the same instrument.
This usually seems to happen after long periods of inactivity.

BEGIN SPECULATION
It seems as if components of the system (engine, strategy, chart) sometimes become "unsubscribed" (for no apparent reason) from the client's central tick feed, and that their subscriptions are "refreshed" when a new component subscribes.
END SPECULATION


 
 Post subject: Re: "JFException: Not subscribed to the instrument" even when platform is subscribed Post rating: 0   New post Posted: Wed 25 Apr, 2012, 08:58 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Please provide full stack trace for the exception.


 
 Post subject: Re: "JFException: Not subscribed to the instrument" even when platform is subscribed Post rating: 0   New post Posted: Wed 25 Apr, 2012, 19:39 
User avatar

User rating: 6
Joined: Thu 19 May, 2011, 11:14
Posts: 235
Location: South Africa,
ex.printStackTrace wrote:
com.dukascopy.api.JFException: Not subscribed to the instrument [EUR/USD]
at com.dukascopy.api.impl.connect.ad.submitOrder(Unknown Source)
at isak.forex.engine.JfEngine.submitOrder(JfEngine.java:244)
at isak.forex.engine.JfOrderManager.trySubmitOrder(JfOrderManager.java:766)
at isak.forex.engine.JfOrderManager.kickSynch(JfOrderManager.java:622)
at isak.forex.engine.JfOrderManager.tick(JfOrderManager.java:585)
at isak.forex.engine.JfEngine.tick(JfEngine.java:143)
at isak.jforex.jfs.FoundationJfs.tick(FoundationJfs.java:535)
at isak.jforex.jfs.Jfs.onTick(Jfs.java:92)
at com.dukascopy.api.impl.execution.w.bu(Unknown Source)
at com.dukascopy.api.impl.execution.a.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at com.dukascopy.api.impl.execution.g$a.f(Unknown Source)
at com.dukascopy.api.impl.execution.g$a.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

ex.getCause() == null


 
 Post subject: Re: JFOREX-3754 "JFException: Not subscribed to the instrument" Post rating: 0   New post Posted: Thu 03 May, 2012, 15:48 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
We launched the following program for 3 days on an account where both other strategies were ran and multiple instrument subscriptions/unsubscriptions were carried out:
Attachment:
ProgramOrderSubmitter_.java [6.12 KiB]
Downloaded 454 times
We could not replicate the case. Also no other standalone user has reported such case, although there are many who run their strategies over multiple days in a row. Could you please try to recall what other actions you had carried out on the same account both in standalone and platform before this JFException was thrown?


 
 Post subject: Re: JFOREX-3754 "JFException: Not subscribed to the instrument" Post rating: 0   New post Posted: Fri 04 May, 2012, 14:48 
User avatar

User rating: 6
Joined: Thu 19 May, 2011, 11:14
Posts: 235
Location: South Africa,
Thank you.

I could be mistaken, but I think this tends to happen mostly (but not necessarily) after long periods of inactivity. For example, a strategy left to idle overnight (or over a weekend) might throw this exception first thing in the morning. Also, I have never noticed this happening while the platform is subscribed to more than one instrument; but that is just anecdotal evidence.

API Support wrote:
Also no other standalone user has reported such case

I don't know whether this bug occurs in standalone usage, but I have only been testing with a strategy in the platform. Perhaps it is a bug in the platform then? Is there a possibility that components of the platform (engine, charts, strategies) become unsubscribed from an instrument while IContext.getSubscribedInstruments() returns that instrument?

API Support wrote:
We launched the following program for 3 days on an account ...: ... We could not replicate the case.

I did not encounter the bug in the last 3 days either. But it comes and goes.

API Support wrote:
...where both other strategies were ran and multiple instrument subscriptions/unsubscriptions were carried out... ... ... Could you please try to recall what other actions you had carried out on the same account both in standalone and platform before this JFException was thrown?
IMO the bug is not induced by actions such as subscribing/unsubscribing instruments, but more likely caused by disruptions in connectivity. Quite often, it has occurred without any user-actions other than:
1. Starting the platform (which is already by default subscribed to (only) the required instrument)
2. Starting the strategy in the platform
3. Waiting until the strategy tries to place its first order, at which point the exception is thrown (consistently). (The period waited has been anything from a few minutes to a weekend.)


 

Jump to:  

  © 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