User rating: 0
Joined: Tue 24 May, 2011, 15:47 Posts: 8 Location: United KingdomUnited Kingdom
Everytime I subscribe to a certain instrument in my strategy (using the ICLIENT interface), an additional instrument (one which I dont want to subscribe to) also gets subscribed. For example, I subscribe to the instrument using the code below:
In the strategy, I print the instruments that are visible using the code below: .......... public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) { if (period == Period.TEN_SECS){ System.out.println(instrument + " Close " + askBar.getClose() + " at " + DateMan.longToString_ss(askBar.getTime())); } } ..........
The output I get when the strategy runs is: NZD/USD Close 0.82803 at 04-Jul-2011 16:24:10 GBP/NZD Close 1.94111 at 04-Jul-2011 16:24:10 NZD/USD Close 0.82804 at 04-Jul-2011 16:24:20 GBP/NZD Close 1.94111 at 04-Jul-2011 16:24:20 NZD/USD Close 0.82804 at 04-Jul-2011 16:24:30 GBP/NZD Close 1.9411 at 04-Jul-2011 16:24:30
I am not sure where the instrument "NZD/USD" came from. I am getting the same result from both API 2.6.38 and API 2.6.42.
I am not sure where the instrument "NZD/USD" came from. I am getting the same result from both API 2.6.38 and API 2.6.42.
Is this expected behavior.
Yes, it is normal behaviour, because if your account currency is USD, then obviously P/L is displayed in USD. So in order to calculate your P/L NZD/USD is subscribed.
nimpat
Post subject: Re: Instrument Subscription issues.
Post rating: 0
Posted: Sun 10 Jul, 2011, 15:25
User rating: 0
Joined: Tue 24 May, 2011, 15:47 Posts: 8 Location: United KingdomUnited Kingdom
Ah. That explains it. Thanks for the reply. I will use some kind a filter within the strategy to consider only the pairs I want.