Universal Portfolios: Re-creating the simple example. Announcing the arrival of Valued...

How can players work together to take actions that are otherwise impossible?

What LEGO pieces have "real-world" functionality?

What causes the vertical darker bands in my photo?

Are my PIs rude or am I just being too sensitive?

Java 8 stream max() function argument type Comparator vs Comparable

Why aren't air breathing engines used as small first stages

Withdrew £2800, but only £2000 shows as withdrawn on online banking; what are my obligations?

Why did the IBM 650 use bi-quinary?

How to bypass password on Windows XP account?

When to stop saving and start investing?

Letter Boxed validator

Did Kevin spill real chili?

How do I stop a creek from eroding my steep embankment?

The logistics of corpse disposal

What is a Meta algorithm?

What is the longest distance a 13th-level monk can jump while attacking on the same turn?

Should I discuss the type of campaign with my players?

How to recreate this effect in Photoshop?

When -s is used with third person singular. What's its use in this context?

How can I fade player when goes inside or outside of the area?

Can inflation occur in a positive-sum game currency system such as the Stack Exchange reputation system?

How to motivate offshore teams and trust them to deliver?

Should I call the interviewer directly, if HR aren't responding?

Why is "Captain Marvel" translated as male in Portugal?



Universal Portfolios: Re-creating the simple example.



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Universal Correlation measure — ranking correlationsInformation content of universal sentenceDerivation of Black-Scholes equation by riskless portfolioWhat is the difference between simple interest and simple discounting?The Simple Interest accurued on an amount.Investment in simple interestSimple Percentage / InterestMarkowitz Model Invests in EverythingDealing with noisy pointsWhat are some different approaches to scoring an old Stock price prediction?












0












$begingroup$


I have just become aware of a very interesting theory for portfolio management which is grounded in mathematics, called Universal Portfolios. I am focused on the paper of the same name, here's a link.



I am working on understanding the math better, but I am getting a bit hung up on the examples. In the Examples section of the paper, there is a simple illustration of the usefulness of the algorithm using 2 stocks:



Cover: Universal Portfolios, example.



I am working on re-creating the examples with recent data from the stock market, released by kaggle. I am not interested yet in creating the universal portfolio yet. I am interesting in making sure i understand the idea about the "best constant balanced portfolio". This is an important piece of the paper.



Cover is stating that for the 2 stocks listed there, he was able to create constant rebalanced portfolios for list of values, b, which is the weight of one stock, and b-1, the weight of the other. He is stating that the performance of many of these constant rebalanced portfolios is better than that of either of the 2 stocks alone.



I was hoping to be able to pick 2 stocks from the data set and show a similar thing. However for the stocks that I have picked, there seems to be negligible improvement for any of the constant rebalanced portfolios. I am pretty sure I have the calculation correct.



equation for constant rebalanced portfolios



I made some quick plots of several pairs of stocks. I've plotted the return of each stock, and then the constant rebalanced portfolios for a few choices for b ( 0.1, 0.3, 0.5, 0.7, 0.9 ). Most of the time the constant rebalanced portfolios cannot beat the performance of the best performing stock out of the 2, and when they do beat both stocks, it only seems to beat the best stock by a very slight amount. A far cry from the performance improvements that Cover mentions in the paper.



The dates here are 2001 - 2016, daily prices. Here is AAPL and MSFT, as you can see holding AAPL alone in the portfolio beats and constant rebalanced portfolio.



enter image description here



Here is a pair where a couple of the constant rebalanced portfolios perform the best, but it is just a very slight improvement.



enter image description here



From reading the paper I was expecting to see a massive improvement in performance for these simple examples but I'm not seeing anything interesting really. I was wondering if someone had some insight, maybe I did something wrong in my calculation, or maybe this is to be expected. I am also including my python code for the examples.



#!/usr/bin/python3
import pandas as pd
from sqlalchemy import create_engine
from datetime import date, timedelta, datetime
import numpy as np
from scipy.optimize import minimize, fmin
from matplotlib import pyplot as plt
engine = create_engine('postgres://localhost/kaggle')

'''
Universal portfolios
Cover
'''
stock1 = "WFC"
stock2 = "KO"

