Hi,
I want to select one of all instruments displayed in bookmap using a combo inside a settings dialog.
i tried to get all instruments into a list using :
public void onInstrumentAdded(InstrumentInfo info)
it works but it's not populated before the first time i display my settings dialog.
how to list all selected instruments ?
-
- Posts: 545
- Joined: Mon Jul 09, 2018 11:18 am
- Has thanked: 22 times
- Been thanked: 83 times
Re: how to list all selected instruments ?
Hi jeff87,
you need to implement Layer1ApiInstrumentSpecificEnabledStateProvider to manage actions triggered by strategy checkbox changed state. Please check this interface description in the javadoc.
You can get active instruments adding an instrument listener (adapter) to its provider.
I forgot to mention this example is for Core API. It is not possible to do it with Simplified API.
(just a simple example)
you need to implement Layer1ApiInstrumentSpecificEnabledStateProvider to manage actions triggered by strategy checkbox changed state. Please check this interface description in the javadoc.
You can get active instruments adding an instrument listener (adapter) to its provider.
I forgot to mention this example is for Core API. It is not possible to do it with Simplified API.
(just a simple example)
Code: Select all
public class InstrumentReceiver implements Layer1ApiInstrumentSpecificEnabledStateProvider, Layer1ApiFinishable {
Layer1ApiProvider provider;
public InstrumentReceiver(Layer1ApiProvider provider) {
super();
this.provider = provider;
provider.addListener(new Layer1ApiInstrumentAdapter() {
@Override
public void onInstrumentAdded(String alias, InstrumentInfo instrumentInfo) {
System.out.println("from Layer1ApiProvider provider added " + alias);
}
});
}
// ...