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.

IContext.getSubscribedInstruments() not reliable (high priority)
 Post subject: IContext.getSubscribedInstruments() not reliable (high priority) Post rating: 0   New post Posted: Wed 25 Oct, 2017, 18:28 
User avatar

User rating: 8
Joined: Mon 09 Jun, 2014, 21:07
Posts: 49
Location: Poland, Warsaw
Hi Dukascopy team,

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.

Best regards,
Greg


Attachments:
Strategy.java [1.17 KiB]
Downloaded 165 times
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.
 
 Post subject: Re: IContext.getSubscribedInstruments() not reliable (high priority) Post rating: 1   New post Posted: Mon 06 Nov, 2017, 06:47 

User rating: 1
Joined: Tue 10 Oct, 2017, 08:11
Posts: 10
Location: SingaporeSingapore
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?


 
 Post subject: Re: IContext.getSubscribedInstruments() not reliable (high priority) Post rating: 0   New post Posted: Mon 18 Dec, 2017, 13:29 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Issue with instrument subscription is fixed and will be available with next platform release.

To get Subscribed instrument strategy can call:
IContext.getSubscribedInstruments()

Or monitor message with type IMessage.Type.INSTRUMENT_STATUS


 

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