[R-SIG-Finance] Backing out a portfolio snapshot?

matt at considine.net matt at considine.net
Fri Feb 6 21:53:34 CET 2015


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:
> 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:
>> 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
>> 
>> _______________________________________________
>> R-SIG-Finance at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>> -- Subscriber-posting only. If you want to post, subscribe first.
>> -- Also note that this is not the r-help list where general R 
>> questions
>> should go.



More information about the R-SIG-Finance mailing list