[R-SIG-Finance] Equity in Blotter

Brian G. Peterson brian at braverock.com
Thu Dec 29 12:39:57 CET 2011


On Wed, 2011-12-28 at 22:46 -0500, Rashmi wrote:
> Hi.
> 
> I am exploring blotter and find it very useful. However, I have a question
> about the equity.
> 
> Let us say, I have a some code like this:
> 
>   addTxn(Portfolio = "p", Symbol = symbols, TxnDate =
> as.Date(index(stockSymbol[i])), TxnQty = 13, TxnPrice = 1000, TxnFees = 0)
> 
> ...
> initAcct(name="a", portfolios="p", initEq=12000, currency="USD",
> initDate=sDate)
> updateAcct("a",Dates=interval)
> updateEndEq("a",interval)
> PortfReturns(Account="a",Dates=interval, Portfolios="p")
> 
> 
> i.e, in the account, I start with an equity of $12000, but purchase shares
> worth $13k. Ideally, such a transaction should be prevented because I don't
> explicitly setup an account to borrow the 1k from. Second, the equity
> calculations should take into account that the money is borrowed and should
> keep track of it while calculating equity. Any thoughts on the right way to
> handle it using blotter?

Why would such a thing be prevented?  
This happens in real margin accounts all the time.

Blotter's job is to keep track of what you do and account for it.
That's all.  

If you want equity-aware position/transaction sizing, see Guy Yollin's
University of Washington lecture notes on quantstrat and blotter:

http://www.r-programming.org/papers

He has a variety of position-sizing functions that may serve as examples
for your needs.

Regards,

   - Brian

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



More information about the R-SIG-Finance mailing list