[R-SIG-Finance] Accounting in blotter query

Brian G. Peterson brian at braverock.com
Sun Oct 7 23:26:02 CEST 2012


On 10/07/2012 03:50 PM, Worik Stanton wrote:
>> should be outside your loop.  You never call them after making the
>> >last closing trade, so the ending equity that you are requesting shows
>> >(correctly) a loss as of the date of the last time you updated it.
> Silly me.  Thank you.

You're welcome.

>> >These update* functions don't need to be called every time, or even
>> >every transaction.  You're doing more processing than you need to do.
> I do want to call the update functions every time step that contains a
> transaction.  Is there a way of asking the portfolio if it has had a
> transaction since the last update call?  Or do I have to track it in my
> code?

We typically run all the transactions, and then call updatePortf only 
once, at the end. This is the most efficient approach, and minimizes 
processing.  When reconciling production transactions, we run the 
update* functions once per day.

You haven't said *why* you want to do this, but I'll presume that it is 
so that you can do some rebalancing, or something similar. You can 
approximate from the current positions and the value of each position 
without marking the portfolio against all the market data.

You can also getTxns, and check the last one, but this will still be 
rather inefficient.  You'd be better off calling the update* functions 
every time you do a transaction, though this too will be less efficient 
than you likely need.

Regards,

   - Brian

-- 
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock



More information about the R-SIG-Finance mailing list