com.moneydance.apps.md.model
Class AvailableSharesTracker

java.lang.Object
  extended by com.moneydance.apps.md.model.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.

Author:
Kevin Menningen - Mennē Software Solutions, LLC

Constructor Summary
AvailableSharesTracker(int date, long shares)
          Constructor to provide the original information, normally the buy transaction but could be a short sale.
 
Method Summary
 void allot(long sharesAllotted)
          Remove shares from the available (typically because they have been sold).
 long getAvailableShares()
           
 int getLastDateInt()
           
 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, toString, 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.