Class MamdaOrderBookPriceLevel


  • public class MamdaOrderBookPriceLevel
    extends java.lang.Object
    • Constructor Detail

      • MamdaOrderBookPriceLevel

        public MamdaOrderBookPriceLevel()
        Default constructor.
      • MamdaOrderBookPriceLevel

        public MamdaOrderBookPriceLevel​(MamdaOrderBookPriceLevel copy)
        Construct a price level object which is a shallow copy of the original.
        Parameters:
        copy - The MamdaOrderBookPriceLevel to copy.
      • MamdaOrderBookPriceLevel

        public MamdaOrderBookPriceLevel​(double price,
                                        char side)
    • Method Detail

      • clear

        public void clear()
        Clear the pricelevel
      • copy

        public void copy​(MamdaOrderBookPriceLevel copy)
        Copy a price level object which is an exact and deep copy of the original.
        Parameters:
        copy - The MamdaOrderBookPriceLevel to copy.
      • copy

        public void copy​(MamdaBookAtomicLevel copy)
        Copy an atomic price level object which is an exact and deep copy of the original.
        Parameters:
        copy - The MamdaOrderBookPriceLevel to copy.
      • copy

        public void copy​(MamdaBookAtomicLevelEntry copy)
        Copy a price level object which is an exact and deep copy of the original.
        Parameters:
        copy - The MamdaOrderBookPriceLevel to copy.
      • setPrice

        public void setPrice​(com.wombat.mama.MamaPrice price)
      • setPrice

        public void setPrice​(double price)
      • setSize

        public void setSize​(double size)
      • setSizeChange

        public void setSizeChange​(double size)
      • setNumEntries

        public void setNumEntries​(double numEntries)
      • setSide

        public void setSide​(char side)
      • setAction

        public void setAction​(char action)
      • setTime

        public void setTime​(com.wombat.mama.MamaDateTime time)
      • setOrderType

        public void setOrderType​(char orderType)
      • getOrderType

        public char getOrderType()
      • empty

        public boolean empty()
        Return whether there are no entries for this level.
        Returns:
        Whether there are no entries for this level.
      • setDetails

        public void setDetails​(MamdaOrderBookPriceLevel level)
        Take the details from level and apply them to this level. This does not update entries within the level, only information pertaining to the level itself. It is intended that this method should not be used externally to the API.
        Parameters:
        level - The price level object from which the details are being obtained.
      • setDetails

        public void setDetails​(MamdaBookAtomicLevel level)
        Take the details from atomic level and apply them to this level. This does not update entries within the level, only information pertaining to the level itself. It is intended that this method should not be used externally to the API.
        Parameters:
        level - The atomic price level object from which the details are being obtained.
      • setDetails

        public void setDetails​(MamdaBookAtomicLevelEntry levelEntry)
        Take the details from atomic levelEntry and apply them to this levelEntry. This update entries within the level. It is intended that this method should not be used externally to the API.
        Parameters:
        levelEntry - The atomic price levelEntry object from which the details are being obtained.
      • addEntry

        public void addEntry​(MamdaOrderBookEntry entry)
        Add a new order book entry to the price level.
        Parameters:
        entry - The new entry to be added to the level.
        See Also:
        MamdaOrderBookEntry
      • updateEntry

        public void updateEntry​(MamdaOrderBookEntry entry)
        Update the details of an existing entry in the level.
        Parameters:
        entry - An instance of MamdaOrderBookEntry with the new details for the entry in the level.
        See Also:
        MamdaOrderBookEntry
      • updateEntry

        public void updateEntry​(MamdaBookAtomicLevelEntry levelEntry)
        Update the details of an existing entry in the level, where the update details are provied by an atomic levelEntry.
        Parameters:
        levelEntry - An instance of MamdaBookAtomicLevelEntry with the new details for the entry in the level.
        See Also:
        MamdaOrderBookEntry
      • removeEntry

        public void removeEntry​(MamdaOrderBookEntry entry)
        Remove an order book entry from the price level.
        Parameters:
        entry - The entry which is to be removed from the price level.
        See Also:
        MamdaOrderBookEntry
      • removeEntry

        public void removeEntry​(MamdaBookAtomicLevelEntry levelEntry)
        Remove an order book entry from the price level, where the delete details are provied by an atomic levelEntry.
        Parameters:
        levelEntry - The entry which is to be removed from the price level.
        See Also:
        MamdaOrderBookEntry
      • entryIterator

        public java.util.Iterator entryIterator()
        Returns a java.util.Iterator for all entries within this level. Price Level entries are represented by the MamdaOrderBookEntry class.
        Returns:
        Iterator The iterator for the price level entries
      • checkNotExist

        public void checkNotExist​(MamdaOrderBookEntry entry)
        If the provided order book entry exists in the price level a MamdaOrderBookException exception is thrown. Otherwise the method simply returns.
        Parameters:
        entry - The entry whose presence in the level is being determined.
        Throws:
        MamdaOrderBookException - If the entry is found in the price level.
      • checkNotExist

        public void checkNotExist​(MamdaBookAtomicLevelEntry levelEntry)
        If the provided levelEntry entry exists in the price level, as a OrderBookEntry, a MamdaOrderBookException exception is thrown. Otherwise the method simply returns.
        Parameters:
        entry - The entry whose presence in the level is being determined.
        Throws:
        MamdaOrderBookException - If the entry is found in the price level.
      • markAllDeleted

        public void markAllDeleted()
        Mark everything in this price level as deleted, including entries.
      • getPrice

        public com.wombat.mama.MamaPrice getPrice()
        Return the price for this level.
        Returns:
        The price for this level.
      • getSize

        public double getSize()
        Return the total size (across all entries) for this level.
        Returns:
        The total size for this level.
      • getSizeChange

        public double getSizeChange()
        Return the size change for this (presumably delta) level. This attribute is only of interest for delta order books. For full order books, this field will be equal to the size of the price level.
        Returns:
        The changed size for this level.
      • getNumEntries

        public double getNumEntries()
        Return the actual number of entries for this level. The actual number of entries may not equate to the number of entries that can be iterated over if: (a) the feed does not provide the actual entries, or (b) the price level is just a delta.
        Returns:
        The actual number of entries for this level.
      • getNumEntriesTotal

        public int getNumEntriesTotal()
      • getSide

        public char getSide()
        Return the side (bid/ask) of the book for this level.
        Returns:
        The side of the book for this level.
      • getAction

        public char getAction()
        Return the action for this price level. All price levels for a full book are marked with ACTION_ADD.
        Returns:
        The action for this level.
      • getTime

        public com.wombat.mama.MamaDateTime getTime()
        Return the time stamp for when the price level was last updated.
        Returns:
        The time stamp for when the price level was last updated.
      • assertEqual

        public void assertEqual​(MamdaOrderBookPriceLevel rhs)
        Order book price level equality verification. A MamdaOrderBookException is thrown if the price levels are not equal, along with the reason for the inequality.
        Throws:
        MamdaOrderBookException
      • setStrictChecking

        public static void setStrictChecking​(boolean strict)
        Enforce strict checking of order book modifications (at the expense of some performance). This setting is automatically updated by MamdaOrderBook::setStrictChecking().
      • getSymbol

        public java.lang.String getSymbol()
      • reevaluate

        public boolean reevaluate()
        Re-evaluate the price level. This would be performed after the status of sources and/or subsources of an "aggregated order book" (i.e., a book built from multiple sources) have changed.
        Returns:
        Whether the book info changed based on the re-evaluation.
      • getEntryAtPosition

        public MamdaOrderBookEntry getEntryAtPosition​(long pos)
        Return the order book entry at position "pos" in the price level.
        Parameters:
        pos - The position of the order book entry.
        Returns:
        The order book entry or NULL if not found.