Skip to content

Backing out a portfolio snapshot?

4 messages · Ilya Kipnis, Brian G. Peterson, matt at considine.net

#
Hi,
Let's say I have a snapshot of a portfolio's holdings on a given day, as 
well as the trades covering the two years up to that date.  Does anyone 
know of an already-made module or toolchain that would allow me to back 
out the portfolio's holdings on any given day up to that point (but that 
is obviously covered by the trading data)?  While it is a pretty 
straightforward - and tedious - mechanical exercise, I can see that 
there might be a twist in that one needs to create the implied cash 
balance, as all the cash positions are not included (just the ending 
balance).

So I recognize that the result might only be a close approximation.  But 
under the assumption that the portfolio was always effectively fully 
invested I think the results would be robust.

If anyone is aware of a solution out there that is based in R, I'd be 
appreciative.

Regards,
Matt Considine
#
If it's a rebalancing date, then that's just the weights you have assigned
to it. Beyond that, I would suggest to take the cumulative product of the
returns of your holdings up to the day you're interested in, multiply by
your last allocation, and normalize. In regards to cash, shouldn't you be
using a separate security for that (EG SHY, TLT, some sort of futures from
Quandl, etc.), or at the least, just a column of zeroes in addition to the
rest of your assets to denote cash on the sidelines?
On Fri, Feb 6, 2015 at 10:33 AM, <matt at considine.net> wrote:

            

  
  
#
Matt,

If you have all the trades, or at least the starting position and cost 
basis, and all the trades after that point, then blotter can do what you 
want.

see

?addTxns #loading everything in in one go

and

?getPos # for looking up positions as of a certain time

If you don't have the starting position and average cost, you can back 
into the starting position (but not average cost) by entering all the 
trades as though you started flat, and taking the difference to your 
ending position.

As to whether you could back out average cost, you'd have to tell us 
more about your inputs.

Regards,

Brian
On 02/06/2015 09:33 AM, matt at considine.net wrote:

  
    
#
Thanks for the replies everyone.  I'm thinking blotter is what I want to 
look into.  What I have is ending portfolio positions with cash balance 
and trades for the two years up to that point.  What I'm trying to find 
is an easy way to either create a portfolio "snapshot" for any date 
given within those two years.  Or create a dataset that has all the 
portfolos in it from which I can select dates.  I'm indifferent as to 
the approach - just looking to leverage what's already there.
Thanks,
Matt
On 2015-02-06 14:14, Brian G. Peterson wrote: