Post subject: Get the Instrument from IInstrumentStatusMessage
Post rating: 0
Posted: Wed 13 Dec, 2017, 11:27
User rating: 0
Joined: Fri 11 Sep, 2015, 15:43 Posts: 8 Location: Italy, Roma
Hi, suppose I've started a strategy and I've subscribed many instruments in the onStart() method. Suppose that no order are open. With a frequency of about 30s, I should receive in the onMessage() method several IInstrumentStatusMessage objects: one for each instrument I'm subscribed to. As far as I understood, by checking if IInstrumentStatusMessage.isTradable() is the only one way to double-check if an instrument is tradable or not at a certain moment before trying to submit an order.
My question is: which is the best way to understand which is the instrument each IInstrumentStatus message is referring to? I've seen that by printing the IMessage object, the instrument is available in the output String, but I would like to know if there is any other "more direct and reliable" way to get the reference instrument for each IInstrumentStatusMessage received.