I'm curious how to make it work in plugin. The ticks i receive there have only 1-level depth of market. Is it possible to make it 10-level depth?
Here is the dummy plugin's code i tried (mostly copy/pasted from Strategy provided ealier)
package jforex;
import java.util.*;
import com.dukascopy.api.*;
import com.dukascopy.api.plugins.*;
import com.dukascopy.api.feed.ITickFeedListener;
public class MarketLogger extends Plugin implements ITickFeedListener {
private IPluginContext context;
private IConsole console;
public void onStart(IPluginContext context) throws JFException {
this.context = context;
this.console = context.getConsole();
Set<Instrument> instruments = new HashSet<Instrument>();
instruments.add(Instrument.EURUSD);
this.context.setSubscribedInstruments(instruments);
this.context.subscribeToTicksFeed(Instrument.EURUSD, this);
}
public void onStop() throws JFException {
}
@Override
public void onTick(final Instrument instrument, final ITick tick) {
if(!Instrument.EURUSD.equals(instrument)) {
return;
}
console.getOut().print("ask ");
for(double volume : tick.getAskVolumes()) {
console.getOut().print(volume+ ", ");
}
console.getOut().println();
console.getOut().print("bid ");
for(double volume : tick.getBidVolumes()) {
console.getOut().print(volume+ ", ");
}
console.getOut().println();
}
}