Package deltix.qsrv.hf.blocks
Class OptionsRunTimeDataBase<EquityStateType extends InstrumentState,RootStateType extends OptionRootState<? super EquityStateType>,OptionStateType extends OptionState<? super RootStateType>>
- java.lang.Object
-
- deltix.qsrv.hf.blocks.EquitiesRunTimeDataBase<EquityStateType>
-
- deltix.qsrv.hf.blocks.OptionsRunTimeDataBase<EquityStateType,RootStateType,OptionStateType>
-
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 Summary
Constructors Constructor Description OptionsRunTimeDataBase()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearAll()
Clear the entire database.void
clearOptionRoots()
Clear option roots and contracts.void
clearOptions()
Clear option information only.protected OptionStateType
createOptionState(RootStateType rootState, java.lang.String symbol)
Override to create a subclass of OptionState.protected RootStateType
createRootState(EquityStateType underlier, java.lang.String symbol)
Override to create a subclass of OptionRootState.OptionStateType
getOptionState(java.lang.CharSequence symbol)
Look up an option state by full option symbol.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.OptionStateType
getOrCreateOptionState(java.lang.CharSequence symbol)
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.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.RootStateType
getRootState(java.lang.CharSequence symbol)
Look up a root state by symbol.java.util.Collection<OptionStateType>
options()
Returns a read-only collection of all option sates.java.util.Collection<RootStateType>
roots()
Returns a read-only collection of all option roots.void
setSubscription(EntityAndTypeSubscriptionController subscription)
-
Methods inherited from class deltix.qsrv.hf.blocks.EquitiesRunTimeDataBase
createEquityState, equities, getEquityState, getOrCreateEquityState
-
-
-
-
Method Detail
-
options
public final java.util.Collection<OptionStateType> options()
Returns a read-only collection of all option sates.
-
setSubscription
public void setSubscription(EntityAndTypeSubscriptionController subscription)
- Overrides:
setSubscription
in classEquitiesRunTimeDataBase<EquityStateType extends InstrumentState>
-
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.
-
clearAll
public void clearAll()
Clear the entire database.- Overrides:
clearAll
in classEquitiesRunTimeDataBase<EquityStateType extends InstrumentState>
-
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.
-
-