[R-SIG-Finance] Portfolio construction with integer constraints

Brian G. Peterson brian at braverock.com
Fri Feb 15 13:16:50 CET 2013


On 02/14/2013 11:56 AM, Sigurdsson, Magnus wrote:
> Dear R Finance enthusiasts
>
> I was wondering if anyone had experience with using R for portfolio
> construction with integer constraints, such as mean variance
> optimization, or equal risk contribution optimization, where you can
> only have integer number of shares/contracts in each underlying
> asset?
>
> The case I am referring to is, for example, a futures trading
> strategy, where you trade a few different futures markets. Due to the
> generally large nominal size of futures contract, your budget allows
> you only to trade 1 to 5 contracts of each different asset. The
> problem being creating an optimal portfolio with those constraints.

I'll note that futures are already leveraged, so rounding is not really 
much of a problem.  Additionally, simply rounding down will likely solve 
your problem.

Package PortfolioAnalytics on R-Forge includes an interface to the ROI 
solver, which wraps GLPK.  It supports integer constraints.  So, there 
are three options: GLPK for the lowest level option, ROI for one step 
more abstraction, and PortfolioAnalytics for further business abstraction.

see demo testing_ROI.R for examples of setting ROI constraints in 
PortfolioAnalytics.  Stefan has also demonstrated integer constraints 
using ROI in some of the ROI examples and documentation, iirc.

Regards,

Brian

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



More information about the R-SIG-Finance mailing list