I would like to report a serious issues with IConext.getSubscribedInstruments() method. The returned set is not reliable.
Please consider following situation and scenario:
Beginning state: Account currency: USD, One Chart opened EUR/CAD, JForex Platform instruments list contains one instrument EUR/CAD.
Steps to reproduce the defect and observations
1. Start the attached strategy (it subscribes to GBP/CHF and then at every tick, it checks which ticks are being received and which instruments strategy is subscribed to) Observation 1A: List of instruments gets bigger, now it contains EUR/CAD, GBP/CHF and USD/CHF (OK) Observation 1B: Strategy receives ticks for all three instruments and correctly informs that strategy is subscribed to to the above three instruments. (OK)
2. Go to the JForex’ list of instruments, press right mouse and select “Remove all” Observation 2A: JForex’ list of instruments shrinks to EUR/CAD due to opened EUR/CAD chart. (OK) Observation 2B: The strategy receives ticks only for EUR/CAD and correctly informs that it is subscribed to the EUR/CAD only. (OK)
3. Stop strategy.
4. Start the strategy again Observations: the same as for point number 1. (OK)
5. Again go to the JForex’ list of instruments, press right mouse and select “Remove all” Observation 5A: JForex’ list of instruments shrinks to EUR/CAD due to opened EUR/CAD chart. (OK) Observation 5B: The strategy receives ticks only for EUR/CAD but it incorrectly informs it is subscribed to the EUR/CAD and GBP/CHF and never receives tick for GBP/CHF.
This causes the IContext.getSubscribedInstruments() highly unreliable.
If I can suggest a solutions: 1. Simply fix the issue or 2. Introduce separation of subscribed instruments in such a way that strategy subscription does not affect platforms instruments and vice versa. Please, keep the ability of check which instruments platform is subsribed to.
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on
this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control
on their content. Anyone accessing this webpage and downloading or otherwise making use of any document,
data or information found on this webpage shall do it on his/her own risks without any recourse against
Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from
the use and/or reliance on any document, data or information found on this webpage.
suryasivafx
Post subject: Re: IContext.getSubscribedInstruments() not reliable (high priority)
I think the real issue is that there is no way to figure out how whether a subscribe /unsubscribe operation has been successful or unsuccessful. Also there could be reasons other than the straightforward subscribe /unsubscribe api calls that would make an instrument to be present/absent from the subscribed instruments list.
One could keep calling the getSubscribedInstruments() and comparing the list with the internally stored one but this is not optimal.
Is it possible to add a InstrumentSubscriptionListener of some sort that would get called at every subscribe / unsubscribe event notifying the add/remove of each instrument ? This way the strategy can take care of the changes internally?
API Support
Post subject: Re: IContext.getSubscribedInstruments() not reliable (high priority)