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.

Instrument tradability - IInstrumentStatusMessage
 Post subject: Instrument tradability - IInstrumentStatusMessage Post rating: 0   New post Posted: Fri 23 Sep, 2016, 17:23 
User avatar

User rating: 0
Joined: Sun 04 Aug, 2013, 10:16
Posts: 48
Location: FranceFrance
Hi please help the wiki is not very explanatory nor does it provides any example.

https://www.dukascopy.com/wiki/#Instrument_tradability

i've tried

  
import com.dukascopy.api.IInstrumentStatusMessage;
//...
public void onStart(IContext context) throws JFException {

        context.setSubscribedInstruments(instruments);

    }


public void onInstrumentStatusMessage(IInstrumentStatusMessage message) throws JFException {

      if (instruments.contains(message.getInstrument())) {


       console.getOut().println("onInstrumentStatusMessage(IInstrumentStatusMessage  -- ---"+message.getInstrument()+" tradable "+message.isTradable());

       }
    }
  public void onMessage(IInstrumentStatusMessage message) throws JFException {

       if (instruments.contains(message.getInstrument())) {


         console.getOut().println("onMessage(IInstrumentStatusMessage  -- ---"+message.getInstrument()+" tradable "+message.isTradable());
       }

 


algo doesn't seem to receive any status message

please api support explain me how this IInstrumentStatusMessage interface works as it's advertised to in the wiki. i've been losing hours on this already...


 
 Post subject: Re: Instrument tradability - IInstrumentStatusMessage Post rating: 0   New post Posted: Mon 26 Sep, 2016, 00:02 
User avatar

User rating: 0
Joined: Sun 04 Aug, 2013, 10:16
Posts: 48
Location: FranceFrance
in case anyone is interested here is a work around until the support deign to explain how to use .isTradable()

 
public Instrument instrument;
public boolean instrumentIsTradable;

public void onMessage(IMessage message) throws JFException {

      if (message.getType().equals(IMessage.Type.INSTRUMENT_STATUS)) {
          String m = message.toString();
          if (m.contains(instrument.toString())) instrumentIsTradable = m.contains("true") ? true : false;
}


 
 Post subject: Re: Instrument tradability - IInstrumentStatusMessage Post rating: 0   New post Posted: Mon 26 Sep, 2016, 21:04 
User avatar

User rating: 0
Joined: Fri 04 Sep, 2015, 19:44
Posts: 34
Location: Slovakia, KE
In manual, there is tradeability by hours checking, but you must know exact hours.


 
 Post subject: Re: Instrument tradability - IInstrumentStatusMessage Post rating: 0   New post Posted: Wed 28 Sep, 2016, 08:33 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Instrument trading hours usually don't change. Historical trading hours can be seen on chart by disabling flats filtering.
That can be done from settings by selecting Tools > Preferences > Chart Flats Filter is disabled.


 
 Post subject: Re: Instrument tradability - IInstrumentStatusMessage Post rating: 0   New post Posted: Thu 29 Sep, 2016, 17:07 
User avatar

User rating: 0
Joined: Sun 04 Aug, 2013, 10:16
Posts: 48
Location: FranceFrance
got an answer from support,

here is how to use IInstrumentStatusMessage.isTradable() :

    
public void onMessage(IMessage message) throws JFException {
        if(message instanceof IInstrumentStatusMessage) {
            IInstrumentStatusMessage instrumentMessage = (IInstrumentStatusMessage) message;
            console.getOut().println("Instrument: "+ instrumentMessage.getInstrument()+ ", isTradable: "+ instrumentMessage.isTradable());           
        }
    }


thanks to them


 

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