The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

manage_portfolio.pl

SYNOPSIS

  ./manage_portfolio.pl <portfolio> create [<initial-sum>]
  ./manage_portfolio.pl <portfolio> bought <quantity> <share> \
    <price> [ <date> <source> ]
  ./manage_portfolio.pl <portfolio> sold <quantity> <share> \
    <price> [ <date> <source> ]
  ./manage_portfolio.pl <portfolio> stop <share> <price>
  ./manage_portfolio.pl <portfolio> set initial-sum <sum of money>
  ./manage_portfolio.pl <portfolio> set broker <broker>
  ./manage_portfolio.pl <portfolio> report { performance | positions \
   | historic | analysis }
  ./manage_portfolio.pl <portfolio> file <filename>
  ./manage_portfolio.pl <portfolio> db

 where
 <portfolio> is filename of portfolio to use. it can be a non-existent
 file, in which case it will be created

 <quantity> <price> are numeric values for <share> which is the
 appropriate stock symbol or cusip or other identifier

 <date> is optional, the date the transaction happened on. if not
 supplied the default value for 'today' will be supplied. preferred GT
 format for dates is 'YYYY-MM-DD'.

 <source> is optional, a text string, it can be used to note the source
 of the stock transaction. typically an internal GT used field. for
 individual transactions <source> can be set via the --source='string'
 option.

 <broker> name of broker module to use. see ../GT/Brokers/. there is
 no error checking. if the supplied broker module fails to exist the
 portfolio will be flawed.

OPTIONS

--marged

Only useful for "bought" and "sold" commands. It explains that the corresponding positions are marged, no personal money has been used for them, the money has been rented.

--source <source>

Useful to tag certain orders as the result of a particular strategy. All orders passed by following the advice of someone could be tagged with his name and later you'll be able to make stats on the performance you made with his advices.

--template=<template file>

Output is generated using the indicated HTML::Mason component. For example, when using "report historic" use

  --template="manage_portfolio_historic.mpl"

when using "report positions" use

  --template="manage_portfolio_positions.mpl"

The template directory is defined as Template::directory in the options file. Each template can be predefined by including it into the options file For example,

  Template::manage_portfolio_positions manage_portfolio_positions.mpl
  Template::manage_portfolio_historic manage_portfolio_historic.mpl
--timeframe { day | week | ... }

Tell how to parse the format of the date.

--noconfirm

Do not prompt for confirmation, just apply the request

--detailed

Add extra information into the output. On by default. Turn off by using --nodetailed

--backup

Make backup of <portfolio> if changes made and applied. Turn off by using --nobackup. backup portfolio filename will be <portfolio>.<yyyymmddhhmmss> where yyyymmddhhmmss is the date-time of the portfolio files' last modification date and time.

--since <date>
--until <date>

Those two options are used to restrict the result of a "report" command to a certain timeframe.

--options=<key>=<value>

A configuration option (typically given in the options file) in the form of a key=value pair. For example, --option=DB::Text::format=0 sets the format used to parse markets via the DB::Text module to 0.

COMMANDS

create

creates <portfolio> and optionally set <initial-sum> available funds. <initial-sum> is unset if omitted

bought <quantity> <share> <price> [<date>]
sold <quantity> <share> <price> [<date>]

create a <portfolio> purchase (bought) or sale (sold) transaction

it doesn't appear to support long and short transactions but ...

stop <share> <price>

create a stop order for <share> at <price>

report { performance | positions | historic | analysis }

generate and output the specified report

set { initial-sum | broker } <value>

create and set the value of variables initial-sum or broker to <value>

file <filename>

Specifies the name of a file which contains a list of

bought <quantity> <share> <price> [ <date> <source> ]

and

sold <quantity> <share> <price> [ <date> <source> ]

commands, one per line. This allows you to submit multiple bought/sold commands in a single instance.

db

reads beancounter database portfolio table and creates <portfolio> from it.

negative stock quantities are considered sells, <source> is derived from the 'type' column. currency is ignored, as GT seems to do.

since the beancounter portfolio really doesn't have necessary functionality to manage closed positions it is probably best to manage sells in the GT portfolio using command line or command file features provided here. in addition, by not introducing negative stock quantities in the beancounter portfolio table you will also avoid tickling bugs and messing up the report formats with the unexpected negative quantity value.

DESCRIPTION

This tool lets you create a portfolio object on your disk and update it regularly, this can be used to create virtual portfolio to test how a strategy works in real time or to track your real portfolio and use GeniusTrader to make some analysis on it.

The first parameter is a filename of a portfolio. The name is supposed to be relative to the portfolio directory which is $HOME/.gt/portfolio in Unix but can be overriden with the configuration item Finance::GeniusTrader::Portfolio::Directory. If it doesn't exist, it will try in the local directory.

BUGS (or maybe just rough edges (in my opinion))

ha! i fixed this next bit

really should be a usage mode, invoked with args -h* | -? | -: and since the program requires a command, any instantiation without a valid one.

Needs to do a better job of checking input values for bought/sold operations or needs to provide a way of completely removing a bad entry

might also be nice to provide a couple of output modes; say one to generate a file that can used as input for the ./manage_portfolio.pl <portfolio> file <filename> capability and one to generate a textualized version of the portfolio, if that makes sense.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 142:

You forgot a '=back' before '=head1'

Around line 144:

'=item' outside of any '=over'