Using API 2.7.8
Request for 2 related enhancements to IFeedListener for standalone API client.
I posted:
Possible Workaround: How to implement IFeedListener in standalone client?
in this thread:
viewtopic.php?f=65&t=487021) It is very difficult for a standalone API client to establish an IFeedListener, and the thread above describes a method to obtain IClient so that IClient.subscribeToTicksFeed or
IClient.subscribeToFeed can be used (code snippet shown below).
Please provide a straightforward method for standalone API client to establish a listener,
without the need to use the IStrategy approach.
2) The listener is active with this approach, but then ITick.getBids() and ITick.getAsks() within the IFeedListener returns an array
with only 1 element so full Market Depth is not available. How can full market depth
be made available to the feed listener?
Please populate the ITick with Market Depth in the listener.
// want to get IContext so try to do it this way (need a better way)
getClient().startStrategy(new EmptyStrategy() {
@Override
public void onStart(IContext contextArg) throws JFException {
context = contextArg;
//indicators = contextArg.getIndicators();
}
});
//the startegy has been started in another thread, thus the onStart has not been called at this point yet
//wait max
int i = 10;
while (context == null && i > 0) {
Thread.sleep(1000);
i--;
System.out.println("Context is: "+(context==null?"NULL":"AVAILABLE"));
}
if (context!=null) {
System.out.println("Set HyperScalperConsoleSA as a feed listener...");
//context.subscribeToFeed(ticksFeedDescriptor, this);
context.subscribeToTicksFeed(selectedInstrument, this); // implements ITickFeedListener
}
Advise me if I've done something wrong, but am unable to get Market Depth using this approach, on EUR/USD for Tick feeds only. I tried with an IFeedDescriptor and with an ITickFeedDescriptor and couldn't not see Market Depth with either approach. Please advise.
Thanks !
HyperScalper