Portfolio construction with integer constraints

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Portfolio construction with integer constraints

Sigurdsson, Magnus
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 have done a fair amount of Google searches, and have looked through http://cran.r-project.org/web/views/Optimization.html . I have some mathematical optimization background, but it is getting a little rusty, not sure how to proceed. I was hoping someone here had some ideas.

Thank you very much,

Magnus Sigurdsson

___________________________________________
This message and any attached documents contain
information which may be confidential, subject to
privilege or exempt from disclosure under applicable
law. These materials are solely for the use of the
intended recipient. If you are not the intended
recipient of this transmission, you are hereby
notified that any distribution, disclosure, printing,
copying, storage, modification or the taking of any
action in reliance upon this transmission is strictly
prohibited. Delivery of this message to any person
other than the intended recipient shall not
compromise or waive such confidentiality, privilege
or exemption from disclosure as to this
communication.

If you have received this communication in error,
please notify the sender immediately and delete
this message from your system.

        [[alternative HTML version deleted]]

_______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Portfolio construction with integer constraints

alexios
Magnus,

Have you done a search for "round lots" in the context of portfolio
optimization? There are many references. I have personally found
Scherer's classic ("Introduction to Modern Portfolio Optimization") to
be quite good (see page 96 for this particular problem).

Keep in mind that in R you only have, AFAIK, MILP solvers. MINLP or MIQP
are usually only found in commercial implementations (though you also
have couenne in coin-or which has not been ported to R yet).

If you want to have a look at an implementation of 'in-between or out'
cardinality constraints, the parma package on CRAN implements this for a
number of risk measures within a MILP framework (using the GLPK solver).

Regards,
Alexios


On 14/02/2013 17:56, 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 have done a fair amount of Google searches, and have looked through http://cran.r-project.org/web/views/Optimization.html . I have some mathematical optimization background, but it is getting a little rusty, not sure how to proceed. I was hoping someone here had some ideas.
>
> Thank you very much,
>
> Magnus Sigurdsson
>
> ___________________________________________
> This message and any attached documents contain
> information which may be confidential, subject to
> privilege or exempt from disclosure under applicable
> law. These materials are solely for the use of the
> intended recipient. If you are not the intended
> recipient of this transmission, you are hereby
> notified that any distribution, disclosure, printing,
> copying, storage, modification or the taking of any
> action in reliance upon this transmission is strictly
> prohibited. Delivery of this message to any person
> other than the intended recipient shall not
> compromise or waive such confidentiality, privilege
> or exemption from disclosure as to this
> communication.
>
> If you have received this communication in error,
> please notify the sender immediately and delete
> this message from your system.
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> [hidden email] 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.
>

_______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Portfolio construction with integer constraints

Enrico Schumann-2
In reply to this post by Sigurdsson, Magnus
On Thu, 14 Feb 2013, "Sigurdsson, Magnus" <[hidden email]> writes:

> 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.

One way to solve such models is via heuristics like Genetic
Algorithms. There are a number of packages in R that implement such
methods, but typically you have to do some programming yourself. There
has been some discussion of such methods on this list in the past;
Patrick Burns has also had some blog posts about R implementations
(there you could get some pointers to R packages).


Best regards,
Enrico


--
Enrico Schumann
Lucerne, Switzerland
http://enricoschumann.net

_______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Portfolio construction with integer constraints

braverock
In reply to this post by Sigurdsson, Magnus
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

_______________________________________________
[hidden email] 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.