Interface InstrumentsManager
public interface InstrumentsManager
Interface for managing subscribed instruments, allows tracking instruments list when
RunModeHelper.isDuplicatedInstruments() is on and off.
To use this class, you need to call onInstrumentAdded(String, InstrumentInfo) on each
Layer1ApiInstrumentListener.onInstrumentAdded(String, InstrumentInfo),
and onInstrumentRemoved(String) on each
Layer1ApiInstrumentListener.onInstrumentRemoved(String).
To get the appropriate instance of the interface, you can use InstrumentsManagerFactory.getInstrumentsManager().
-
Method Summary
Modifier and TypeMethodDescriptionbooleancanHasChart(String alias) getAvailableAliases(String alias) Get all available aliases (with charts) for the given alias.getOriginalAliasOrReturn(String alias) Get the original alias for the given alias, or return the given alias if the given alias is not found.booleanisOriginal(String alias) voidonInstrumentAdded(String alias, InstrumentInfo instrumentInfo) voidonInstrumentRemoved(String alias)
-
Method Details
-
onInstrumentAdded
-
onInstrumentRemoved
-
getAvailableAliases
Get all available aliases (with charts) for the given alias. e.g. if the application is run in duplicatedInstruments mode, only duplicated aliases will be returned. Otherwise, only the original alias will be returned (if it's subscribed).- Parameters:
alias- the original alias- Returns:
- set of available aliases
-
getOriginalAliasOrReturn
Get the original alias for the given alias, or return the given alias if the given alias is not found.- Parameters:
alias- the alias to get the original alias for (can be either original or duplicate alias)
-
canHasChart
- Parameters:
alias- the alias of the instrument- Returns:
- true if the instrument with the given alias is subscribed and can have a chart (e.g. if it's a duplicated or synthetic instrument in duplicated instruments mode, or any instrument in non-duplicated instruments mode), false otherwise (e.g. if it's an original instrument in duplicatedInstruments mode) You may use this method to check if the indicator should be created for the alias, since indicators should only be created for instruments with charts
-
isOriginal
- Parameters:
alias- the alias of the instrument- Returns:
- true if the instrument with the given alias is subscribed and is an original instrument (e.g. if it's an original or synthetic instrument in duplicated instruments mode, or any instrument in non-duplicated instruments mode), false otherwise (e.g. if it's a duplicated instrument in duplicated instruments mode) You may use this method to check if the generator should be created for the alias, since generators should only be created for original instruments
-