Class FuturesFitDataManager<DATATYPE extends FuturesFitData>

java.lang.Object
com.illumon.modelfarm.fitterfarm.futures.FuturesFitDataManager<DATATYPE>
Type Parameters:
DATATYPE - data type
All Implemented Interfaces:
RowDataManager<FitScope,DATATYPE>

public class FuturesFitDataManager<DATATYPE extends FuturesFitData> extends Object implements RowDataManager<FitScope,DATATYPE>
Utility for accessing and querying futures fit data contained in a dynamic table.
  • Field Details

    • csFitGroup

      protected final ColumnSource csFitGroup
    • csTimestamp

      protected final ColumnSource csTimestamp
    • csUnderlyingId

      protected final ColumnSource csUnderlyingId
    • csUnderlyingSym

      protected final ColumnSource csUnderlyingSym
    • csFutureIds

      protected final ColumnSource csFutureIds
    • csFutureSyms

      protected final ColumnSource csFutureSyms
    • csFutureExpirations

      protected final ColumnSource csFutureExpirations
    • csFutureBids

      protected final ColumnSource csFutureBids
    • csFutureAsks

      protected final ColumnSource csFutureAsks
    • csFutureLasts

      protected final ColumnSource csFutureLasts
    • csFutureBidSizes

      protected final ColumnSource csFutureBidSizes
    • csFutureAskSizes

      protected final ColumnSource csFutureAskSizes
    • csFutureBidGaps

      protected final ColumnSource csFutureBidGaps
    • csFutureAskGaps

      protected final ColumnSource csFutureAskGaps
    • csUnderlyingFutureIds

      protected final ColumnSource csUnderlyingFutureIds
    • csOptionIds

      protected final ColumnSource csOptionIds
    • csOptionSyms

      protected final ColumnSource csOptionSyms
    • csOptionRoots

      protected final ColumnSource csOptionRoots
    • csOptionPayoffTypes

      protected final ColumnSource csOptionPayoffTypes
    • csOptionExerciseTypes

      protected final ColumnSource csOptionExerciseTypes
    • csOptionSettlementTypes

      protected final ColumnSource csOptionSettlementTypes
    • csOptionExpirations

      protected final ColumnSource csOptionExpirations
    • csOptionStrikes

      protected final ColumnSource csOptionStrikes
    • csYieldCurveDates

      protected final ColumnSource csYieldCurveDates
    • csYieldCurveRates

      protected final ColumnSource csYieldCurveRates
  • Constructor Details

    • FuturesFitDataManager

      public FuturesFitDataManager(Supplier<DATATYPE> newFitData, RowDataManager.LoadExtraColumns<DATATYPE> loadFitDataExtraColumns, DynamicTable data)
      Create a multithreaded resource to fit a derivative model's parameters for futures.

      The input table must have the following columns:

      • Timestamp: DBDateTime
      • FitGroup: String
      • UnderlyingId: long
      • UnderlyingSym: String
      • FutureId: DbLongArray
      • FutureSym: DbArray<String>
      • FutureExpiration: DbArray<DBDateTime>
      • FutureBid: DbDoubleArray
      • FutureAsk: DbDoubleArray
      • FutureLast: DbDoubleArray (optional)
      • FutureBidSize: DbDoubleArray (optional)
      • FutureAskSize: DbDoubleArray (optional)
      • FutureBidGap: DbDoubleArray (optional)
      • FutureAskGap: DbDoubleArray (optional)
      • UnderlyingFutureId: DbLongArray
      • OptionId: DbLongArray
      • OptionSym: DbArray<String>
      • OptionRoot: DbArray<String> (optional)
      • OptionPayoffType: DbArray<String>
      • OptionExerciseType: DbArray<String>
      • OptionExpiration: DbArray<DBDateTime>
      • OptionStrike: DbDoubleArray
      • YieldCurveDate: DbArray<DBDateTime>
      • YieldCurveRate: DbArray<DBDateTime>
      Parameters:
      newFitData - function to create a new FitData of the proper type.
      loadFitDataExtraColumns - function to parse the data at a specific table index and load it into the FitData.
      data - data for fitting the option model.
  • Method Details

    • table

      public DynamicTable table()
      Description copied from interface: RowDataManager
      Gets the source table.
      Specified by:
      table in interface RowDataManager<FitScope,DATATYPE extends FuturesFitData>
      Returns:
      source table.
    • newData

      public DATATYPE newData()
      Description copied from interface: RowDataManager
      Creates a new data instance.
      Specified by:
      newData in interface RowDataManager<FitScope,DATATYPE extends FuturesFitData>
      Returns:
      new data instance.
    • uniqueIdCurrent

      public FitScope uniqueIdCurrent(long index)
      Description copied from interface: RowDataManager
      Gets the current unique identifier value for a row.

      This function should only be called during an update loop or while holding the LTM lock.

      Specified by:
      uniqueIdCurrent in interface RowDataManager<FitScope,DATATYPE extends FuturesFitData>
      Parameters:
      index - table row index.
      Returns:
      current unique identifier for a row.
    • uniqueIdPrev

      public FitScope uniqueIdPrev(long index)
      Description copied from interface: RowDataManager
      Gets the previous unique identifier value for a row. One column of each table is designated as a unique identifier for data rows.

      This function should only be called during an update loop or while holding the LTM lock.

      Specified by:
      uniqueIdPrev in interface RowDataManager<FitScope,DATATYPE extends FuturesFitData>
      Parameters:
      index - table row index.
      Returns:
      previous underlying id.
    • loadData

      public void loadData(DATATYPE fitData, long index, boolean usePrev)
      Description copied from interface: RowDataManager
      Populates a data object with data from a table row.

      This method should be called while the LTM lock is held. This can occur either during the update loop or the LTM lock can be acquired outside the update loop. If the LTM lock is not held, the loaded data can be inconsistent or corrupt.

      Specified by:
      loadData in interface RowDataManager<FitScope,DATATYPE extends FuturesFitData>
      Parameters:
      fitData - data structure to populate
      index - table index of the row to load data from
      usePrev - use data from the previous table update