data = pd.read_sql("""select * from historical_stock_prices where date >= '2001-01-01' and date <= '2012-01-01' and ticker in ('%s','%s');""" % (stock1, stock2), engine )
x = pd.DataFrame({
stock1: data[ data['ticker'] == stock1 ]['adj_close'].tolist(),
stock2: data[ data['ticker'] == stock2 ]['adj_close'].tolist()
}, index=data[ data['ticker'] == stock2 ]['date'].tolist() )



x = np.log( x ).diff().dropna()

for i in range(1,11, 2):
p = i/10.0
print( p )
plt.plot( np.cumprod( np.dot( np.exp( x.values ), [p,1-p] ) ), label=str(p) )
plt.plot( np.cumprod( np.exp( x[stock1].values ) ), label=stock1 )
plt.plot( np.cumprod( np.exp( x[stock2].values ) ), label=stock2 )
plt.legend()
plt.show()









share|cite|improve this question









$endgroup$

















    0












    $begingroup$


    I have just become aware of a very interesting theory for portfolio management which is grounded in mathematics, called Universal Portfolios. I am focused on the paper of the same name, here's a link.



    I am working on understanding the math better, but I am getting a bit hung up on the examples. In the Examples section of the paper, there is a simple illustration of the usefulness of the algorithm using 2 stocks:



    Cover: Universal Portfolios, example.



    I am working on re-creating the examples with recent data from the stock market, released by kaggle. I am not interested yet in creating the universal portfolio yet. I am interesting in making sure i understand the idea about the "best constant balanced portfolio". This is an important piece of the paper.



    Cover is stating that for the 2 stocks listed there, he was able to create constant rebalanced portfolios for list of values, b, which is the weight of one stock, and b-1, the weight of the other. He is stating that the performance of many of these constant rebalanced portfolios is better than that of either of the 2 stocks alone.



    I was hoping to be able to pick 2 stocks from the data set and show a similar thing. However for the stocks that I have picked, there seems to be negligible improvement for any of the constant rebalanced portfolios. I am pretty sure I have the calculation correct.



    equation for constant rebalanced portfolios



    I made some quick plots of several pairs of stocks. I've plotted the return of each stock, and then the constant rebalanced portfolios for a few choices for b ( 0.1, 0.3, 0.5, 0.7, 0.9 ). Most of the time the constant rebalanced portfolios cannot beat the performance of the best performing stock out of the 2, and when they do beat both stocks, it only seems to beat the best stock by a very slight amount. A far cry from the performance improvements that Cover mentions in the paper.



    The dates here are 2001 - 2016, daily prices. Here is AAPL and MSFT, as you can see holding AAPL alone in the portfolio beats and constant rebalanced portfolio.



    enter image description here



    Here is a pair where a couple of the constant rebalanced portfolios perform the best, but it is just a very slight improvement.



    enter image description here



    From reading the paper I was expecting to see a massive improvement in performance for these simple examples but I'm not seeing anything interesting really. I was wondering if someone had some insight, maybe I did something wrong in my calculation, or maybe this is to be expected. I am also including my python code for the examples.



    #!/usr/bin/python3
    import pandas as pd
    from sqlalchemy import create_engine
    from datetime import date, timedelta, datetime
    import numpy as np
    from scipy.optimize import minimize, fmin
    from matplotlib import pyplot as plt
    engine = create_engine('postgres://localhost/kaggle')

    '''
    Universal portfolios
    Cover
    '''
    stock1 = "WFC"
    stock2 = "KO"

    data = pd.read_sql("""select * from historical_stock_prices where date >= '2001-01-01' and date <= '2012-01-01' and ticker in ('%s','%s');""" % (stock1, stock2), engine )
    x = pd.DataFrame({
    stock1: data[ data['ticker'] == stock1 ]['adj_close'].tolist(),
    stock2: data[ data['ticker'] == stock2 ]['adj_close'].tolist()
    }, index=data[ data['ticker'] == stock2 ]['date'].tolist() )



    x = np.log( x ).diff().dropna()

    for i in range(1,11, 2):
    p = i/10.0
    print( p )
    plt.plot( np.cumprod( np.dot( np.exp( x.values ), [p,1-p] ) ), label=str(p) )
    plt.plot( np.cumprod( np.exp( x[stock1].values ) ), label=stock1 )
    plt.plot( np.cumprod( np.exp( x[stock2].values ) ), label=stock2 )
    plt.legend()
    plt.show()









    share|cite|improve this question









    $endgroup$















      0












      0








      0





      $begingroup$


      I have just become aware of a very interesting theory for portfolio management which is grounded in mathematics, called Universal Portfolios. I am focused on the paper of the same name, here's a link.



      I am working on understanding the math better, but I am getting a bit hung up on the examples. In the Examples section of the paper, there is a simple illustration of the usefulness of the algorithm using 2 stocks:



      Cover: Universal Portfolios, example.



      I am working on re-creating the examples with recent data from the stock market, released by kaggle. I am not interested yet in creating the universal portfolio yet. I am interesting in making sure i understand the idea about the "best constant balanced portfolio". This is an important piece of the paper.



      Cover is stating that for the 2 stocks listed there, he was able to create constant rebalanced portfolios for list of values, b, which is the weight of one stock, and b-1, the weight of the other. He is stating that the performance of many of these constant rebalanced portfolios is better than that of either of the 2 stocks alone.



      I was hoping to be able to pick 2 stocks from the data set and show a similar thing. However for the stocks that I have picked, there seems to be negligible improvement for any of the constant rebalanced portfolios. I am pretty sure I have the calculation correct.



      equation for constant rebalanced portfolios



      I made some quick plots of several pairs of stocks. I've plotted the return of each stock, and then the constant rebalanced portfolios for a few choices for b ( 0.1, 0.3, 0.5, 0.7, 0.9 ). Most of the time the constant rebalanced portfolios cannot beat the performance of the best performing stock out of the 2, and when they do beat both stocks, it only seems to beat the best stock by a very slight amount. A far cry from the performance improvements that Cover mentions in the paper.



      The dates here are 2001 - 2016, daily prices. Here is AAPL and MSFT, as you can see holding AAPL alone in the portfolio beats and constant rebalanced portfolio.



      enter image description here



      Here is a pair where a couple of the constant rebalanced portfolios perform the best, but it is just a very slight improvement.



      enter image description here



      From reading the paper I was expecting to see a massive improvement in performance for these simple examples but I'm not seeing anything interesting really. I was wondering if someone had some insight, maybe I did something wrong in my calculation, or maybe this is to be expected. I am also including my python code for the examples.



      #!/usr/bin/python3
      import pandas as pd
      from sqlalchemy import create_engine
      from datetime import date, timedelta, datetime
      import numpy as np
      from scipy.optimize import minimize, fmin
      from matplotlib import pyplot as plt
      engine = create_engine('postgres://localhost/kaggle')

      '''
      Universal portfolios
      Cover
      '''
      stock1 = "WFC"
      stock2 = "KO"

      data = pd.read_sql("""select * from historical_stock_prices where date >= '2001-01-01' and date <= '2012-01-01' and ticker in ('%s','%s');""" % (stock1, stock2), engine )
      x = pd.DataFrame({
      stock1: data[ data['ticker'] == stock1 ]['adj_close'].tolist(),
      stock2: data[ data['ticker'] == stock2 ]['adj_close'].tolist()
      }, index=data[ data['ticker'] == stock2 ]['date'].tolist() )



      x = np.log( x ).diff().dropna()

      for i in range(1,11, 2):
      p = i/10.0
      print( p )
      plt.plot( np.cumprod( np.dot( np.exp( x.values ), [p,1-p] ) ), label=str(p) )
      plt.plot( np.cumprod( np.exp( x[stock1].values ) ), label=stock1 )
      plt.plot( np.cumprod( np.exp( x[stock2].values ) ), label=stock2 )
      plt.legend()
      plt.show()









      share|cite|improve this question









      $endgroup$




      I have just become aware of a very interesting theory for portfolio management which is grounded in mathematics, called Universal Portfolios. I am focused on the paper of the same name, here's a link.



      I am working on understanding the math better, but I am getting a bit hung up on the examples. In the Examples section of the paper, there is a simple illustration of the usefulness of the algorithm using 2 stocks:



      Cover: Universal Portfolios, example.



      I am working on re-creating the examples with recent data from the stock market, released by kaggle. I am not interested yet in creating the universal portfolio yet. I am interesting in making sure i understand the idea about the "best constant balanced portfolio". This is an important piece of the paper.



      Cover is stating that for the 2 stocks listed there, he was able to create constant rebalanced portfolios for list of values, b, which is the weight of one stock, and b-1, the weight of the other. He is stating that the performance of many of these constant rebalanced portfolios is better than that of either of the 2 stocks alone.



      I was hoping to be able to pick 2 stocks from the data set and show a similar thing. However for the stocks that I have picked, there seems to be negligible improvement for any of the constant rebalanced portfolios. I am pretty sure I have the calculation correct.



      equation for constant rebalanced portfolios



      I made some quick plots of several pairs of stocks. I've plotted the return of each stock, and then the constant rebalanced portfolios for a few choices for b ( 0.1, 0.3, 0.5, 0.7, 0.9 ). Most of the time the constant rebalanced portfolios cannot beat the performance of the best performing stock out of the 2, and when they do beat both stocks, it only seems to beat the best stock by a very slight amount. A far cry from the performance improvements that Cover mentions in the paper.



      The dates here are 2001 - 2016, daily prices. Here is AAPL and MSFT, as you can see holding AAPL alone in the portfolio beats and constant rebalanced portfolio.



      enter image description here



      Here is a pair where a couple of the constant rebalanced portfolios perform the best, but it is just a very slight improvement.



      enter image description here



      From reading the paper I was expecting to see a massive improvement in performance for these simple examples but I'm not seeing anything interesting really. I was wondering if someone had some insight, maybe I did something wrong in my calculation, or maybe this is to be expected. I am also including my python code for the examples.



      #!/usr/bin/python3
      import pandas as pd
      from sqlalchemy import create_engine
      from datetime import date, timedelta, datetime
      import numpy as np
      from scipy.optimize import minimize, fmin
      from matplotlib import pyplot as plt
      engine = create_engine('postgres://localhost/kaggle')

      '''
      Universal portfolios
      Cover
      '''
      stock1 = "WFC"
      stock2 = "KO"

      data = pd.read_sql("""select * from historical_stock_prices where date >= '2001-01-01' and date <= '2012-01-01' and ticker in ('%s','%s');""" % (stock1, stock2), engine )
      x = pd.DataFrame({
      stock1: data[ data['ticker'] == stock1 ]['adj_close'].tolist(),
      stock2: data[ data['ticker'] == stock2 ]['adj_close'].tolist()
      }, index=data[ data['ticker'] == stock2 ]['date'].tolist() )



      x = np.log( x ).diff().dropna()

      for i in range(1,11, 2):
      p = i/10.0
      print( p )
      plt.plot( np.cumprod( np.dot( np.exp( x.values ), [p,1-p] ) ), label=str(p) )
      plt.plot( np.cumprod( np.exp( x[stock1].values ) ), label=stock1 )
      plt.plot( np.cumprod( np.exp( x[stock2].values ) ), label=stock2 )
      plt.legend()
      plt.show()






      finance information-theory






      share|cite|improve this question













      share|cite|improve this question











      share|cite|improve this question




      share|cite|improve this question










      asked Mar 23 at 22:18









      jeffery_the_windjeffery_the_wind

      1208




      1208






















          0






          active

          oldest

          votes












          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "69"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          noCode: true, onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3159867%2funiversal-portfolios-re-creating-the-simple-example%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Mathematics Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3159867%2funiversal-portfolios-re-creating-the-simple-example%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Magento 2 - Add success message with knockout Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Success / Error message on ajax request$.widget is not a function when loading a homepage after add custom jQuery on custom themeHow can bind jQuery to current document in Magento 2 When template load by ajaxRedirect page using plugin in Magento 2Magento 2 - Update quantity and totals of cart page without page reload?Magento 2: Quote data not loaded on knockout checkoutMagento 2 : I need to change add to cart success message after adding product into cart through pluginMagento 2.2.5 How to add additional products to cart from new checkout step?Magento 2 Add error/success message with knockoutCan't validate Post Code on checkout page

          Fil:Tokke komm.svg

          Where did Arya get these scars? Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar Manara Favourite questions and answers from the 1st quarter of 2019Why did Arya refuse to end it?Has the pronunciation of Arya Stark's name changed?Has Arya forgiven people?Why did Arya Stark lose her vision?Why can Arya still use the faces?Has the Narrow Sea become narrower?Does Arya Stark know how to make poisons outside of the House of Black and White?Why did Nymeria leave Arya?Why did Arya not kill the Lannister soldiers she encountered in the Riverlands?What is the current canonical age of Sansa, Bran and Arya Stark?