[R-SIG-Finance] blotter updatePortf

Brian G. Peterson brian at braverock.com
Sun Nov 6 20:15:19 CET 2016


On 11/06/2016 12:10 PM, Cameron McLean wrote:
> Is there example code you can share or an existing demo in quantstrat
> that shows how to update the portfolio equity curve and size future
> orders based on the current amount?

Look at any of the rebalancing demos.  There are rebalancing versions of 
the Faber and macd demos, at least.

These rebalance (adjust max trade size) periodically based on current 
portfolio equity.

> A simple example would be something similar to the faber demo where he
> invests 20% of equity in each of the 5 asset classes (currently the
> faber demo buys and sells lots of 500 shares) or a more complex
> example could be using a indicator such as ATR to size trades based on
> risk.

Sizing based on risk would be done via a custom order sizing function 
that used the indicator value to adjust trade size.  I believe Ilya has 
examples of this on his blog.

Regards,

Brian

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



More information about the R-SIG-Finance mailing list