Finance::StockAccount::AccountTransaction
my $stock = Finance::StockAccount::Stock->new({ symbol => 'FTR', exchange => 'NASDAQ', }); my $at = Finance::StockAccount::AccountTransaction->new({ tm => $tm, action => 'buy', stock => $stock, quantity => 800, price => 7.11, commission => 8.95, regulatoryFees => 0.01, }); $at->accounted(100); print $st->price(), "\n"; # prints number 7.11
These are the public properties of a StockAccount::Transaction object:
date # 'presumed' DateTime object. See http://datetime.perl.org/wiki/datetime/dashboard and discussion below. action # One of module constants BUY, SELL, SHORT, COVER stock # A Finance::StockAccount::Stock object quantity # How many shares were bought or sold, e.g. 100 or 5. price # Numeric representation of price, e.g. 4.65 instead of the string '$4.65'. commission # Numeric representation of commission in same currency, e.g. 8.95 instead of the string '$8.95'. regulatoryFees # Numeric representation of the regulatory fees, see section on "Regulatory Fees" below. otherFees # Numeric aggregation of any other fees not included in commission and regulatory fees.
Any public property can be instantiated in the new method, set with a method matching the name of the property, such as $st-date($dt)>, or set with the set method, e.g. $st-set({date => $dt})>, as specified further in the method description below.
new
$st-
set
Public properties can also be retrieved by the same method matching the name of the property when no parameter is passed, e.g. $st-date()>. Or by the get method with a string naming the property, e.g. $st-get('price')>.
get
All properties can also be read or written directly with a hash dereference. Some people don't consider this good object-oriented practice, but I won't stop you if that's what you want to do. E.g. $st-{date} = $dt> or $st-{price}>.
In the United States the Securities and Exchange Commission imposes regulatory fees on stock brokers or dealers. Instead of paying these with their profits, these for-profit companies often pass these fees onto their customers directly. The regulatoryFees property could be used for similar purposes in other jurisdictions.
regulatoryFees
See http://www.sec.gov/answers/sec31.htm for more information.
To install Finance::StockAccount, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Finance::StockAccount
CPAN shell
perl -MCPAN -e shell install Finance::StockAccount
For more information on module installation, please visit the detailed CPAN module installation guide.