Sunday, June 3, 2012

Universal portfolio, part 3

After the theoretical analysis, section 8 of Universal Portfolios provides examples.  We now use logopt and R to reproduce them, the first three in this post.

The examples of Universal Portfolios use a long time series of relative stock prices on the NYSE originally accumulated by Cover himself.  This series has been reused by many authors to allow for comparisons of algorithms, and the series is available in logopt itself (originally downloaded from this website).

The two first figures introduce two specific stocks (8.1), then a series of CRP and Universal Portfolio for these two stocks (8.2).  Each figure is drawn using a standalone snippet of code.



Performance of Iroquois brands and Kin Ark



Performance of rebalanced portfolio




Performance of universal portfolio
Updated on 2012/07/25 to correct code errors and use github:gist as repository for the code examples.

3 comments:

  1. > lines(Days, universal, col="green")
    Fehler in xy.coords(x, y) : 'x' and 'y' lengths differ
    > universal
    Data:
    numeric(0)

    Index:
    NULL

    ReplyDelete
    Replies
    1. Hello Horstwolf, can you try to add
      data(nyse.cover.1962.1984) after library(logopt) and check if that works.

      Thanks for reading the blog.

      Delete
  2. Thank you, I am not sure about the exact problem, but I found at least one error. You need to explicitly load nyse.cover.1962.1984 via command data(nyse.cover.1962.1984).

    I'll update the code, and please feel free to indicate if that solves your problem.

    ReplyDelete