Class AvailableSharesTracker


  • public class AvailableSharesTracker
    extends java.lang.Object
    A class that tracks the number of available shares as of a given date, for a particular security. As the date changes, the number of available shares is adjusted for any splits.
    • Constructor Summary

      Constructors 
      Constructor Description
      AvailableSharesTracker​(int date, long shares)
      Constructor to provide the original information, normally the buy transaction but could be a short sale.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void allot​(long sharesAllotted)
      Remove shares from the available (typically because they have been sold).
      long getAvailableShares()  
      int getLastDateInt()  
      java.lang.String toString()  
      void updateDate​(CurrencyType secCurr, int asofDate)
      Update the date of this tracker, adjusting the number of available shares for any splits that happened between getLastDateInt() and asofDate.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • AvailableSharesTracker

        public AvailableSharesTracker​(int date,
                                      long shares)
        Constructor to provide the original information, normally the buy transaction but could be a short sale.
        Parameters:
        date - The date to begin tracking the available shares at.
        shares - The number of shares to begin tracking with.
    • Method Detail

      • allot

        public void allot​(long sharesAllotted)
        Remove shares from the available (typically because they have been sold).
        Parameters:
        sharesAllotted - The number of shares to remove. Can be negative if a buy to cover a short sale is being processed, but is typically positive.
      • getAvailableShares

        public long getAvailableShares()
        Returns:
        the number of available shares as of getLastDateInt().
      • getLastDateInt

        public int getLastDateInt()
        Returns:
        The last date at which this tracker has been updated, the date for which the available shares is correct.
      • updateDate

        public void updateDate​(CurrencyType secCurr,
                               int asofDate)
        Update the date of this tracker, adjusting the number of available shares for any splits that happened between getLastDateInt() and asofDate.
        Parameters:
        secCurr - The currency type to use for the splits check.
        asofDate - The date to update to. Note that this should always be greater than or equal to getLastDateInt(), do not go backwards in time.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object