Class OptionsRunTimeDataBase<EquityStateType extends InstrumentState,​RootStateType extends OptionRootState<? super EquityStateType>,​OptionStateType extends OptionState<? super RootStateType>>


  • public class OptionsRunTimeDataBase<EquityStateType extends InstrumentState,​RootStateType extends OptionRootState<? super EquityStateType>,​OptionStateType extends OptionState<? super RootStateType>>
    extends EquitiesRunTimeDataBase<EquityStateType>

    A run-time database capable of holing information about equities, option roots and option contracts. Provides extremely fast lookup capability. This class can be extended to add fields to the objects it can hold, as well as to hold additional types objects.

    This class is not thread-safe

    • Constructor Detail

      • OptionsRunTimeDataBase

        public OptionsRunTimeDataBase()
    • Method Detail

      • options

        public final java.util.Collection<OptionStateType> options()
        Returns a read-only collection of all option sates.
      • roots

        public final java.util.Collection<RootStateType> roots()
        Returns a read-only collection of all option roots.
      • createRootState

        protected RootStateType createRootState​(EquityStateType underlier,
                                                java.lang.String symbol)
        Override to create a subclass of OptionRootState.
      • createOptionState

        protected OptionStateType createOptionState​(RootStateType rootState,
                                                    java.lang.String symbol)
        Override to create a subclass of OptionState.
      • clearOptionRoots

        public void clearOptionRoots()
        Clear option roots and contracts. Leave equities alone.
      • clearOptions

        public void clearOptions()
        Clear option information only.
      • getRootState

        public final RootStateType getRootState​(java.lang.CharSequence symbol)
        Look up a root state by symbol.
        Parameters:
        symbol - The option or root symbol; only three first characters are used.
        Returns:
        Equity state object, or null if not found.
      • getOrCreateRootState

        public final RootStateType getOrCreateRootState​(EquityStateType underlier,
                                                        java.lang.CharSequence symbol)
        Look up a root state by symbol, or add one to the database if it does not exist. This method immediately maps the root to the specified underlier.
        Parameters:
        underlier - Known state of the underlying instrument.
        symbol - The option or root symbol; only three first characters are used.
        Returns:
        Root state object.
        Throws:
        java.lang.IllegalStateException - When the root state is already mapped to another underlying instrument.
      • getOptionState

        public final OptionStateType getOptionState​(java.lang.CharSequence symbol)
        Look up an option state by full option symbol.
        Parameters:
        symbol - The 21-character option symbol.
        Returns:
        Option state object, or null if not found.
      • getOrCreateOptionState

        public final OptionStateType getOrCreateOptionState​(java.lang.CharSequence symbol)
        Parameters:
        symbol - 21 character option symbol
        Returns:
        can be null if option state doesn't exist and option root is unknown
      • getOrCreateOptionState

        public final OptionStateType getOrCreateOptionState​(RootStateType root,
                                                            java.lang.CharSequence symbol)
        Look up an option state by 21-character symbol, or add one to the database if it does not exist. This method immediately maps the option to the specified underlier.
        Parameters:
        root - The root state object.
        symbol - The 21-character option symbol.
        Returns:
        Option state object.
        Throws:
        java.lang.IllegalArgumentException - When the root state object is wrong.
      • getOrCreateOptionState

        public final OptionStateType getOrCreateOptionState​(EquityStateType underlier,
                                                            java.lang.CharSequence symbol)
        Look up an option state by 21-character symbol, or add one to the database if it does not exist. This method immediately maps the option to the specified underlier.
        Parameters:
        symbol - The 21-character option symbol.
        Returns:
        Option state object.
        Throws:
        java.lang.IllegalStateException - When the root state is already mapped to another underlying instrument.