Realtime Correlation Analysis

Discussion in 'Strategy Building' started by botpro, Feb 23, 2016.

  1. botpro

    botpro

    And here the correlation analysis of _correlated_ GBM data
    Params: stocks=5, vola=30%, bars_per_day=78 (ie. 5-minute bars), 21 days, and the input correlation matrix and its computed Cholesky decomposition matrix:
    Code:
    Name=corr rows=5 cols=5:
      1.00000  0.50000  0.60000  0.70000  0.80000
      0.50000  1.00000  0.90000  0.10000  0.20000
      0.60000  0.90000  1.00000  0.30000  0.40000
      0.70000  0.10000  0.30000  1.00000  0.50000
      0.80000  0.20000  0.40000  0.50000  1.00000
    
    Name=cholesky rows=5 cols=5:
      1.00000  0.50000  0.60000  0.70000  0.80000
      0.00000  0.86603  0.69282 -0.28868 -0.23094
      0.00000  0.00000  0.40000  0.20000  0.20000
      0.00000  0.00000  0.00000  0.62183 -0.26803
      0.00000  0.00000  0.00000  0.00000  0.44139
    
    Showing only the last 9 observed correlations of the 21st day:
    Code:
    d=21 b=70:
      1.00000  0.50157  0.59981  0.67462  0.79127
      0.50157  1.00000  0.89812  0.08724  0.19018
      0.59981  0.89812  1.00000  0.30203  0.39093
      0.67462  0.08724  0.30203  1.00000  0.48392
      0.79127  0.19018  0.39093  0.48392  1.00000
    
    d=21 b=71:
      1.00000  0.50102  0.59956  0.67523  0.79153
      0.50102  1.00000  0.89807  0.08690  0.18993
      0.59956  0.89807  1.00000  0.30189  0.39089
      0.67523  0.08690  0.30189  1.00000  0.48475
      0.79153  0.18993  0.39089  0.48475  1.00000
    
    d=21 b=72:
      1.00000  0.50091  0.59946  0.67502  0.79155
      0.50091  1.00000  0.89822  0.08619  0.19020
      0.59946  0.89822  1.00000  0.30115  0.39098
      0.67502  0.08619  0.30115  1.00000  0.48454
      0.79155  0.19020  0.39098  0.48454  1.00000
    
    d=21 b=73:
      1.00000  0.50080  0.59945  0.67498  0.79153
      0.50080  1.00000  0.89773  0.08593  0.18998
      0.59945  0.89773  1.00000  0.30147  0.39119
      0.67498  0.08593  0.30147  1.00000  0.48472
      0.79153  0.18998  0.39119  0.48472  1.00000
    
    d=21 b=74:
      1.00000  0.50113  0.59966  0.67516  0.79124
      0.50113  1.00000  0.89777  0.08651  0.18984
      0.59966  0.89777  1.00000  0.30182  0.39104
      0.67516  0.08651  0.30182  1.00000  0.48453
      0.79124  0.18984  0.39104  0.48453  1.00000
    
    d=21 b=75:
      1.00000  0.50182  0.60017  0.67528  0.79112
      0.50182  1.00000  0.89806  0.08733  0.19005
      0.60017  0.89806  1.00000  0.30229  0.39098
      0.67528  0.08733  0.30229  1.00000  0.48460
      0.79112  0.19005  0.39098  0.48460  1.00000
    
    d=21 b=76:
      1.00000  0.50170  0.59974  0.67528  0.79115
      0.50170  1.00000  0.89798  0.08731  0.18999
      0.59974  0.89798  1.00000  0.30214  0.39068
      0.67528  0.08731  0.30214  1.00000  0.48461
      0.79115  0.18999  0.39068  0.48461  1.00000
    
    d=21 b=77:
      1.00000  0.50175  0.59971  0.67526  0.79113
      0.50175  1.00000  0.89794  0.08765  0.18999
      0.59971  0.89794  1.00000  0.30264  0.39056
      0.67526  0.08765  0.30264  1.00000  0.48450
      0.79113  0.18999  0.39056  0.48450  1.00000
    
    d=21 b=78:
      1.00000  0.50162  0.59955  0.67526  0.79114
      0.50162  1.00000  0.89795  0.08744  0.18989
      0.59955  0.89795  1.00000  0.30237  0.39043
      0.67526  0.08744  0.30237  1.00000  0.48453
      0.79114  0.18989  0.39043  0.48453  1.00000
    
    As can be seen, the observed correlations do, to a high degree, match the specified input correlations, as it should be.

    Next step is of course: analysis of the observed correlations to find a stock for opening a position, and of course also whether to keep or close currently held stocks in portfolio...
     
    Last edited: Feb 24, 2016
    #11     Feb 24, 2016