2
$\begingroup$

I am new to the world of investing, so please excuse the clumsy wording of the question... there is probably a better term for what I am looking for or maybe this is even a known/classic problem. If so, please kindly point me in the right direction ;-)


Motivation

Investment strategies are compared against "the market", which is usually some weighted index of some / all securities in a given universe. However, the choice of market portfolio is somewhat arbitrary when it can be defined by the investor. A comparison of the alpha / performance of two investors' strategies could be quite difficult when one investor benchmarks her strategy against market portfolio A, while another benchmarks it against market portfolio B.

Thinking about this problem I ended up with the following idea: Why not compare every strategy against the hypothetical optimal return that could be achieved within the relevant universe and time frame if one had a crystal ball, i.e. by magically buying / selling the combination of securities that would lead to maximum return?

For each set of investment constraints, there is (usually) only one such optimal strategy and thus the "Crystal Ball Return" would be the ideal reference for objective comparisons of investment strategies.

The Problem

For the sake of simplicity let's assume we have a universe that consists of n stocks (with end-of-day prices) and are looking at an investment time frame of d trading days. We're investing a pre-defined amount of money m (enough to buy at least one of each stock) and there is small but non-negligible fee f for every transaction. We can change the portfolio (buy/sell stocks) once a day, but we don't have to. All returns are compounded. UPDATE: To keep it simple (and the returns bounded), short selling is not allowed.

My question is:

How does one efficiently calculate the sequence of buy/sell actions that leads to the maximum possible return?

To me this smells like dynamic programming, however, maybe I am missing something. The problem formulation seems so commonplace that I'm hoping there is a seminal paper / solution you can point me to.

If you provide a solution, please try to give some indication of its time / space complexity. Thank you.


Note: On first thoughts, fees seem to be a necessary constraint, since without them the optimal strategy would simply be to move all the money on a daily basis into the stock that's growing the most.

$\endgroup$
  • 1
    $\begingroup$ I think you are right in the fact that adding fees makes the solution non-trivial. But nonthless I don't think that it will be useful for comparisions. First of all, I guess that the portfolio will still consist of one asset at the time. The algorithm will allocate all money to the 'optimal' asset for some time period. Why should the money ever be splitted? Secondly the resulting performance will be many times better than any realistic portfolio. If you allow for short selling the possible returns are not bound at all. $\endgroup$ – Ami44 Sep 12 '16 at 21:53
  • $\begingroup$ This is a standard problem and easily solved using DP in O(n) time and space. Also user22686's remarks are correct, it's easy to prove that the optimal strategy is a all-or-nothing strategy, there will never be more than one instrument in the portfolio. $\endgroup$ – hroptatyr Sep 13 '16 at 8:56
  • $\begingroup$ @user22686 Thanks! You are absolutely right - the portfolio will always consist of one instrument at a time. This didn't occur to me before. That should make the solution a whole lot easier. Regarding the usefulness: IMHO the fact that any real-life strategy will only ever capture a fraction of the theoretically attainable return is fine. You can still objectively compare a strategy that yields 16% of the hypothetically possible return to one that yields 14%. $\endgroup$ – KlaasNotFound Sep 13 '16 at 11:47
  • 1
    $\begingroup$ @KlaasNotFound you need to have one more constraint, namely that you want to be flat at the end of the data. Then you go from there calculate which was the best position to hold prior to that, and so on ... It's a bit much to explain it here in detail, just read up on it, e.g. cs.rpi.edu/~magdon/courses/cf/notes/optimal.pdf $\endgroup$ – hroptatyr Sep 13 '16 at 13:37
  • 1
    $\begingroup$ Actually the optimal strategy should be one stock short (maximum amount possible) and use proceeds of that short stock to get the long stock. This strategy would actually yield infinite return given no investment needed. $\endgroup$ – phdstudent Sep 14 '16 at 1:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.