Class Level2Config


  • public final class Level2Config
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static double CHECK_BITWISE_EQUALITY
      A special constant for verifying prices and sizes, which tells the processor to assert bitwise equality of numbers.
      static int INAN  
      static long LNAN  
    • Constructor Summary

      Constructors 
      Constructor Description
      Level2Config()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static long d2n​(double d)  
      static long decexp2n​(long significand, int exp)
      Converts an floating-point decimal number to fixed-point representation used by the L2 processor.
      boolean getCheckDeleteAugmentation()
      Returns whether the simulator should verify that the DELETE command supplies the correct price and size.
      CheckMode getCheckSnapshotFrequency()
      Returns whether the simulator should verify that snapshots are present at the specified frequency, or insert snapshots to comply.
      boolean getCheckSnapshotOrder()
      Returns whether the simulator should verify that the OFFER snapshot immediately follows the BID snapshot.
      boolean getConvertToL1()
      Returns whether level 2 data should be converted to level 1.
      double getDACPriceTolerance()
      Returns the price tolerance used for delete augmentation checking.
      double getDACSizeTolerance()
      Returns the size tolerance used for delete augmentation checking.
      boolean getFixDepth()
      Returns whether the depth/action data should be ignored in the incoming messages.
      int getMaxNumLevels()
      Returns the maximum number of levels in input L2 data.
      int getMaxOutputNumLevels()
      Returns the maximum number of levels in input L2 data.
      double getMinBidOfferDistance()
      Returns the Bid-Offer Distance tolerance.
      long getPeriodicSnapshotInterval()
      Returns the snapshot augmentation interval, in milliseconds.
      double getPriceOrderingTolerance()
      Returns the Price Ordering Tolerance.
      SelfValidationLevel getSelfValidationLevel()
      Returns the self-validation level.
      static double n2d​(long n)  
      void setCheckDeleteAugmentation​(double priceTolerance, double sizeTolerance)
      Turns on the DELETE augmentation check, which is that the DELETE command supplies the correct price and size.
      void setCheckSnapshotFrequency​(CheckMode mode)
      Configures whether the simulator should verify that snapshots are present at the specified frequency, or insert snapshots to comply.
      void setCheckSnapshotOrder​(boolean mode)
      Configures whether the simulator should verify that the OFFER snapshot immediately follows the BID snapshot.
      void setConvertToL1​(boolean convertToL1)
      Configures whether level 2 data should be converted to level 1.
      void setFixDepth​(boolean f)
      Configures whether the depth/action data should be ignored in the incoming messages.
      void setMaxNumLevels​(int n)
      Configures the maximum number of levels in input L2 data.
      void setMaxOutputNumLevels​(int n)
      Configures the maximum number of levels in input L2 data.
      void setMinBidOfferDistance​(double minBidOfferDistance)
      Configures the Bid-Offer Distance tolerance.
      void setNoCheckDeleteAugmentation()
      Turns off the DELETE augmentation check.
      void setOutputChannel​(deltix.data.stream.MessageChannel<deltix.qsrv.hf.pub.InstrumentMessage> outputChannel)
      Configures the channel that will receive output events.
      void setPeriodicSnapshotInterval​(long periodicSnapshotInterval)
      Configures the snapshot augmentation interval, in milliseconds.
      void setPriceOrderingTolerance​(double priceTolerance)
      Configures the Price Ordering Tolerance.
      void setSelfValidationLevel​(SelfValidationLevel level)
      Sets the self-validation level, allowing the processor to double-check its own output.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • CHECK_BITWISE_EQUALITY

        public static final double CHECK_BITWISE_EQUALITY
        A special constant for verifying prices and sizes, which tells the processor to assert bitwise equality of numbers.
        See Also:
        Constant Field Values
    • Constructor Detail

      • Level2Config

        public Level2Config()
    • Method Detail

      • n2d

        public static double n2d​(long n)
      • d2n

        public static long d2n​(double d)
      • decexp2n

        public static long decexp2n​(long significand,
                                    int exp)
        Converts an floating-point decimal number to fixed-point representation used by the L2 processor.
        Parameters:
        significand - The significand value as long.
        exp - The positive number of fractional digits (-exponent). For instance, significand = 1234 and exp = 2 represent the number 12.34.
      • setMaxNumLevels

        public void setMaxNumLevels​(int n)
        Configures the maximum number of levels in input L2 data.
      • getMaxNumLevels

        public int getMaxNumLevels()
        Returns the maximum number of levels in input L2 data.
      • setMaxOutputNumLevels

        public void setMaxOutputNumLevels​(int n)
        Configures the maximum number of levels in input L2 data.
      • getMaxOutputNumLevels

        public int getMaxOutputNumLevels()
        Returns the maximum number of levels in input L2 data.
      • getConvertToL1

        public boolean getConvertToL1()
        Returns whether level 2 data should be converted to level 1.
      • setConvertToL1

        public void setConvertToL1​(boolean convertToL1)
        Configures whether level 2 data should be converted to level 1.
      • getFixDepth

        public boolean getFixDepth()
        Returns whether the depth/action data should be ignored in the incoming messages. When this mode is on, the processor will:
        1. For all messages, ignore the supplied depth value, and instead find it by searching the (ordered) price array.
        2. For INSERT and UPDATE messages, the specified action is ignored. If a price is found, the action is automatically reset to UPDATE. Otherwise, the action is reset to INSERT.
      • setFixDepth

        public void setFixDepth​(boolean f)
        Configures whether the depth/action data should be ignored in the incoming messages. When this mode is on, the processor will:
        1. For all messages, ignore the supplied depth value, and instead find it by searching the (ordered) price array.
        2. For INSERT and UPDATE messages, the specified action is ignored. If a price is found, the action is automatically reset to UPDATE. Otherwise, the action is reset to INSERT.
      • getMinBidOfferDistance

        public double getMinBidOfferDistance()
        Returns the Bid-Offer Distance tolerance. The rule is: when initialized and consistent, TOP-BID + TOLERANCE <= TOP-OFFER.
        Returns:
        A negative value allows top bid and ask to be equal (or even marginally cross within the tolerance value). A positive value requires that top bid and ask be within the minimum specified distance. Double.NaN turns off the check.
      • setMinBidOfferDistance

        public void setMinBidOfferDistance​(double minBidOfferDistance)
        Configures the Bid-Offer Distance tolerance. The rule is: when initialized and consistent, TOP-BID + TOLERANCE <= TOP-OFFER.
        Parameters:
        minBidOfferDistance - A negative value allows top bid and ask to be equal (or even marginally cross within the tolerance value). A positive value requires that top bid and ask be within the minimum specified distance. Double.NaN turns off the check.
      • getPriceOrderingTolerance

        public double getPriceOrderingTolerance()
        Returns the Price Ordering Tolerance. The rule is: when initialized and consistent, PRICE[n] + TOLERANCE <= PRICE [n+1]
        Returns:
        A negative value allows adjacent prices to be equal (or even marginally cross each other within the tolerance value). A positive value requires that adjacent prices be within the minimum specified distance. Double.NaN turns off the check.
      • setPriceOrderingTolerance

        public void setPriceOrderingTolerance​(double priceTolerance)
        Configures the Price Ordering Tolerance. The rule is: when initialized and consistent, PRICE[n] + TOLERANCE <= PRICE [n+1]
        Parameters:
        priceTolerance - A negative value allows adjacent prices to be equal (or even marginally cross each other within the tolerance value). A positive value requires that adjacent prices be within the minimum specified distance. Double.NaN turns off the check.
      • setOutputChannel

        public void setOutputChannel​(deltix.data.stream.MessageChannel<deltix.qsrv.hf.pub.InstrumentMessage> outputChannel)
        Configures the channel that will receive output events.
      • getPeriodicSnapshotInterval

        public long getPeriodicSnapshotInterval()
        Returns the snapshot augmentation interval, in milliseconds. Snapshots will be generated as soon as this threshold is exceeded AND the next increment message arrives. Conversely, snapshots are NOT generated every period IF no data is coming in.
      • setPeriodicSnapshotInterval

        public void setPeriodicSnapshotInterval​(long periodicSnapshotInterval)
        Configures the snapshot augmentation interval, in milliseconds. Snapshots will be generated as soon as this threshold is exceeded AND the next increment message arrives. Conversely, snapshots are NOT generated every period IF no data is coming in.
      • getCheckDeleteAugmentation

        public boolean getCheckDeleteAugmentation()
        Returns whether the simulator should verify that the DELETE command supplies the correct price and size.
      • getDACPriceTolerance

        public double getDACPriceTolerance()
        Returns the price tolerance used for delete augmentation checking. Rule: |SUPPLIED-PRICE - ACTUAL-PRICE| <= priceTolerance
      • getDACSizeTolerance

        public double getDACSizeTolerance()
        Returns the size tolerance used for delete augmentation checking. Rule: |SUPPLIED-SIZE - ACTUAL-SIZE| <= sizeTolerance
      • setCheckDeleteAugmentation

        public void setCheckDeleteAugmentation​(double priceTolerance,
                                               double sizeTolerance)
        Turns on the DELETE augmentation check, which is that the DELETE command supplies the correct price and size. This is a QuantOffice requirement, the aim of which is to support L2 trading simulation without book maintenance. This mode is useful when validating recorded data for compliance. This mode is off by default.
        Parameters:
        priceTolerance - Rule: |SUPPLIED-PRICE - ACTUAL-PRICE| <= priceTolerance
        sizeTolerance - Rule: |SUPPLIED-SIZE - ACTUAL-SIZE| <= sizeTolerance
      • setNoCheckDeleteAugmentation

        public void setNoCheckDeleteAugmentation()
        Turns off the DELETE augmentation check. This default mode allows the use of the book simulator in data connectors to perform DELETE augmentation.
      • getCheckSnapshotOrder

        public boolean getCheckSnapshotOrder()
        Returns whether the simulator should verify that the OFFER snapshot immediately follows the BID snapshot.
      • setCheckSnapshotOrder

        public void setCheckSnapshotOrder​(boolean mode)
        Configures whether the simulator should verify that the OFFER snapshot immediately follows the BID snapshot. By default this mode is off, which makes the simulator useful in data connector application. Set this mode to true to use the simulator for validating recorded data.