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.

Unsubscribe to instruments
 Post subject: Unsubscribe to instruments Post rating: 0   New post Posted: Mon 15 Jul, 2013, 22:14 

User rating: 0
Joined: Sat 08 Jun, 2013, 12:05
Posts: 71
Location: FranceFrance
I didn't expect that but
Set<Instrument> instruments = new HashSet<Instrument>(Arrays.asList(Instrument.values()));
context.setSubscribedInstruments(instruments);
System.out.println(context.getSubscribedInstruments().size());
Set<Instrument> instruments2 = new HashSet<Instrument>();
for (IOrder o : engine.getOrders())
   if (o.getState() == State.FILLED)
      instruments2.add(o.getInstrument());

context.setSubscribedInstruments(instruments2); // or , true
System.out.println(context.getSubscribedInstruments().size());

will return 66 two times, it's not really important though, I'd just rarely subscribe to all for downloading orders history, and re-run it after


 
 Post subject: Re: Unsubscribe to instruments Post rating: 0   New post Posted: Tue 16 Jul, 2013, 08:06 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
You can't unsubscribe instruments from the strategy. If it was possible, it would interfere with the platform work.


 
 Post subject: Re: Unsubscribe to instruments Post rating: 0   New post Posted: Tue 16 Jul, 2013, 12:37 

User rating: 0
Joined: Sat 08 Jun, 2013, 12:05
Posts: 71
Location: FranceFrance
Yet you can subscribe from a strategy, right? I'm doing this when capturing a new order, I subscribe to the instrument (it is maybe unnecessary?)


 
 Post subject: Re: Unsubscribe to instruments Post rating: 0   New post Posted: Tue 16 Jul, 2013, 12:38 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Yes.


 

Jump to:  

  © 1998-2026 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