Setup

library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.3     ✔ readr     2.1.4
## ✔ forcats   1.0.0     ✔ stringr   1.5.0
## ✔ ggplot2   3.4.3     ✔ tibble    3.2.1
## ✔ lubridate 1.9.2     ✔ tidyr     1.3.0
## ✔ purrr     1.0.2     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(tidyquant) # for financial analysis
## Loading required package: PerformanceAnalytics
## Loading required package: xts
## Loading required package: zoo
## 
## Attaching package: 'zoo'
## 
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
## 
## 
## ######################### Warning from 'xts' package ##########################
## #                                                                             #
## # The dplyr lag() function breaks how base R's lag() function is supposed to  #
## # work, which breaks lag(my_xts). Calls to lag(my_xts) that you type or       #
## # source() into this session won't work correctly.                            #
## #                                                                             #
## # Use stats::lag() to make sure you're not using dplyr::lag(), or you can add #
## # conflictRules('dplyr', exclude = 'lag') to your .Rprofile to stop           #
## # dplyr from breaking base R's lag() function.                                #
## #                                                                             #
## # Code in packages is not affected. It's protected by R's namespace mechanism #
## # Set `options(xts.warn_dplyr_breaks_lag = FALSE)` to suppress this warning.  #
## #                                                                             #
## ###############################################################################
## 
## Attaching package: 'xts'
## 
## The following objects are masked from 'package:dplyr':
## 
##     first, last
## 
## 
## Attaching package: 'PerformanceAnalytics'
## 
## The following object is masked from 'package:graphics':
## 
##     legend
## 
## Loading required package: quantmod
## Loading required package: TTR
## Registered S3 method overwritten by 'quantmod':
##   method            from
##   as.zoo.data.frame zoo
library(broom) # for tidy model results
library(umap)  # for dimension reduction
## Warning: package 'umap' was built under R version 4.3.3
library(plotly) # for interactive visualization
## 
## Attaching package: 'plotly'
## 
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## 
## The following object is masked from 'package:stats':
## 
##     filter
## 
## The following object is masked from 'package:graphics':
## 
##     layout

Data

# Get info on companies listed in S&P500
sp500_index_tbl <- tq_index("SP500")
## Getting holdings for SP500
# Get individual stocks from S&P500
sp500_symbols <- sp500_index_tbl %>% distinct(symbol) %>% pull() 

# Get stock prices of the companies
sp500_prices_tbl <- tq_get(sp500_symbols, from = "2020-04-01")
## Warning: There was 1 warning in `dplyr::mutate()`.
## ℹ In argument: `data.. = purrr::map(...)`.
## Caused by warning:
## ! x = '-', get = 'stock.prices': Error in getSymbols.yahoo(Symbols = "-", env = <environment>, verbose = FALSE, : Unable to import "-".
## HTTP error 404.
##  Removing -.
write.csv(sp500_index_tbl, "../00_data/sp500_index_tbl.csv")
write.csv(sp500_prices_tbl, "../00_data/sp500_prices_tbl.csv")

Import Data

sp500_index_tbl <- read_csv("../00_data/sp500_index_tbl.csv")
## New names:
## Rows: 504 Columns: 9
## ── Column specification
## ──────────────────────────────────────────────────────── Delimiter: "," chr
## (6): symbol, company, identifier, sedol, sector, local_currency dbl (3): ...1,
## weight, shares_held
## ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
## Specify the column types or set `show_col_types = FALSE` to quiet this message.
## • `` -> `...1`
sp500_prices_tbl <- read_csv("../00_data/sp500_prices_tbl.csv")
## New names:
## Rows: 506567 Columns: 9
## ── Column specification
## ──────────────────────────────────────────────────────── Delimiter: "," chr
## (1): symbol dbl (7): ...1, open, high, low, close, volume, adjusted date (1):
## date
## ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
## Specify the column types or set `show_col_types = FALSE` to quiet this message.
## • `` -> `...1`
sp500_index_tbl %>% glimpse()
## Rows: 504
## Columns: 9
## $ ...1           <dbl> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, …
## $ symbol         <chr> "MSFT", "AAPL", "NVDA", "AMZN", "META", "GOOGL", "GOOG"…
## $ company        <chr> "MICROSOFT CORP", "APPLE INC", "NVIDIA CORP", "AMAZON.C…
## $ identifier     <chr> "594918104", "037833100", "67066G104", "023135106", "30…
## $ sedol          <chr> "2588173", "2046251", "2379504", "2000019", "B7TL820", …
## $ weight         <dbl> 0.072444822, 0.057819603, 0.050776486, 0.039408065, 0.0…
## $ sector         <chr> "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", …
## $ shares_held    <dbl> 88031513, 171969802, 29262801, 108296514, 26064988, 698…
## $ local_currency <chr> "USD", "USD", "USD", "USD", "USD", "USD", "USD", "USD",…
sp500_prices_tbl %>% glimpse()
## Rows: 506,567
## Columns: 9
## $ ...1     <dbl> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18…
## $ symbol   <chr> "MSFT", "MSFT", "MSFT", "MSFT", "MSFT", "MSFT", "MSFT", "MSFT…
## $ date     <date> 2020-04-01, 2020-04-02, 2020-04-03, 2020-04-06, 2020-04-07, …
## $ open     <dbl> 153.00, 151.86, 155.10, 160.32, 169.59, 165.67, 166.36, 164.3…
## $ high     <dbl> 157.75, 155.48, 157.38, 166.50, 170.00, 166.67, 167.37, 165.5…
## $ low      <dbl> 150.82, 150.36, 152.19, 157.58, 163.26, 163.50, 163.33, 162.3…
## $ close    <dbl> 152.11, 155.26, 153.83, 165.27, 163.49, 165.13, 165.14, 165.5…
## $ volume   <dbl> 57969900, 49630700, 41243300, 67111700, 62769000, 48318200, 5…
## $ adjusted <dbl> 146.7080, 149.7462, 148.3670, 159.4007, 157.6839, 159.2657, 1…

Question Which stock prices behave similarly?

Our main objective is to identify stocks that exhibit similar price behaviors over time. By doing so, we aim to gain insights into the relationships between different companies, uncovering potential competitors and sector affiliations.

Why It Matters Understanding which companies are related is crucial for various reasons:

Identifying Relationships: Clustering similar stocks reveals underlying connections and dependencies in the market. Competitor Analysis: Discovering competitors and sector affiliations aids in strategic planning and market positioning. Market Dynamics: Analyzing stock price similarities provides valuable insights into market dynamics, benefiting diverse fields such as finance, sales, and marketing. Assignment Details Your task is to analyze the historical price data of various stocks and determine which stocks behave similarly. We will employ clustering techniques to accomplish this task effectively.

1 Convert data to standardized form To compare data effectively, it must be standardized or normalized. Why? Because comparing values (like stock prices) of vastly different magnitudes is impractical. So, we’ll standardize by converting from adjusted stock price (in dollars) to daily returns (as percent change from the previous day). Here’s the formula:

returndaily=(pricei−pricei−1)/pricei−1

sp500_prices_tbl %>% glimpse()
## Rows: 506,567
## Columns: 9
## $ ...1     <dbl> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18…
## $ symbol   <chr> "MSFT", "MSFT", "MSFT", "MSFT", "MSFT", "MSFT", "MSFT", "MSFT…
## $ date     <date> 2020-04-01, 2020-04-02, 2020-04-03, 2020-04-06, 2020-04-07, …
## $ open     <dbl> 153.00, 151.86, 155.10, 160.32, 169.59, 165.67, 166.36, 164.3…
## $ high     <dbl> 157.75, 155.48, 157.38, 166.50, 170.00, 166.67, 167.37, 165.5…
## $ low      <dbl> 150.82, 150.36, 152.19, 157.58, 163.26, 163.50, 163.33, 162.3…
## $ close    <dbl> 152.11, 155.26, 153.83, 165.27, 163.49, 165.13, 165.14, 165.5…
## $ volume   <dbl> 57969900, 49630700, 41243300, 67111700, 62769000, 48318200, 5…
## $ adjusted <dbl> 146.7080, 149.7462, 148.3670, 159.4007, 157.6839, 159.2657, 1…
# Apply your data transformation skills!
sp_500_daily_returns_tbl <- sp500_prices_tbl %>%
    
    select(symbol, date, adjusted) %>%
    
    filter(date >= ymd("2018-01-01")) %>%
    
    group_by(symbol) %>%
    mutate(lag_1 = lag(adjusted)) %>%
    ungroup() %>%
    
    filter(!is.na(lag_1)) %>%
    
    mutate(diff = adjusted - lag_1) %>%
    mutate(pct_return = diff / lag_1) %>%
    
    select(symbol, date, pct_return)

sp_500_daily_returns_tbl
## # A tibble: 506,064 × 3
##    symbol date       pct_return
##    <chr>  <date>          <dbl>
##  1 MSFT   2020-04-02  0.0207   
##  2 MSFT   2020-04-03 -0.00921  
##  3 MSFT   2020-04-06  0.0744   
##  4 MSFT   2020-04-07 -0.0108   
##  5 MSFT   2020-04-08  0.0100   
##  6 MSFT   2020-04-09  0.0000603
##  7 MSFT   2020-04-13  0.00224  
##  8 MSFT   2020-04-14  0.0495   
##  9 MSFT   2020-04-15 -0.0105   
## 10 MSFT   2020-04-16  0.0300   
## # ℹ 506,054 more rows

2 Spread to object-characteristics format We’ll convert the daily returns (percentage change from one day to the next) to object-characteristics format, also known as the user-item format. Users are identified by the symbol (company), and items are represented by the pct_return at each date.

stock_date_matrix_tbl <- sp_500_daily_returns_tbl %>%
    spread(key = date, value = pct_return, fill = 0)

stock_date_matrix_tbl
## # A tibble: 503 × 1,017
##    symbol `2020-04-02` `2020-04-03` `2020-04-06` `2020-04-07` `2020-04-08`
##    <chr>         <dbl>        <dbl>        <dbl>        <dbl>        <dbl>
##  1 A           0.0489     -0.0259         0.0560     -0.00444       0.0359
##  2 AAL        -0.0589     -0.0666         0.0117      0.0758        0.109 
##  3 AAPL        0.0167     -0.0144         0.0872     -0.0116        0.0256
##  4 ABBV        0.0233     -0.0234         0.0322     -0.00449       0.0420
##  5 ABNB        0           0              0           0             0     
##  6 ABT         0.0375      0.000126       0.0413     -0.00967       0.0369
##  7 ACGL        0.0115     -0.0650         0.0983      0.0314        0.0291
##  8 ACN         0.0103     -0.0264         0.0914     -0.0116        0.0464
##  9 ADBE        0.00913    -0.0341         0.0869     -0.0320        0.0267
## 10 ADI         0.0429     -0.0130         0.107       0.00470       0.0535
## # ℹ 493 more rows
## # ℹ 1,011 more variables: `2020-04-09` <dbl>, `2020-04-13` <dbl>,
## #   `2020-04-14` <dbl>, `2020-04-15` <dbl>, `2020-04-16` <dbl>,
## #   `2020-04-17` <dbl>, `2020-04-20` <dbl>, `2020-04-21` <dbl>,
## #   `2020-04-22` <dbl>, `2020-04-23` <dbl>, `2020-04-24` <dbl>,
## #   `2020-04-27` <dbl>, `2020-04-28` <dbl>, `2020-04-29` <dbl>,
## #   `2020-04-30` <dbl>, `2020-05-01` <dbl>, `2020-05-04` <dbl>, …

Perform k-means clustering

final_cluster <- kmeans(stock_date_matrix_tbl %>%
  select(-symbol), centers = 3, nstart = 20)

final_cluster
## K-means clustering with 3 clusters of sizes 95, 154, 254
## 
## Cluster means:
##   2020-04-02  2020-04-03 2020-04-06    2020-04-07 2020-04-08  2020-04-09
## 1 0.01273890 -0.01609736 0.09310316 -0.0011345340 0.03806894 0.008349393
## 2 0.00621956 -0.01918304 0.10075297  0.0309664011 0.06111239 0.036726031
## 3 0.01792613 -0.01366443 0.06395446  0.0005746936 0.03820826 0.023243814
##     2020-04-13  2020-04-14  2020-04-15   2020-04-16 2020-04-17  2020-04-20
## 1 -0.003818241 0.037539002 -0.01795248  0.013724953 0.02576905 -0.01098075
## 2 -0.031458369 0.009929367 -0.05327281 -0.032203970 0.07174634 -0.02733561
## 3 -0.021392016 0.029143590 -0.02495388  0.006699283 0.02943419 -0.02044472
##    2020-04-21 2020-04-22    2020-04-23 2020-04-24 2020-04-27   2020-04-28
## 1 -0.04142402 0.03747237 -0.0001874959 0.01844749 0.02028561 -0.001582118
## 2 -0.02870810 0.01288109  0.0168903690 0.01209195 0.04432825  0.031947687
## 3 -0.02533574 0.01769171 -0.0040367843 0.01255356 0.01968641  0.001944287
##    2020-04-29  2020-04-30  2020-05-01   2020-05-04   2020-05-05  2020-05-06
## 1 0.045414368 -0.01765833 -0.03314824  0.009795819  0.020542904  0.01139186
## 2 0.065734073 -0.03653798 -0.05240258 -0.002807642 -0.009522395 -0.02253314
## 3 0.007787165 -0.01613686 -0.02124295  0.001556040  0.011326112 -0.01318433
##   2020-05-07 2020-05-08   2020-05-11  2020-05-12  2020-05-13  2020-05-14
## 1 0.02175054 0.02411108  0.007155689 -0.02401684 -0.02153533 0.013276330
## 2 0.02716970 0.04552785 -0.029550107 -0.03249954 -0.04736339 0.026101983
## 3 0.01093943 0.01617537 -0.001046987 -0.02034090 -0.01593579 0.007625256
##    2020-05-15 2020-05-18   2020-05-19 2020-05-20   2020-05-21   2020-05-22
## 1 0.004934188 0.03785635 -0.002849317 0.02144859 -0.012729216  0.007437763
## 2 0.001122498 0.09127200 -0.018868343 0.03000183  0.001400569 -0.004332992
## 3 0.003016718 0.03374920 -0.011512060 0.01026953 -0.005853315  0.003931731
##    2020-05-26  2020-05-27   2020-05-28   2020-05-29  2020-06-01  2020-06-02
## 1 0.004908845 0.009797206 -0.004757342  0.019115106 0.009601716 0.009674488
## 2 0.063693389 0.035565202 -0.030256034 -0.014205483 0.022375836 0.019685077
## 3 0.014879930 0.018342625  0.008271753  0.005647967 0.001912584 0.007458350
##   2020-06-03  2020-06-04 2020-06-05  2020-06-08  2020-06-09   2020-06-10
## 1 0.01153288 -0.01084787 0.02219640 0.003317253 -0.00589402  0.007266274
## 2 0.04854912  0.02497408 0.05454548 0.041001896 -0.04019690 -0.045517788
## 3 0.01295319 -0.00553324 0.02166405 0.011602254 -0.01475413 -0.010131595
##    2020-06-11  2020-06-12  2020-06-15 2020-06-16   2020-06-17    2020-06-18
## 1 -0.05823271 0.013811116 0.020310916 0.01512562  0.001303262  2.388569e-03
## 2 -0.09195575 0.038689745 0.012048699 0.02357297 -0.023106021 -9.327599e-05
## 3 -0.05097833 0.009349846 0.008622221 0.01612375 -0.002607907 -1.641270e-03
##     2020-06-19   2020-06-22   2020-06-23  2020-06-24  2020-06-25  2020-06-26
## 1  0.000710050  0.008511180  0.003775803 -0.02566110 0.010387415 -0.01783846
## 2 -0.016612025 -0.002795329  0.005634786 -0.05121827 0.014845961 -0.03364166
## 3 -0.007287037  0.002122207 -0.002072526 -0.02278781 0.007827682 -0.01447090
##    2020-06-29 2020-06-30   2020-07-01  2020-07-02 2020-07-06   2020-07-07
## 1 0.009537106 0.02340370  0.001485042 0.004720249 0.01980219 -0.008846812
## 2 0.031951746 0.01324692 -0.014391936 0.007261305 0.01543078 -0.031152366
## 3 0.015581852 0.01216326  0.005393040 0.005226587 0.00544441 -0.008027626
##      2020-07-08   2020-07-09   2020-07-10    2020-07-13 2020-07-14 2020-07-15
## 1  0.0161935903  0.007988176 -0.001379848 -0.0231196636 0.01799618 0.01157129
## 2  0.0026690075 -0.034932368  0.033776830  0.0005368737 0.01358686 0.04350549
## 3 -0.0004856454 -0.009219178  0.010031836 -0.0021705063 0.01800319 0.01245968
##     2020-07-16   2020-07-17   2020-07-20   2020-07-21  2020-07-22   2020-07-23
## 1 -0.005513870  0.012526401  0.019365779 -0.006184530 0.006679967 -0.013306610
## 2 -0.006373906 -0.009745940 -0.015713444  0.025818107 0.002539760  0.001812240
## 3  0.001546856  0.009857001 -0.005412879  0.004887869 0.010322975 -0.001728082
##     2020-07-24   2020-07-27   2020-07-28 2020-07-29   2020-07-30    2020-07-31
## 1 -0.012525780  0.023149148 -0.016702122 0.01961510  0.005197859  5.841584e-03
## 2 -0.008703232 -0.003983684 -0.007454161 0.02333259 -0.018337112 -6.973768e-03
## 3 -0.005136525  0.003265199 -0.002237877 0.01318951 -0.004868261 -8.972955e-05
##    2020-08-03  2020-08-04  2020-08-05    2020-08-06   2020-08-07   2020-08-10
## 1 0.014859845 0.004217169 0.009464684 -0.0002642731 -0.007677417 -0.007738828
## 2 0.004037561 0.010377325 0.018701183  0.0007367564  0.016099575  0.031172090
## 3 0.001138309 0.003059489 0.001261306 -0.0003220788  0.010432516  0.003065853
##     2020-08-11   2020-08-12   2020-08-13    2020-08-14   2020-08-17
## 1 -0.013559623  0.018562321  0.006848302 -0.0043750977  0.011064117
## 2  0.007314094 -0.001580804 -0.010564609  0.0086692302 -0.009604007
## 3 -0.005168536  0.009563887 -0.003004314 -0.0002484203  0.003073070
##     2020-08-18   2020-08-19   2020-08-20    2020-08-21  2020-08-24
## 1  0.002042456 -0.003120643  0.002968759  0.0008848517 0.003590182
## 2 -0.011119879 -0.003603234 -0.011488624 -0.0043033655 0.033409660
## 3 -0.001410877 -0.004715378 -0.003676019  0.0001821002 0.006660020
##      2020-08-25    2020-08-26   2020-08-27  2020-08-28   2020-08-31
## 1  0.0068346002  0.0138877061 -0.009630562 0.007344710  0.003462113
## 2 -0.0036476724 -0.0100113538  0.016264530 0.016290534 -0.021200197
## 3  0.0004369554 -0.0003279207  0.003769559 0.003452853 -0.002338076
##      2020-09-01 2020-09-02  2020-09-03   2020-09-04  2020-09-08  2020-09-09
## 1  0.0143360710 0.01606218 -0.05125299 -0.019231397 -0.02936551 0.025911037
## 2  0.0061796602 0.01513632 -0.01232089  0.008596474 -0.02474698 0.004799883
## 3 -0.0008041418 0.01956789 -0.02255124 -0.004655217 -0.01684181 0.015714891
##    2020-09-10   2020-09-11 2020-09-14   2020-09-15   2020-09-16   2020-09-17
## 1 -0.01321809 -0.001609904 0.01838919  0.013632591 -0.008460033 -0.012407695
## 2 -0.01659436  0.006590186 0.02410741 -0.004656499  0.019626328 -0.002159032
## 3 -0.01355574  0.004796823 0.01304649  0.002632733  0.001867354 -0.003623982
##     2020-09-18   2020-09-21    2020-09-22  2020-09-23   2020-09-24 2020-09-25
## 1 -0.007114132 -0.001886827  0.0136872291 -0.02163717 0.0010885843 0.02061290
## 2 -0.013113787 -0.044908901 -0.0007944586 -0.02792400 0.0008007644 0.01202761
## 3 -0.009659352 -0.017532105  0.0058793085 -0.01821944 0.0028381785 0.01336686
##   2020-09-28   2020-09-29  2020-09-30   2020-10-01  2020-10-02 2020-10-05
## 1 0.02190864  0.002629789 0.004481908  0.017293621 -0.01686156 0.02335067
## 2 0.02654647 -0.017194220 0.005965352 -0.001412079  0.01703426 0.02301068
## 3 0.01222293 -0.004053528 0.007138949  0.001778260  0.00308538 0.01371177
##     2020-10-06 2020-10-07  2020-10-08   2020-10-09  2020-10-12   2020-10-13
## 1 -0.009671907 0.02220959 0.008810922  0.014787059 0.011995974  0.002240306
## 2 -0.013299562 0.02321067 0.020407454 -0.006542892 0.004384830 -0.019227174
## 3 -0.007198726 0.01269614 0.010946667  0.003890321 0.007292733 -0.006215095
##     2020-10-14   2020-10-15   2020-10-16  2020-10-19  2020-10-20   2020-10-21
## 1 -0.005115938 0.0022054149 -0.001291435 -0.01116682 0.003404987 -0.009229779
## 2 -0.001615321 0.0085987764 -0.004956891 -0.01348937 0.011705201 -0.007019853
## 3 -0.002521425 0.0009854046  0.001823495 -0.01344158 0.003043091 -0.001004879
##    2020-10-22  2020-10-23  2020-10-26    2020-10-27  2020-10-28  2020-10-29
## 1 0.003991289 0.006335802 -0.01797892 -0.0005010196 -0.02992115 0.012308861
## 2 0.028838364 0.004164328 -0.03475689 -0.0230514606 -0.03536207 0.022545551
## 3 0.004720394 0.004683723 -0.01594296 -0.0087489020 -0.02733939 0.003321131
##     2020-10-30 2020-11-02 2020-11-03   2020-11-04 2020-11-05    2020-11-06
## 1 -0.020115021 0.01140375 0.02361484  0.040071486 0.03094688  0.0072091891
## 2  0.003981947 0.02879369 0.02064429 -0.019919665 0.03009960 -0.0135504626
## 3 -0.002024049 0.02047264 0.01848355  0.006447764 0.01098298  0.0007725062
##    2020-11-09  2020-11-10   2020-11-11  2020-11-12 2020-11-13  2020-11-16
## 1 -0.02081561 -0.01898052  0.025507467 -0.00818200 0.01028447 0.008859371
## 2  0.11871743  0.01229223 -0.014939732 -0.02573853 0.03615691 0.037554171
## 3  0.01123420  0.01252346  0.001546358 -0.01025544 0.01574962 0.010749333
##      2020-11-17   2020-11-18   2020-11-19   2020-11-20  2020-11-23
## 1 -0.0001442395 -0.009184446 0.0140048735 -0.001022945 0.006956423
## 2  0.0032265570 -0.010343001 0.0077005502 -0.009153410 0.034811695
## 3 -0.0077110403 -0.011961928 0.0006790894 -0.004316791 0.003284000
##      2020-11-24   2020-11-25    2020-11-27   2020-11-30  2020-12-01
## 1 -0.0002333086  0.005739077  0.0132485682  0.003768015 0.008225644
## 2  0.0406896500 -0.013097011 -0.0050744469 -0.026558783 0.013713536
## 3  0.0109493408 -0.003744104  0.0006230074 -0.003431908 0.006609912
##     2020-12-02    2020-12-03  2020-12-04   2020-12-07  2020-12-08   2020-12-09
## 1 -0.004141847  0.0060991953 0.012635675  0.004764216 0.007735903 -0.021330101
## 2  0.013344375  0.0119823568 0.026329563 -0.010333698 0.003142398  0.001852892
## 3 -0.003857627 -0.0008883702 0.008847578 -0.003696179 0.002013772 -0.001602237
##     2020-12-10   2020-12-11   2020-12-14 2020-12-15   2020-12-16  2020-12-17
## 1  0.005148102 -0.001503950  0.006782920 0.01191833  0.003547979 0.012542881
## 2  0.006224909 -0.010565994 -0.017890175 0.02184406 -0.003217514 0.003052876
## 3 -0.006207218 -0.001301101 -0.004656341 0.01245115 -0.002658784 0.008805004
##     2020-12-18   2020-12-21   2020-12-22    2020-12-23   2020-12-24
## 1  0.006767166 -0.002795737  0.008113729 -0.0061903230  0.003318058
## 2 -0.009107273 -0.004936190 -0.010241412  0.0195203247 -0.002259168
## 3 -0.001851666 -0.007882842 -0.002364258  0.0003633923  0.004528765
##     2020-12-28   2020-12-29  2020-12-30  2020-12-31  2021-01-04  2021-01-05
## 1 -0.004191240 -0.005086337 0.006029730 0.003819065 -0.01322952 0.010249660
## 2  0.002738136 -0.006933367 0.012723592 0.004399971 -0.01719282 0.021527365
## 3  0.002578492 -0.003379274 0.002674902 0.010106678 -0.01577803 0.002824981
##     2021-01-06  2021-01-07   2021-01-08   2021-01-11  2021-01-12    2021-01-13
## 1 0.0005058116 0.029319389  0.007618050 -0.002014634 0.002967353  8.216497e-06
## 2 0.0429050922 0.010157588 -0.005075101  0.002144227 0.020547735 -6.852300e-03
## 3 0.0175254132 0.003220996  0.003496333 -0.002856057 0.000244692 -4.500715e-04
##      2021-01-14    2021-01-15   2021-01-19  2021-01-20   2021-01-21
## 1  0.0003059525 -0.0071717017 0.0164019767 0.015678351  0.002546584
## 2  0.0163834444 -0.0180935213 0.0063087280 0.002339495 -0.010812467
## 3 -0.0042307726  0.0005378397 0.0003524759 0.007608058 -0.004238908
##     2021-01-22    2021-01-25   2021-01-26  2021-01-27  2021-01-28  2021-01-29
## 1 -0.004926125  0.0004803716 -0.008886699 -0.03338249 0.018858201 -0.01475466
## 2 -0.006086744 -0.0103116394 -0.010594321 -0.02539741 0.019959603 -0.02530017
## 3 -0.003053967  0.0039126059 -0.002832774 -0.01949086 0.006516969 -0.01363318
##    2021-02-01  2021-02-02   2021-02-03  2021-02-04  2021-02-05  2021-02-08
## 1 0.025328656 0.019159580 -0.008525433 0.017419154 0.006251894 0.015303340
## 2 0.013705362 0.018064559  0.017056536 0.017804888 0.008097641 0.021259376
## 3 0.009957996 0.009060176 -0.002451447 0.006960035 0.004223392 0.003756394
##     2021-02-09  2021-02-10    2021-02-11   2021-02-12   2021-02-16   2021-02-17
## 1  0.000881790 0.001307195  0.0143426818 0.0099304328 -0.005807557 -0.008472094
## 2 -0.005272343 0.006300045 -0.0007680928 0.0107879101  0.013510081  0.001044463
## 3  0.001823968 0.000709821 -0.0016607926 0.0009343587 -0.006151276  0.002468133
##      2021-02-18   2021-02-19  2021-02-22   2021-02-23 2021-02-24  2021-02-25
## 1 -0.0087989533  0.005447233 -0.03238606 -0.003534123 0.01378591 -0.03784209
## 2 -0.0127910035  0.025368888  0.02101618  0.009127785 0.02930668 -0.03035088
## 3  0.0003910362 -0.004241073 -0.00254736  0.001562474 0.00377184 -0.01284443
##     2021-02-26 2021-03-01   2021-03-02   2021-03-03   2021-03-04 2021-03-05
## 1  0.013458630 0.02770055 -0.017599274 -0.034181658 -0.032780364 0.01870479
## 2 -0.007523392 0.02648757 -0.001631818  0.008136787 -0.012300461 0.02378307
## 3 -0.010306032 0.01682971 -0.001940153 -0.007149855 -0.009406299 0.02279636
##    2021-03-08   2021-03-09   2021-03-10  2021-03-11   2021-03-12  2021-03-15
## 1 -0.02962422  0.040308743 -0.003165931 0.031867758 -0.007627064 0.019421702
## 2  0.01563651 -0.012453508  0.018861558 0.006671691  0.011803694 0.004910997
## 3  0.00851962  0.003315112  0.009439849 0.001039360  0.007685155 0.009470742
##     2021-03-16   2021-03-17   2021-03-18   2021-03-19   2021-03-22  2021-03-23
## 1 -0.002701549  0.004446168 -0.031368074  0.011108164  0.015330913 -0.01371077
## 2 -0.019167621  0.013052740 -0.012857707 -0.003813323 -0.012017768 -0.03014398
## 3 -0.002889324 -0.001868301 -0.002196478 -0.002243767  0.005192037 -0.00378741
##     2021-03-24  2021-03-25 2021-03-26   2021-03-29    2021-03-30   2021-03-31
## 1 -0.017417048 0.001486817 0.03186751 -0.012415870  9.342431e-05  0.019733778
## 2  0.001133359 0.021144226 0.01414798 -0.016062932  1.298528e-02 -0.007330446
## 3  0.002202458 0.009456396 0.01672186  0.003789448 -5.615073e-03 -0.003443147
##    2021-04-01  2021-04-05    2021-04-06   2021-04-07    2021-04-08  2021-04-09
## 1 0.021344707 0.013253580  2.606819e-03 -0.005751595  1.345912e-02 0.007767510
## 2 0.015096665 0.003830922  2.670628e-03 -0.001863421 -2.469966e-03 0.004461789
## 3 0.005230425 0.010476603 -8.290791e-05 -0.003770057 -7.498905e-05 0.005693545
##      2021-04-12    2021-04-13    2021-04-14   2021-04-15  2021-04-16
## 1 -1.940433e-03  0.0066286901 -0.0081098239  0.015454599 0.002140561
## 2 -6.188486e-05 -0.0075617358  0.0110412257 -0.001512348 0.002146712
## 3  3.856442e-03  0.0009063484 -0.0003802168  0.011302753 0.006609232
##     2021-04-19   2021-04-20  2021-04-21   2021-04-22  2021-04-23   2021-04-26
## 1 -0.013839777 -0.009738045 0.014526120 -0.001751378 0.018363579  0.008389801
## 2 -0.004505445 -0.023510626 0.020790207 -0.009967381 0.016859767  0.008386023
## 3 -0.001862349  0.002917238 0.006690822 -0.004247031 0.004794603 -0.004326601
##      2021-04-27   2021-04-28    2021-04-29   2021-04-30   2021-05-03
## 1 -0.0018378052 -0.007420570 -0.0008333492 -0.017825931 -0.007432229
## 2  0.0076562696  0.007769234  0.0070346899 -0.010313396  0.009503491
## 3 -0.0004469453 -0.002292046  0.0089733296 -0.002366473  0.007991341
##     2021-05-04   2021-05-05   2021-05-06  2021-05-07   2021-05-10   2021-05-11
## 1 -0.017217633 -0.001240722 -0.004726438 0.012485267 -0.025605402 -0.001150745
## 2 -0.001176386  0.010361263  0.004255116 0.018435942 -0.004809208 -0.014544367
## 3  0.002331254 -0.002046291  0.006918794 0.005434791  0.003595639 -0.011849788
##    2021-05-12  2021-05-13  2021-05-14   2021-05-17   2021-05-18   2021-05-19
## 1 -0.03273205 0.008489301 0.027261583 -0.007454434 -0.005589558  0.006185453
## 2 -0.02363363 0.013555040 0.024280058  0.006000255 -0.012344251 -0.012200988
## 3 -0.01816005 0.015531370 0.006135389 -0.003109384 -0.006441555 -0.004458212
##     2021-05-20   2021-05-21  2021-05-24   2021-05-25    2021-05-26   2021-05-27
## 1 0.0219607745 -0.003191796 0.014607435  0.001582899  0.0057726859 0.0033375520
## 2 0.0003867841  0.004467504 0.007721910 -0.008843564  0.0106771649 0.0123791338
## 3 0.0078236840  0.001147279 0.002923244 -0.003740551 -0.0006885296 0.0007465518
##     2021-05-28   2021-06-01    2021-06-02   2021-06-03  2021-06-04
## 1  0.002687477 -0.005710735  0.0008078355 -0.012425685 0.017628303
## 2 -0.001578982  0.017391743 -0.0006481405 -0.002364349 0.002162418
## 3  0.002417707 -0.001426093  0.0022112585  0.001896236 0.003842041
##      2021-06-07   2021-06-08   2021-06-09   2021-06-10   2021-06-11
## 1  8.358539e-06  0.001986273 -0.003207923  0.012627043 0.0063244576
## 2 -2.669773e-03  0.004638448 -0.010360420 -0.009037002 0.0062024251
## 3 -1.583856e-03 -0.000134087 -0.000707333  0.005097759 0.0008178867
##     2021-06-14    2021-06-15   2021-06-16  2021-06-17   2021-06-18 2021-06-21
## 1  0.006975472 -0.0073300192 -0.003621897  0.01283726 -0.008570253 0.01099810
## 2 -0.012097809  0.0038477997 -0.004556320 -0.03045769 -0.021764136 0.03001297
## 3 -0.001863347  0.0002156048 -0.009170354 -0.00309199 -0.015587558 0.01577619
##      2021-06-22   2021-06-23  2021-06-24  2021-06-25    2021-06-28   2021-06-29
## 1  0.0074914902  0.002316078 0.009333307 0.005629780  1.261517e-02  0.005864202
## 2 -0.0004412193  0.003187068 0.010040264 0.007952680 -1.860697e-02 -0.003879441
## 3  0.0009675313 -0.005181564 0.003230396 0.006877931 -9.643303e-05 -0.001832249
##      2021-06-30   2021-07-01   2021-07-02   2021-07-06   2021-07-07
## 1 -5.185352e-03 0.0007584695  0.007656418  0.002417699 -0.001411749
## 2  9.618990e-03 0.0106951166 -0.002236035 -0.022208230 -0.004229905
## 3  1.544017e-05 0.0065682929  0.003612309 -0.002550925  0.008157365
##     2021-07-08  2021-07-09  2021-07-12   2021-07-13   2021-07-14   2021-07-15
## 1 -0.008461026 0.012189738 0.002397101 -0.005325690 -0.003473735 -0.007188632
## 2 -0.013800604 0.027948474 0.005086517 -0.016224086 -0.008163663 -0.005765663
## 3 -0.007816711 0.009265967 0.000860086 -0.005703856  0.003096481  0.002057219
##      2021-07-16   2021-07-19 2021-07-20   2021-07-21    2021-07-22  2021-07-23
## 1 -0.0052744859 -0.004948986 0.01739634 0.0121108414  0.0055767891 0.014979569
## 2 -0.0215085037 -0.032902445 0.03103782 0.0245549677 -0.0127693505 0.002087198
## 3  0.0003302184 -0.013515693 0.01269891 0.0009430669  0.0004898227 0.009271094
##     2021-07-26   2021-07-27   2021-07-28  2021-07-29   2021-07-30   2021-08-02
## 1 -0.003552288 -0.008783361  0.009503480 0.009829832  2.94439e-03  0.003259423
## 2  0.013854146 -0.006318753  0.003639411 0.009838671 -9.33229e-03 -0.006811827
## 3 -0.001374171  0.003847623 -0.004396579 0.004936932  8.19048e-05 -0.000717071
##    2021-08-03  2021-08-04  2021-08-05   2021-08-06    2021-08-09   2021-08-10
## 1 0.008404713  0.00689460 0.001750528 -0.003410527  0.0015491286 -0.008306706
## 2 0.010450064 -0.01836101 0.020073015  0.011272834 -0.0052252174  0.015971778
## 3 0.006551551 -0.00838948 0.000555539  0.002969026 -0.0009594344  0.001582114
##     2021-08-11    2021-08-12   2021-08-13   2021-08-16    2021-08-17
## 1 -0.002266225  0.0006283346  0.001963485  0.001197996 -0.0117567444
## 2  0.012129981 -0.0020976574 -0.008817312 -0.009495021 -0.0158367532
## 3  0.006418422  0.0003281137  0.004050868  0.006045306 -0.0006316028
##     2021-08-18   2021-08-19  2021-08-20    2021-08-23   2021-08-24  2021-08-25
## 1 -0.008417715  0.004281136 0.009871700  0.0127906039  0.007534827 0.004892982
## 2 -0.009196341 -0.016361760 0.007779864  0.0187609648  0.015601341 0.011436152
## 3 -0.010787631  0.003123342 0.005641642 -0.0009675847 -0.002041279 0.001815281
##     2021-08-26  2021-08-27   2021-08-30   2021-08-31   2021-09-01  2021-09-02
## 1 -0.004459992 0.011463486  0.006096426 -0.004802540  0.003202478 0.004458148
## 2 -0.012318015 0.020702046 -0.012671296  0.002099027 -0.006754501 0.009021798
## 3 -0.004925564 0.004783636  0.002518382  0.001302841  0.003064260 0.006612949
##     2021-09-03   2021-09-07   2021-09-08    2021-09-09   2021-09-10
## 1  0.002936497 -0.004265184 -0.005919696  0.0009276073 -0.002397100
## 2 -0.007225674 -0.004961535 -0.008667225  0.0041412140 -0.007444684
## 3 -0.003013441 -0.011585468  0.006594433 -0.0081386350 -0.007100318
##      2021-09-13    2021-09-14  2021-09-15   2021-09-16   2021-09-17
## 1 -0.0057318856 -0.0005930127 0.006814171  0.004657799 -0.009550057
## 2  0.0154659422 -0.0154522702 0.018744382 -0.003221237 -0.007377945
## 3  0.0007621737 -0.0052762336 0.004580789 -0.003904263 -0.007712205
##     2021-09-20   2021-09-21  2021-09-22 2021-09-23   2021-09-24   2021-09-27
## 1 -0.020110877  0.003343803 0.010977705 0.01236142 -0.001285939 -0.010436257
## 2 -0.022512966 -0.005195922 0.022569801 0.02717819  0.005235768  0.021437472
## 3 -0.008582961 -0.002861987 0.004608482 0.00608377 -0.000768928 -0.004890085
##     2021-09-28   2021-09-29   2021-09-30  2021-10-01    2021-10-04  2021-10-05
## 1 -0.032189613 -0.004637189 -0.005981629 0.006208885 -0.0236250511 0.013324797
## 2 -0.009453943 -0.003694022 -0.018983404 0.025041318 -0.0006538216 0.009375472
## 3 -0.011715887  0.007447442 -0.015231704 0.005878220 -0.0042234852 0.005469363
##     2021-10-06  2021-10-07   2021-10-08   2021-10-11   2021-10-12   2021-10-13
## 1  0.002344190 0.013290671 -0.008712407 -0.007152000 0.0005919859  0.007991230
## 2 -0.005278748 0.010329776  0.004060735 -0.004609576 0.0014407565 -0.003944174
## 3  0.005078541 0.005880065 -0.003644724 -0.005522612 0.0004146952  0.003793278
##   2021-10-14  2021-10-15    2021-10-18  2021-10-19    2021-10-20   2021-10-21
## 1 0.02045112 0.003804640  0.0098802184 0.008152151 -0.0001622802  0.012290740
## 2 0.01545720 0.004396168  0.0002659875 0.001985325  0.0090875933 -0.006095477
## 3 0.01641056 0.002047828 -0.0025719579 0.007265774  0.0090060925  0.002930049
##      2021-10-22   2021-10-25    2021-10-26   2021-10-27  2021-10-28
## 1 -0.0006190995  0.007859452 -0.0022449419 -0.004499733 0.016940047
## 2  0.0032125859  0.004982537 -0.0036553097 -0.022136336 0.011173026
## 3  0.0047645643 -0.001338998 -0.0003107866 -0.009507551 0.007465764
##      2021-10-29  2021-11-01   2021-11-02  2021-11-03   2021-11-04   2021-11-05
## 1  0.0085543309 0.005120304  0.005324002 0.004768625  0.010576903 -0.001138774
## 2 -0.0094197705 0.018695274 -0.001271501 0.009492099 -0.004831423  0.019858249
## 3 -0.0006218458 0.001121418  0.003734244 0.004373378 -0.002405454  0.003299180
##      2021-11-08    2021-11-09   2021-11-10   2021-11-11   2021-11-12
## 1  0.0048758718 -0.0007243405 -0.020502940  0.007880457  0.013073285
## 2  0.0016957988 -0.0030618714 -0.010789217  0.005832087 -0.001062465
## 3 -0.0000825643  0.0016557562  0.001206544 -0.001480696  0.005383635
##     2021-11-15    2021-11-16   2021-11-17    2021-11-18   2021-11-19
## 1 -0.002642222  0.0147646382 -0.006293230  0.0008177058  0.003303503
## 2  0.002370717 -0.0045290394 -0.009067019 -0.0049493727 -0.016063495
## 3  0.003023556  0.0006930678 -0.002353389 -0.0034192089 -0.002776444
##    2021-11-22   2021-11-23   2021-11-24  2021-11-26  2021-11-29  2021-11-30
## 1 -0.01561818 -0.010293100 0.0049045960 -0.01739087 0.022467279 -0.02154333
## 2  0.01122599  0.011132077 0.0001218712 -0.04183409 0.003502952 -0.02902320
## 3  0.00153781  0.004473436 0.0001581981 -0.01658962 0.005955974 -0.02470059
##     2021-12-01 2021-12-02   2021-12-03   2021-12-06  2021-12-07  2021-12-08
## 1 -0.017997794 0.01413167 -0.017426657 0.0009237091 0.035420701 0.006509745
## 2 -0.020054576 0.03702722 -0.010115480 0.0225372875 0.018099507 0.004423089
## 3 -0.006850805 0.01947053  0.003120128 0.0132841025 0.009338577 0.002257942
##     2021-12-09  2021-12-10   2021-12-13   2021-12-14  2021-12-15   2021-12-16
## 1 -0.017963771 0.003794113 -0.010056418 -0.015821671 0.024023200 -0.026296238
## 2 -0.008016841 0.003849853 -0.022643093 -0.001114751 0.002404008  0.002145953
## 3 -0.003352122 0.008408105  0.003616302 -0.004900383 0.012009053  0.004681568
##     2021-12-17   2021-12-20 2021-12-21  2021-12-22  2021-12-23 2021-12-27
## 1  0.002241188 -0.014315885 0.02747942 0.011166209 0.008145156 0.01709680
## 2 -0.010191815 -0.020535058 0.03505863 0.006484483 0.008907331 0.01235913
## 3 -0.011785194 -0.008192705 0.00775104 0.006698292 0.004464795 0.01137670
##     2021-12-28    2021-12-29   2021-12-30    2021-12-31   2022-01-03
## 1 -0.007850735  0.0031682110 -0.002753187 -0.0039952205 -0.004781676
## 2  0.001510161 -0.0004450811 -0.002612691  0.0004595574  0.015840579
## 3  0.004439283  0.0050420453 -0.001239893  0.0020983017 -0.006903205
##     2022-01-04   2022-01-05   2022-01-06   2022-01-07    2022-01-10  2022-01-11
## 1 -0.012969250 -0.039144620  0.001119813 -0.022068365 -0.0001479554 0.017277797
## 2  0.027217362 -0.013870372  0.011191375  0.008772609 -0.0084332089 0.014157190
## 3  0.003256923 -0.009159595 -0.002422000 -0.002650614 -0.0034554697 0.003627337
##     2022-01-12   2022-01-13    2022-01-14  2022-01-18   2022-01-19   2022-01-20
## 1 0.0008687497 -0.028871390 -0.0005771909 -0.03097464 -0.010615267 -0.015505166
## 2 0.0024893506  0.003339026  0.0030704629 -0.01746485 -0.019409415 -0.016091890
## 3 0.0010911215 -0.002675222 -0.0050641672 -0.01107307 -0.004016527 -0.008220537
##     2022-01-21  2022-01-24   2022-01-25   2022-01-26   2022-01-27 2022-01-28
## 1 -0.025973037 0.015615793 -0.035652765 -0.006550775 -0.015217994 0.03264218
## 2 -0.021436785 0.008485823  0.003658865 -0.004439263 -0.008061092 0.01079726
## 3 -0.006208021 0.002838278 -0.010880336 -0.008828187 -0.001354352 0.01808649
##    2022-01-31   2022-02-01  2022-02-02   2022-02-03   2022-02-04   2022-02-07
## 1 0.043661731 0.0096787667 0.006894678 -0.037386313  0.008370607 -0.003363950
## 2 0.015173043 0.0184022752 0.004920779 -0.012442876  0.003113511  0.007226042
## 3 0.009531166 0.0001103297 0.009558749 -0.008386666 -0.007188384 -0.002003397
##    2022-02-08 2022-02-09  2022-02-10   2022-02-11   2022-02-14  2022-02-15
## 1 0.010083181 0.03271836 -0.02443264 -0.034625976 -0.005216758 0.029652770
## 2 0.013840538 0.01894926 -0.00718273 -0.010527858 -0.011773170 0.021757166
## 3 0.005709042 0.01117061 -0.01882777 -0.007623564 -0.006201096 0.006680909
##      2022-02-16   2022-02-17    2022-02-18   2022-02-22  2022-02-23
## 1 -3.020396e-05 -0.034088214 -0.0118281772 -0.013556941 -0.02652011
## 2  6.085100e-03 -0.022761552 -0.0057984926 -0.013600962 -0.01678565
## 3  1.641867e-03 -0.009464292 -0.0009347165 -0.005991859 -0.01279683
##     2022-02-24 2022-02-25   2022-02-28   2022-03-01 2022-03-02   2022-03-03
## 1 0.0476672810 0.02039216 -0.004068926 -0.016314268 0.02020045 -0.017909970
## 2 0.0005164929 0.03104999 -0.004540811 -0.031675550 0.03371555 -0.008260924
## 3 0.0058396487 0.02660247 -0.006225478 -0.008510397 0.01675544  0.005958541
##     2022-03-04  2022-03-07   2022-03-08 2022-03-09   2022-03-10   2022-03-11
## 1 -0.017518597 -0.04614878 -0.001863731 0.04115994 -0.015594455 -0.024564504
## 2 -0.018426929 -0.04238503  0.008961690 0.02679838  0.003973752 -0.008853110
## 3  0.004520516 -0.01695390 -0.016065426 0.01441115 -0.002385861 -0.007566151
##     2022-03-14 2022-03-15  2022-03-16 2022-03-17  2022-03-18    2022-03-21
## 1 -0.020181363 0.03130611 0.046851350 0.01668526 0.027175468 -0.0128592396
## 2 -0.005669630 0.01072926 0.026311285 0.01401838 0.006466968  0.0025687172
## 3  0.002098947 0.01631482 0.009323464 0.01050207 0.003459590 -0.0004707418
##    2022-03-22  2022-03-23  2022-03-24   2022-03-25   2022-03-28 2022-03-29
## 1 0.017345201 -0.02494798 0.021970425 -0.007778534  0.013834498 0.02654520
## 2 0.008827289 -0.01051913 0.012375672  0.011755599 -0.007321700 0.01642368
## 3 0.002914024 -0.01070803 0.008780432  0.009164284  0.005332638 0.01081163
##      2022-03-30  2022-03-31   2022-04-01  2022-04-04   2022-04-05   2022-04-06
## 1 -0.0190001922 -0.01772076 0.0002501849  0.01575823 -0.026583002 -0.025761874
## 2 -0.0084932771 -0.01653862 0.0002588451  0.00127371 -0.015534782 -0.012351612
## 3 -0.0009636168 -0.01022811 0.0080133986 -0.00368309 -0.001917714  0.007081088
##     2022-04-07   2022-04-08   2022-04-11   2022-04-12  2022-04-13   2022-04-14
## 1  0.005384617 -0.012833362 -0.018784073 -0.008713839 0.018755329 -0.021816139
## 2 -0.001769296  0.008971139 -0.004301664  0.001464980 0.016741737 -0.001195185
## 3  0.005652393  0.002964860 -0.009565003 -0.002533832 0.005737145 -0.004508959
##     2022-04-18 2022-04-19   2022-04-20   2022-04-21  2022-04-22   2022-04-25
## 1 -0.003544027 0.03078807 -0.010003606 -0.030696524 -0.02859256  0.016700040
## 2  0.004691312 0.01848305  0.006536398 -0.018641818 -0.03001331 -0.002439334
## 3 -0.005919173 0.01435930  0.012263378 -0.006879249 -0.02501916  0.001243815
##    2022-04-26   2022-04-27 2022-04-28  2022-04-29   2022-05-02  2022-05-03
## 1 -0.04092007 -0.004157207 0.03861285 -0.03490620  0.020309354 0.003952975
## 2 -0.02515995  0.004126806 0.01859902 -0.02801829  0.006648720 0.015964748
## 3 -0.01649906  0.003178407 0.01119636 -0.03010227 -0.005735796 0.004538536
##   2022-05-04  2022-05-05   2022-05-06  2022-05-09   2022-05-10   2022-05-11
## 1 0.03784779 -0.05278957 -0.024107749 -0.04697261  0.010165261 -0.034329857
## 2 0.03026913 -0.03027192 -0.011062760 -0.04321379 -0.001000905 -0.012508957
## 3 0.02395424 -0.02347554 -0.002791824 -0.01765189 -0.005634856 -0.004430765
##     2022-05-12 2022-05-13    2022-05-16 2022-05-17  2022-05-18   2022-05-19
## 1  0.015418516 0.04637063 -0.0175666192 0.02977900 -0.04676230  0.011305134
## 2 -0.001478741 0.02943955 -0.0033204965 0.03158901 -0.03743073 -0.004877979
## 3  0.004001606 0.01377688  0.0003816911 0.01192437 -0.03532552 -0.003242703
##     2022-05-20  2022-05-23   2022-05-24  2022-05-25 2022-05-26 2022-05-27
## 1  0.008350530 0.005149973 -0.026703548 0.018184078 0.03309331 0.03839633
## 2 -0.007621214 0.021400307 -0.016115640 0.021482079 0.02942059 0.02409348
## 3  0.003205901 0.012454335  0.005621101 0.003574891 0.01262863 0.01752285
##     2022-05-31   2022-06-01 2022-06-02   2022-06-03  2022-06-06  2022-06-07
## 1 -0.013205244 -0.014135776 0.04319298 -0.022948375 0.002973430 0.011671309
## 2 -0.006571450 -0.010715182 0.01437912 -0.010153160 0.005609118 0.011880082
## 3 -0.009795638 -0.008410042 0.01254209 -0.008899129 0.002025192 0.008091681
##    2022-06-08  2022-06-09  2022-06-10  2022-06-13   2022-06-14  2022-06-15
## 1 -0.01255907 -0.02560801 -0.03849576 -0.05374259 -0.002514238 0.024282653
## 2 -0.01536084 -0.02802402 -0.03697234 -0.04975384 -0.001874206 0.009795381
## 3 -0.01431244 -0.01806813 -0.01666645 -0.03103364 -0.008931866 0.007368039
##    2022-06-16    2022-06-17 2022-06-21   2022-06-22  2022-06-23 2022-06-24
## 1 -0.04958566  0.0129509302 0.01763171  0.001601141  0.02534524 0.03576387
## 2 -0.04989090  0.0022798067 0.01632175 -0.012877246 -0.01276043 0.04178066
## 3 -0.02263247 -0.0002625779 0.01859781  0.004060476  0.01270659 0.02519513
##     2022-06-27   2022-06-28   2022-06-29   2022-06-30  2022-07-01   2022-07-05
## 1 -0.006692363 -0.031637625 -0.005959989 -0.010276814 0.004768181  0.021290115
## 2  0.002543990 -0.005064687 -0.019267909 -0.012281334 0.012389466 -0.008778438
## 3  0.001100398 -0.014242239  0.002313067 -0.002112428 0.014596031 -0.008496707
##     2022-07-06  2022-07-07    2022-07-08   2022-07-11   2022-07-12   2022-07-13
## 1  0.002673684 0.030367704 -0.0005682786 -0.020313564 -0.015430179 -0.003218166
## 2 -0.009613762 0.025417722 -0.0054659492 -0.013095894  0.003448808 -0.006345391
## 3  0.005610766 0.004462589 -0.0033751002 -0.002518336 -0.006385750 -0.004998741
##     2022-07-14 2022-07-15   2022-07-18 2022-07-19   2022-07-20    2022-07-21
## 1 -0.003383758 0.02507726 -0.005794438 0.03974786  0.023998169  0.0204666689
## 2 -0.016233088 0.02687678  0.007322504 0.03666526  0.010128342 -0.0008963466
## 3 -0.005175889 0.01305461 -0.010338198 0.02192098 -0.001947998  0.0079700866
##     2022-07-22   2022-07-25    2022-07-26  2022-07-27  2022-07-28 2022-07-29
## 1 -0.018864341 -0.005681705 -0.0191302305 0.042015254 0.025212672 0.01457554
## 2 -0.010061631  0.012459512 -0.0149468708 0.024232658 0.008407895 0.01321996
## 3  0.001215841  0.002248707  0.0004108795 0.009120593 0.016233115 0.00659164
##     2022-08-01    2022-08-02  2022-08-03   2022-08-04   2022-08-05
## 1  0.001616818 -0.0009961655 0.019840738  0.008232539 -0.002795180
## 2 -0.003354769 -0.0079008853 0.008337434 -0.010205404  0.004656850
## 3 -0.002640638 -0.0063830836 0.007300890 -0.000630847  0.001637627
##      2022-08-08    2022-08-09 2022-08-10    2022-08-11 2022-08-12   2022-08-15
## 1 -0.0007342579 -0.0246910067 0.03886438 -4.448963e-03 0.01975445  0.004816367
## 2  0.0059889505 -0.0019810536 0.02460862  1.792752e-02 0.01467473 -0.005596806
## 3  0.0028237149 -0.0004166029 0.01405198 -9.742357e-05 0.01544839  0.005101151
##     2022-08-16   2022-08-17   2022-08-18   2022-08-19  2022-08-22   2022-08-23
## 1 -0.005290748 -0.017441510 0.0049608818 -0.025864728 -0.02825795 -0.001158776
## 2  0.007310254 -0.010822241 0.0085096435 -0.015731091 -0.02335811  0.008371211
## 3  0.004042602 -0.005016377 0.0009411824 -0.005928811 -0.01643803 -0.006603086
##    2022-08-24  2022-08-25  2022-08-26   2022-08-29   2022-08-30   2022-08-31
## 1 0.007115298 0.023812687 -0.04614424 -0.012451140 -0.008715287 -0.006819304
## 2 0.009012548 0.019351976 -0.03028381 -0.003198688 -0.014680469 -0.009136958
## 3 0.002535743 0.009715673 -0.02688064 -0.003756135 -0.009864652 -0.005655730
##     2022-09-01    2022-09-02    2022-09-06 2022-09-07  2022-09-08 2022-09-09
## 1 -0.003621622 -0.0078357829 -0.0038494504 0.02609433 0.014408267 0.01985126
## 2 -0.007366148 -0.0004630091 -0.0063550941 0.01853618 0.011740015 0.01915294
## 3  0.007556164 -0.0108083904 -0.0004091741 0.02207301 0.004780784 0.00907103
##    2022-09-12  2022-09-13   2022-09-14   2022-09-15   2022-09-16  2022-09-19
## 1 0.008455755 -0.05295648  0.005856834 -0.014205314 -0.009452410 0.002556592
## 2 0.013166224 -0.04019977  0.002283313 -0.002429396 -0.018443415 0.013441911
## 3 0.006802983 -0.03256978 -0.002478399 -0.008922650 -0.005963876 0.006312175
##    2022-09-20  2022-09-21   2022-09-22  2022-09-23  2022-09-26   2022-09-27
## 1 -0.01832833 -0.01464667 -0.024424371 -0.01101842 -0.01142931  0.004191564
## 2 -0.01655806 -0.02306779 -0.020705249 -0.03183663 -0.01908429  0.003051272
## 3 -0.01475900 -0.01270627 -0.007356039 -0.01060327 -0.01255044 -0.007956710
##   2022-09-28  2022-09-29  2022-09-30 2022-10-03 2022-10-04   2022-10-05
## 1 0.02552187 -0.02374788 -0.01449504 0.03017998 0.04090147  0.001664772
## 2 0.03090859 -0.02036379 -0.01031474 0.03274266 0.04778036 -0.002124582
## 3 0.01956449 -0.01652679 -0.01046708 0.02624192 0.02350879 -0.006306656
##     2022-10-06  2022-10-07    2022-10-10   2022-10-11   2022-10-12 2022-10-13
## 1 -0.005247532 -0.04065747 -0.0188429038 -0.018195009 -0.002590347 0.01618199
## 2 -0.007150712 -0.01946990 -0.0092129705 -0.006782512  0.001080271 0.03004582
## 3 -0.015653120 -0.02043292 -0.0004884135  0.001657434 -0.010042473 0.02225633
##    2022-10-14 2022-10-17 2022-10-18  2022-10-19   2022-10-20 2022-10-21
## 1 -0.03118017 0.03317574 0.01313556 -0.01614585 -0.006138214 0.02734823
## 2 -0.02348822 0.02078447 0.01622684 -0.00954449 -0.008845147 0.02968032
## 3 -0.01933502 0.02131401 0.01394540 -0.01092605 -0.012740121 0.01838017
##    2022-10-24 2022-10-25   2022-10-26   2022-10-27 2022-10-28    2022-10-31
## 1 0.008535555 0.03211517 -0.004834728 -0.011021731 0.02423963 -0.0105796310
## 2 0.008577728 0.01958770  0.002382486  0.003083514 0.01825839 -0.0006342321
## 3 0.011707973 0.01624015  0.003392820  0.003314843 0.02156512 -0.0041353914
##      2022-11-01  2022-11-02   2022-11-03 2022-11-04  2022-11-07  2022-11-08
## 1 -0.0013399920 -0.03596642 -0.012463795 0.01972423 0.009847391 0.009521654
## 2  0.0067521894 -0.02512076 -0.001456601 0.02225921 0.009387005 0.007051290
## 3  0.0006947017 -0.01889698 -0.003984914 0.01034124 0.005419741 0.004704667
##    2022-11-09 2022-11-10   2022-11-11   2022-11-14  2022-11-15   2022-11-16
## 1 -0.01812271 0.09582631  0.027533021 -0.016044281 0.022629440 -0.025069247
## 2 -0.02752458 0.05677817  0.019948546 -0.013459513 0.008689696 -0.017672482
## 3 -0.01178171 0.04112298 -0.003247596 -0.007972426 0.006626499 -0.000671213
##     2022-11-17  2022-11-18   2022-11-21  2022-11-22  2022-11-23   2022-11-25
## 1 -0.012933875 0.001386852 -0.011412002 0.017229836 0.011020587 -0.003893280
## 2 -0.003229808 0.004822796 -0.002789367 0.018061672 0.001035525  0.003342181
## 3 -0.004005702 0.011601018  0.005025788 0.008491735 0.004073040  0.004607393
##    2022-11-28    2022-11-29 2022-11-30   2022-12-01    2022-12-02  2022-12-05
## 1 -0.01585293 -0.0047560410 0.04614897  0.005701186 -0.0063394221 -0.02424838
## 2 -0.02161776  0.0124275212 0.01794197 -0.002483974 -0.0007048821 -0.02388446
## 3 -0.01280545  0.0008907001 0.02184267  0.000745461  0.0014623128 -0.01403525
##     2022-12-06   2022-12-07  2022-12-08   2022-12-09 2022-12-12  2022-12-13
## 1 -0.019638413 -0.001963925 0.016254242 -0.010131033 0.01448370 0.019143395
## 2 -0.013685945 -0.005164067 0.001870691 -0.006437908 0.01808349 0.005926418
## 3 -0.007317507  0.001132015 0.005456336 -0.007379459 0.01240100 0.003416190
##     2022-12-14  2022-12-15  2022-12-16   2022-12-19    2022-12-20 2022-12-21
## 1 -0.008088308 -0.03403656 -0.01186999 -0.014641036 -0.0004528198 0.02109883
## 2 -0.008237945 -0.02219249 -0.01098118 -0.011230874  0.0054641645 0.01529530
## 3 -0.004672976 -0.01820081 -0.01126828 -0.005567519 -0.0005533209 0.01261467
##     2022-12-22   2022-12-23   2022-12-27  2022-12-28 2022-12-29    2022-12-30
## 1 -0.021749879 0.0004840595 -0.010238122 -0.01198999 0.03045024 -0.0037853639
## 2 -0.014079368 0.0122054749  0.002015757 -0.01829239 0.01804436 -0.0005605047
## 3 -0.005639421 0.0056833264  0.002681819 -0.01093171 0.01204682 -0.0061357671
##      2023-01-03  2023-01-04    2023-01-05 2023-01-06    2023-01-09  2023-01-10
## 1 -0.0033122181 0.016065762 -0.0168715941 0.02476394  0.0127318787 0.011268191
## 2 -0.0042205635 0.023681283 -0.0004323451 0.02627321  0.0006979894 0.009468422
## 3  0.0004604378 0.009518858 -0.0140120692 0.02210513 -0.0041010329 0.004259209
##   2023-01-11   2023-01-12  2023-01-13   2023-01-17   2023-01-18   2023-01-19
## 1 0.01868265  0.004175705 0.005495922  0.003623547 -0.007982897 -0.016887738
## 2 0.01018528  0.012568679 0.002934194 -0.002927633 -0.016718648 -0.008142107
## 3 0.01108645 -0.001758354 0.001268413 -0.003505772 -0.016899928 -0.008591981
##   2023-01-20  2023-01-23    2023-01-24    2023-01-25  2023-01-26    2023-01-27
## 1 0.02895549 0.028336163 -0.0078693645 -0.0015479134 0.017886883  0.0059907161
## 2 0.01922066 0.013955528 -0.0011174319  0.0066762067 0.011589719  0.0013055943
## 3 0.01171183 0.004790163  0.0008171965  0.0004072789 0.003218244 -0.0006681788
##     2023-01-30 2023-01-31  2023-02-01  2023-02-02   2023-02-03   2023-02-06
## 1 -0.020468999 0.01940757 0.029364619 0.028551345 -0.020141535 -0.012917025
## 2 -0.011556189 0.01679773 0.004523238 0.006391144 -0.005667984 -0.007799366
## 3 -0.005402939 0.01501286 0.006500804 0.004878741 -0.010226467 -0.003010759
##    2023-02-07   2023-02-08   2023-02-09   2023-02-10  2023-02-13   2023-02-14
## 1 0.020543523 -0.015803849 -0.007117164 -0.007867807 0.016748535  0.007294606
## 2 0.012215507 -0.007620604 -0.007504059  0.004587558 0.010532112  0.001228554
## 3 0.002909384 -0.007245911 -0.009289544  0.007798271 0.008409691 -0.006530105
##    2023-02-15   2023-02-16   2023-02-17  2023-02-21   2023-02-22  2023-02-23
## 1 0.011574613 -0.017966917 -0.011830243 -0.02725873 -0.001743227 0.009574859
## 2 0.001621917 -0.009839584 -0.008083733 -0.02300274  0.001092414 0.004988850
## 3 0.004435099 -0.007641767  0.005439246 -0.01659417 -0.002015351 0.001362901
##     2023-02-24    2023-02-27   2023-02-28   2023-03-01  2023-03-02 2023-03-03
## 1 -0.019437718  0.0047822072  0.002652171 -0.000692990 0.012334967 0.02041168
## 2 -0.004439335  0.0027109719 -0.002870608  0.004870727 0.004070779 0.01365749
## 3 -0.006458868 -0.0008655768 -0.005229281 -0.006609973 0.009236053 0.01074117
##     2023-03-06  2023-03-07    2023-03-08  2023-03-09  2023-03-10   2023-03-13
## 1 -0.006692077 -0.01230170  0.0083062845 -0.01880487 -0.02177587  0.004427187
## 2 -0.007276050 -0.01871580 -0.0003423329 -0.03087997 -0.02579244 -0.032571219
## 3 -0.001482406 -0.01482877  0.0016905216 -0.01333515 -0.01554365  0.001948553
##   2023-03-14   2023-03-15  2023-03-16  2023-03-17  2023-03-20  2023-03-21
## 1 0.02291265 -0.007977657 0.024186734 -0.01087037 0.005944633 0.017883757
## 2 0.01397076 -0.032621539 0.016177487 -0.02579657 0.017593539 0.028227640
## 3 0.01080145 -0.006516629 0.008728251 -0.01329672 0.013330379 0.003196362
##    2023-03-22   2023-03-23   2023-03-24   2023-03-27   2023-03-28 2023-03-29
## 1 -0.01913479  0.010799692 -0.001319928 -0.001978167 -0.006831847 0.02084215
## 2 -0.02862615 -0.008983658  0.002371168  0.014197911  0.006765655 0.01844107
## 3 -0.01791411 -0.004311510  0.014177309  0.005554781  0.002159457 0.01088781
##    2023-03-30 2023-03-31   2023-04-03   2023-04-04   2023-04-05    2023-04-06
## 1 0.006988557 0.01861228 -0.006246509 -0.008480648 -0.016003139 -0.0009174413
## 2 0.003478293 0.01558000  0.005324534 -0.017978513 -0.006273679 -0.0010883192
## 3 0.004593592 0.01297099  0.001412721 -0.006170894  0.004679361  0.0018058018
##    2023-04-10  2023-04-11   2023-04-12 2023-04-13    2023-04-14  2023-04-17
## 1 0.009380031 0.001200394 -0.008019655 0.01615838 -0.0049647851 0.003646428
## 2 0.012923612 0.011600653 -0.007975215 0.00662489 -0.0008836911 0.007344672
## 3 0.002014622 0.004778705 -0.001511648 0.00541647 -0.0062202543 0.007418261
##      2023-04-18    2023-04-19   2023-04-20    2023-04-21   2023-04-24
## 1  0.0011721498 -0.0028201117 -0.006589437  0.0007654083 -0.000537486
## 2  0.0033261253  0.0004291639 -0.009955315 -0.0052555694  0.002126766
## 3 -0.0007348872  0.0001985981 -0.001913289  0.0021722083  0.002579787
##     2023-04-25   2023-04-26 2023-04-27  2023-04-28    2023-05-01   2023-05-02
## 1 -0.030183831 -0.003705608 0.01392374 0.014390796  2.434073e-05 -0.012899217
## 2 -0.023232702 -0.009447223 0.01558447 0.016762264 -3.936397e-03 -0.022538115
## 3 -0.008193561 -0.011577167 0.01707370 0.007003909  2.532650e-03 -0.009891519
##     2023-05-03   2023-05-04 2023-05-05   2023-05-08   2023-05-09   2023-05-10
## 1  0.000589663 -0.008126241 0.01092520 -0.001938576 -0.008890632  0.005850127
## 2 -0.010277441 -0.019469367 0.02821461 -0.000447858 -0.001457321 -0.009035732
## 3 -0.004426680 -0.003310650 0.01249807 -0.002494036 -0.003514369  0.002496127
##     2023-05-11    2023-05-12    2023-05-15  2023-05-16  2023-05-17  2023-05-18
## 1 -0.002778028  0.0004881441  0.0107420949 -0.00940489 0.014342036 0.020658766
## 2 -0.008999524 -0.0011141718  0.0142616174 -0.01830321 0.025637601 0.011275533
## 3 -0.003306564  0.0011394632 -0.0006369853 -0.01312857 0.005332294 0.001308335
##      2023-05-19   2023-05-22   2023-05-23   2023-05-24    2023-05-25
## 1 -0.0039222453  0.007903216 -0.016439121 -0.010021458  0.0162985569
## 2 -0.0049193157  0.003701934 -0.006448851 -0.013032246 -0.0006656744
## 3 -0.0005063822 -0.001010022 -0.010864558 -0.009753816 -0.0053190675
##    2023-05-26   2023-05-30   2023-05-31  2023-06-01 2023-06-02   2023-06-05
## 1 0.023947907  0.002591990 -0.008348459 0.011538949 0.01216533 -0.005171322
## 2 0.006830282 -0.002191582 -0.016991977 0.011270513 0.03585246 -0.005304615
## 3 0.003459688 -0.003308713 -0.002241393 0.004537344 0.01757640 -0.001755833
##     2023-06-06   2023-06-07   2023-06-08   2023-06-09  2023-06-12  2023-06-13
## 1 0.0063409855 -0.008072349  0.005415582  0.002103020 0.020540748 0.009662555
## 2 0.0184818120  0.018479316 -0.003984876 -0.001767192 0.002932978 0.014690900
## 3 0.0003347404  0.006867035  0.002066581 -0.002244557 0.003728360 0.006619139
##      2023-06-14 2023-06-15   2023-06-16   2023-06-20   2023-06-21   2023-06-22
## 1  0.0037916452 0.01158155 -0.005846685 -0.005710728 -0.011740108  0.001828218
## 2 -0.0075483232 0.01122959 -0.002879459 -0.011902169  0.001385943 -0.010565528
## 3 -0.0005814375 0.01258694  0.001595919 -0.007992892  0.001654171 -0.002144582
##     2023-06-23    2023-06-26  2023-06-27   2023-06-28  2023-06-29  2023-06-30
## 1 -0.009188878 -0.0003486437 0.019226259  0.002075764 0.003454166 0.011551465
## 2 -0.007821308  0.0088638435 0.017115817  0.001809032 0.011198374 0.007606996
## 3 -0.008100988  0.0057903776 0.006012883 -0.005393849 0.007298842 0.009766602
##     2023-07-03   2023-07-05   2023-07-06    2023-07-07  2023-07-10  2023-07-11
## 1 4.912845e-05 -0.007475412 -0.012659113  0.0006251238 0.019423685 0.007505683
## 2 8.408155e-03 -0.007831834 -0.010390787  0.0131325955 0.008077242 0.016372019
## 3 1.038211e-03 -0.001574282 -0.005293409 -0.0037128407 0.004834410 0.008446861
##   2023-07-12  2023-07-13    2023-07-14   2023-07-17  2023-07-18  2023-07-19
## 1 0.01185020 0.012603604 -0.0030166285  0.012465080 0.003573855 0.000201153
## 2 0.00364857 0.005938366 -0.0158075055  0.003427411 0.015478826 0.003936010
## 3 0.00264093 0.002026833 -0.0005543571 -0.002380883 0.001585129 0.006381513
##      2023-07-20   2023-07-21   2023-07-24   2023-07-25   2023-07-26
## 1 -0.0214802449  0.004942034 -0.001579372  0.008479531 -0.002570265
## 2 -0.0001905509 -0.003732023  0.005481936 -0.002249364  0.005003863
## 3  0.0064660149  0.004071832  0.001784309  0.001096641  0.001010570
##     2023-07-27  2023-07-28    2023-07-31   2023-08-01   2023-08-02
## 1 -0.005709299 0.014433734  0.0021018646 -0.004201035 -0.025916083
## 2 -0.006059762 0.005236145  0.0086733183 -0.003391550 -0.010734982
## 3 -0.011003719 0.001530077 -0.0003607501 -0.003217755 -0.001868915
##      2023-08-03    2023-08-04  2023-08-07   2023-08-08    2023-08-09
## 1 -0.0059005181 -0.0055587357 0.006321708 -0.008107965 -0.0092291760
## 2  0.0008057748 -0.0006976781 0.010910384 -0.002289002 -0.0044215014
## 3 -0.0061105630 -0.0065682742 0.008212385 -0.005792684  0.0004018631
##     2023-08-10    2023-08-11   2023-08-14  2023-08-15   2023-08-16   2023-08-17
## 1  0.001751642 -0.0088257879  0.011885601 -0.01323142 -0.014000439 -0.012102670
## 2 -0.002958792 -0.0002615104 -0.004111680 -0.01777756 -0.008064340 -0.005796639
## 3 -0.001286379  0.0030577624 -0.001210709 -0.01050582 -0.003767926 -0.007459864
##     2023-08-18   2023-08-21    2023-08-22  2023-08-23   2023-08-24  2023-08-25
## 1 -0.002016746  0.011155575 -0.0010756483 0.014535741 -0.021731279 0.008180388
## 2  0.002379154 -0.003072588 -0.0086894096 0.008191762 -0.008720288 0.001715319
## 3  0.002246707 -0.001811267 -0.0007267465 0.006390560 -0.006132372 0.005809580
##    2023-08-28  2023-08-29  2023-08-30    2023-08-31    2023-09-01   2023-09-05
## 1 0.007770584 0.022583867 0.008309596  0.0026825267  0.0048512792 -0.006238542
## 2 0.010398679 0.012098628 0.002031221 -0.0007089859  0.0079419604 -0.011092381
## 3 0.005209891 0.007379158 0.001673620 -0.0070524648 -0.0002829199 -0.013463651
##     2023-09-06   2023-09-07    2023-09-08   2023-09-11   2023-09-12
## 1 -0.003954130 -0.012924200 -4.899715e-03  0.004177158 -0.011653368
## 2 -0.004603670 -0.007738137  5.283667e-03 -0.001324700  0.006476469
## 3 -0.001862524  0.001506604 -5.652984e-06  0.003322088 -0.003325027
##      2023-09-13  2023-09-14   2023-09-15    2023-09-18   2023-09-19
## 1  5.992929e-04 0.009493657 -0.016741679 -0.0027142157 -0.001307753
## 2 -1.149458e-02 0.015852424 -0.007307424 -0.0042231186 -0.003295703
## 3 -1.679121e-05 0.009446673 -0.006332622 -0.0001190698 -0.001074705
##      2023-09-20  2023-09-21    2023-09-22  2023-09-25  2023-09-26   2023-09-27
## 1 -1.095288e-02 -0.02344731 -0.0004462777 0.003983322 -0.01476185  0.004988091
## 2 -7.526665e-03 -0.01767022 -0.0066375162 0.004426378 -0.01400017  0.006121622
## 3  5.507227e-05 -0.01412754 -0.0032461300 0.001192734 -0.01368446 -0.003663058
##    2023-09-28   2023-09-29   2023-10-02   2023-10-03   2023-10-04   2023-10-05
## 1 0.014436568  0.002090473 -0.001323779 -0.020525528 0.0118381577 -0.004718061
## 2 0.010601865 -0.004847454 -0.014554026 -0.017283551 0.0004826025 -0.000762190
## 3 0.002955574 -0.003194106 -0.011660326 -0.005843511 0.0074445649 -0.004197701
##    2023-10-06  2023-10-09  2023-10-10   2023-10-11  2023-10-12   2023-10-13
## 1 0.015702684 0.004459932 0.010138012 0.0032909674 -0.01548109 -0.012428654
## 2 0.009614340 0.008844794 0.010352223 0.0035254838 -0.01215560 -0.004694254
## 3 0.005870299 0.008056189 0.005643365 0.0009607604 -0.01260921  0.003158170
##   2023-10-16  2023-10-17  2023-10-18  2023-10-19   2023-10-20   2023-10-23
## 1 0.01464114 0.002018133 -0.02025852 -0.01371344 -0.015762538 -0.001997619
## 2 0.01507809 0.010477661 -0.01953871 -0.01317523 -0.017487766 -0.006686204
## 3 0.01058087 0.002509160 -0.01262682 -0.01044586 -0.007657377 -0.007020272
##    2023-10-24   2023-10-25    2023-10-26   2023-10-27    2023-10-30  2023-10-31
## 1 0.007225766 -0.031363698 -0.0127125323 -0.002727073 -0.0008735096 0.011553806
## 2 0.004900652 -0.010047893  0.0034784653 -0.013522432  0.0115230052 0.007526572
## 3 0.007525474 -0.005669083 -0.0003984777 -0.012827403  0.0084326652 0.009090570
##    2023-11-01 2023-11-02 2023-11-03   2023-11-06   2023-11-07    2023-11-08
## 1 0.002039543  0.0253417 0.02245167 -0.006657082  0.010173334 -0.0001564631
## 2 0.002007535  0.0277329 0.02107185 -0.010353945 -0.007897320 -0.0043955593
## 3 0.004882472  0.0177556 0.01192622 -0.001856714 -0.002265058 -0.0003975806
##     2023-11-09  2023-11-10   2023-11-13 2023-11-14  2023-11-15   2023-11-16
## 1 -0.010882084 0.019351259 -0.003668909 0.04080932 0.008150419 -0.002521899
## 2 -0.007557805 0.012025994 -0.001578094 0.03349648 0.006256662 -0.009674181
## 3 -0.008447895 0.009029854 -0.001110570 0.02265443 0.002431814  0.000117457
##     2023-11-17  2023-11-20   2023-11-21  2023-11-22  2023-11-24   2023-11-27
## 1 0.0049247606 0.013440434 -0.004240476 0.004569282 0.002466059 -0.001858958
## 2 0.0114175837 0.002593631 -0.005973596 0.003942676 0.003708330 -0.002733902
## 3 0.0008089929 0.002172526  0.001679505 0.005117549 0.003374105 -0.002870587
##      2023-11-28    2023-11-29  2023-11-30 2023-12-01   2023-12-04   2023-12-05
## 1  0.0004330897  0.0087423637 0.000156688 0.01621828 -0.003093445 -0.006503604
## 2 -0.0009848400  0.0076865326 0.009248982 0.02087163  0.000665831 -0.013381734
## 3 -0.0008508440 -0.0008657583 0.010310744 0.01135704  0.001647188 -0.006995009
##     2023-12-06  2023-12-07    2023-12-08  2023-12-11   2023-12-12 2023-12-13
## 1 -0.001488246 0.010545579  0.0051765221 0.014660695  0.004232535 0.02307858
## 2 -0.001056440 0.006733360  0.0089164719 0.005892264 -0.001843212 0.02320345
## 3  0.002680531 0.002138711 -0.0007105258 0.008491073  0.002845713 0.01904082
##     2023-12-14    2023-12-15   2023-12-18  2023-12-19  2023-12-20  2023-12-21
## 1 2.144817e-02 -0.0003280026  0.003542312 0.011400472 -0.01978992 0.018836239
## 2 3.051789e-02 -0.0064829262 -0.001231125 0.011961988 -0.01801861 0.013147483
## 3 3.789685e-05 -0.0087521878  0.002218951 0.004926242 -0.01485967 0.008632126
##    2023-12-22  2023-12-26   2023-12-27    2023-12-28    2023-12-29   2024-01-02
## 1 0.002240462 0.007835341 1.810584e-03 -0.0002062346 -0.0072430069 -0.017946215
## 2 0.001727005 0.006865338 2.486012e-05 -0.0004569687 -0.0057059258  0.002463345
## 3 0.004626409 0.004527642 1.897092e-03  0.0031344562 -0.0008137009  0.005086015
##     2024-01-03    2024-01-04   2024-01-05  2024-01-08    2024-01-09
## 1 -0.024367595 -3.184865e-03 0.0003844926 0.024603501 -0.0001187227
## 2 -0.013912101 -2.291597e-03 0.0080507362 0.006404240 -0.0108916010
## 3 -0.009634829 -6.250778e-05 0.0002350730 0.008652117 -0.0022359388
##      2024-01-10   2024-01-11   2024-01-12   2024-01-16   2024-01-17  2024-01-18
## 1  0.0060109035  0.001203645 -0.005450991 -0.006401715 -0.009297514 0.014546356
## 2 -0.0007996737 -0.003583487 -0.005531071 -0.009458895 -0.010435115 0.004370465
## 3  0.0013589579 -0.003933864  0.002504424 -0.004957933 -0.005850914 0.002271094
##    2024-01-19  2024-01-22  2024-01-23    2024-01-24  2024-01-25   2024-01-26
## 1 0.019318546 0.010581834 0.001259187 -0.0024082251 0.003707112 -0.005112704
## 2 0.009904918 0.005836052 0.000436792  0.0006137636 0.014190112  0.001811615
## 3 0.003730147 0.002178635 0.001185645 -0.0101627892 0.009452755  0.001471540
##    2024-01-29   2024-01-30   2024-01-31  2024-02-01    2024-02-02   2024-02-05
## 1 0.013846446 -0.005568776 -0.021230680 0.014072990  0.0077336294  0.001319032
## 2 0.004796579  0.003197772 -0.015454707 0.004636203  0.0003600173 -0.010385828
## 3 0.004385974  0.001627085 -0.007927664 0.015966046 -0.0047137733 -0.011308765
##    2024-02-06  2024-02-07   2024-02-08   2024-02-09  2024-02-12  2024-02-13
## 1 0.003394389 0.010840541  0.005908021  0.008040219 0.003231117 -0.02516166
## 2 0.006779364 0.002149686  0.006325794 -0.001671722 0.011624866 -0.01942721
## 3 0.006442661 0.002392853 -0.001175764  0.001578145 0.004365049 -0.01167790
##    2024-02-14 2024-02-15   2024-02-16    2024-02-20   2024-02-21  2024-02-22
## 1 0.021791095 0.01000787 -0.011615299 -0.0093150439 -0.005191280 0.023769490
## 2 0.008586972 0.01687569 -0.004514437 -0.0045566076  0.004838781 0.008979359
## 3 0.005740204 0.01032170 -0.002203626  0.0006430047  0.005010630 0.006418150
##      2024-02-23   2024-02-26  2024-02-27    2024-02-28  2024-02-29  2024-03-01
## 1 -0.0020811711  0.001192260 0.003031765 -0.0006688314 0.010212038 0.016706809
## 2  0.0003431328 -0.004087258 0.007604451 -0.0004659141 0.008244211 0.004165526
## 3  0.0047954433 -0.007050213 0.002938148  0.0009728233 0.002411239 0.002129812
##     2024-03-04    2024-03-05  2024-03-06  2024-03-07    2024-03-08   2024-03-11
## 1 -0.000394317 -0.0181520304 0.009054275 0.017672646 -8.428912e-03 -0.001372283
## 2  0.001591380 -0.0001777518 0.003322964 0.006229947  8.757249e-05  0.003462494
## 3  0.004458231 -0.0033302389 0.006715970 0.005201070  1.161246e-03  0.002965496
##      2024-03-12    2024-03-13   2024-03-14    2024-03-15  2024-03-18
## 1  0.0092070355 -0.0082087472 -0.011869412 -0.0078415965 0.005065224
## 2 -0.0003170235  0.0070524334 -0.009894547 -0.0005745528 0.003331370
## 3  0.0016533313 -0.0003132965 -0.007487843 -0.0001319486 0.001976554
##    2024-03-19  2024-03-20  2024-03-21   2024-03-22    2024-03-25   2024-03-26
## 1 0.002478268 0.012058510 0.013821668 -0.007040999 -0.0050210311 -0.002332792
## 2 0.007832954 0.015127863 0.009182601 -0.008391332  0.0007833336 -0.001334251
## 3 0.005640442 0.003359196 0.003500885 -0.004614669 -0.0029815942 -0.001136032
##   2024-03-27  2024-03-28   2024-04-01   2024-04-02   2024-04-03   2024-04-04
## 1 0.01162577 0.002448220 -0.003881846 -0.014495483  0.002467156 -0.014157567
## 2 0.01846468 0.006386187 -0.004514785 -0.008363219  0.004931293 -0.012644410
## 3 0.01628092 0.003908988 -0.007869796 -0.007616860 -0.001939031 -0.007788265
##    2024-04-05  2024-04-08  2024-04-09  2024-04-10   2024-04-11  2024-04-12
## 1 0.009470656 0.005210465 0.012929085 -0.02092552  0.009273066 -0.02310760
## 2 0.006617642 0.002871087 0.000226046 -0.01780631 -0.003623223 -0.01658472
## 3 0.005190522 0.001695794 0.003643365 -0.01424113 -0.003317678 -0.01199484
##     2024-04-15   2024-04-16
## 1 -0.017510746 -0.001758565
## 2 -0.007926722 -0.007600549
## 3 -0.006352413 -0.005079124
## 
## Clustering vector:
##   [1] 1 2 1 3 1 3 2 3 1 1 3 3 1 3 3 2 2 2 3 3 3 2 1 3 3 1 3 1 3 3 2 3 1 1 1 3 3
##  [38] 2 3 3 2 3 3 3 1 3 3 1 2 3 2 2 3 3 2 1 3 2 3 3 3 1 2 2 2 2 3 3 3 3 3 3 2 1
##  [75] 2 2 3 3 3 2 3 3 2 3 2 1 3 2 3 2 2 3 3 3 3 2 3 3 2 3 3 1 3 3 3 3 2 3 2 3 3
## [112] 2 3 1 3 1 1 3 1 3 3 1 2 3 3 3 2 2 3 2 1 2 2 1 2 3 3 1 3 2 3 3 3 3 2 3 2 3
## [149] 3 3 2 1 3 1 3 3 1 3 3 1 3 2 2 1 2 1 3 3 2 3 3 3 3 1 3 3 3 3 2 3 2 2 3 2 3
## [186] 3 3 1 3 1 3 2 3 2 2 2 1 1 3 3 2 3 3 3 3 3 2 3 2 1 1 1 3 2 3 2 3 2 3 2 3 3
## [223] 2 2 3 2 3 3 2 2 3 3 2 3 3 3 2 3 3 1 3 3 1 3 1 1 3 2 2 1 2 3 1 3 3 2 3 3 2
## [260] 3 3 3 3 2 3 3 2 1 3 2 1 3 2 2 3 3 3 2 3 1 3 3 3 2 3 3 3 3 1 1 2 2 2 2 2 3
## [297] 3 2 3 3 1 3 1 3 3 2 1 2 2 3 1 2 3 3 3 3 3 2 2 1 3 1 2 2 1 1 3 2 1 1 1 2 3
## [334] 3 3 3 1 3 1 3 1 3 3 2 2 2 1 3 2 2 1 3 1 2 2 1 3 3 3 2 1 2 1 3 3 3 3 3 3 2
## [371] 3 3 2 1 3 3 3 2 3 3 1 1 3 3 2 3 2 1 2 2 1 1 1 2 2 3 2 2 2 2 3 3 3 3 2 3 2
## [408] 1 3 3 2 3 3 2 1 2 1 3 3 2 3 3 3 2 2 1 3 2 1 2 3 2 3 3 2 3 1 2 1 2 3 3 2 3
## [445] 3 2 2 1 1 3 3 1 3 3 1 1 2 1 2 1 3 2 2 3 3 3 2 2 3 3 2 3 3 3 3 3 2 3 3 2 3
## [482] 3 2 2 3 2 2 3 2 3 3 2 1 3 2 2 3 2 3 3 3 1 3
## 
## Within cluster sum of squares by cluster:
## [1] 38.37103 52.93977 48.45198
##  (between_SS / total_SS =  14.9 %)
## 
## Available components:
## 
## [1] "cluster"      "centers"      "totss"        "withinss"     "tot.withinss"
## [6] "betweenss"    "size"         "iter"         "ifault"
summary(final_cluster)
##              Length Class  Mode   
## cluster       503   -none- numeric
## centers      3048   -none- numeric
## totss           1   -none- numeric
## withinss        3   -none- numeric
## tot.withinss    1   -none- numeric
## betweenss       1   -none- numeric
## size            3   -none- numeric
## iter            1   -none- numeric
## ifault          1   -none- numeric
tidy(final_cluster)
## # A tibble: 3 × 1,019
##   `2020-04-02` `2020-04-03` `2020-04-06` `2020-04-07` `2020-04-08` `2020-04-09`
##          <dbl>        <dbl>        <dbl>        <dbl>        <dbl>        <dbl>
## 1      0.0127       -0.0161       0.0931    -0.00113        0.0381      0.00835
## 2      0.00622      -0.0192       0.101      0.0310         0.0611      0.0367 
## 3      0.0179       -0.0137       0.0640     0.000575       0.0382      0.0232 
## # ℹ 1,013 more variables: `2020-04-13` <dbl>, `2020-04-14` <dbl>,
## #   `2020-04-15` <dbl>, `2020-04-16` <dbl>, `2020-04-17` <dbl>,
## #   `2020-04-20` <dbl>, `2020-04-21` <dbl>, `2020-04-22` <dbl>,
## #   `2020-04-23` <dbl>, `2020-04-24` <dbl>, `2020-04-27` <dbl>,
## #   `2020-04-28` <dbl>, `2020-04-29` <dbl>, `2020-04-30` <dbl>,
## #   `2020-05-01` <dbl>, `2020-05-04` <dbl>, `2020-05-05` <dbl>,
## #   `2020-05-06` <dbl>, `2020-05-07` <dbl>, `2020-05-08` <dbl>, …
glance(final_cluster)
## # A tibble: 1 × 4
##   totss tot.withinss betweenss  iter
##   <dbl>        <dbl>     <dbl> <int>
## 1  164.         140.      24.6     3
augment(final_cluster, stock_date_matrix_tbl) %>%
  
  ggplot(aes(2020-04-02, 2020-04-03 , color = .cluster)) +
  geom_point()

Select optimal number of clusters

kclusts <- tibble(k = 1:9) %>%
  mutate(kclust = map(.x = k, .f = ~ kmeans(stock_date_matrix_tbl %>%
select(-symbol), centers = .x, nstart = 20)),
glanced = map(.x = kclust, .f = glance)) 

kclusts %>% 
  unnest(glanced) %>%
  ggplot(aes(k, tot.withinss)) +
  geom_point() +
  geom_line()

final_cluster <- kmeans(stock_date_matrix_tbl %>%
select(-symbol), centers = 5, nstart = 20) 

augment(final_cluster, stock_date_matrix_tbl) %>%
  
  ggplot(aes(2020-04-02, 2020-04-03, color = .cluster)) +
  geom_point()

Reduce dimensions using UMAP

umap_results <- stock_date_matrix_tbl %>%
  select(-symbol) %>%
  umap() 

umap_results_tbl <- umap_results$layout %>%
  as.tibble() %>%
  bind_cols(stock_date_matrix_tbl %>% select(symbol))
## Warning: `as.tibble()` was deprecated in tibble 2.0.0.
## ℹ Please use `as_tibble()` instead.
## ℹ The signature and semantics have changed, see `?as_tibble`.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## Warning: The `x` argument of `as_tibble.matrix()` must have unique column names if
## `.name_repair` is omitted as of tibble 2.0.0.
## ℹ Using compatibility `.name_repair`.
## ℹ The deprecated feature was likely used in the tibble package.
##   Please report the issue at <https://github.com/tidyverse/tibble/issues>.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
umap_results_tbl
## # A tibble: 503 × 3
##        V1     V2 symbol
##     <dbl>  <dbl> <chr> 
##  1 -2.62   2.40  A     
##  2  2.63  -0.592 AAL   
##  3 -1.05   3.15  AAPL  
##  4 -2.98   0.164 ABBV  
##  5  1.22   1.69  ABNB  
##  6 -2.60   1.62  ABT   
##  7  1.10  -1.28  ACGL  
##  8 -0.724  2.36  ACN   
##  9 -0.822  3.59  ADBE  
## 10  0.322  3.40  ADI   
## # ℹ 493 more rows
umap_results_tbl %>%
  ggplot(aes(V1, V2)) +
  geom_point()

Visualize clusters by adding k-means results

kmeans_umap_tbl <- final_cluster %>%
  augment(stock_date_matrix_tbl) %>%
  select(symbol, .cluster) %>%
  
  # add umap results 
  left_join(umap_results_tbl)
## Joining with `by = join_by(symbol)`
kmeans_umap_tbl
## # A tibble: 503 × 4
##    symbol .cluster     V1     V2
##    <chr>  <fct>     <dbl>  <dbl>
##  1 A      2        -2.62   2.40 
##  2 AAL    4         2.63  -0.592
##  3 AAPL   2        -1.05   3.15 
##  4 ABBV   5        -2.98   0.164
##  5 ABNB   2         1.22   1.69 
##  6 ABT    5        -2.60   1.62 
##  7 ACGL   1         1.10  -1.28 
##  8 ACN    1        -0.724  2.36 
##  9 ADBE   2        -0.822  3.59 
## 10 ADI    2         0.322  3.40 
## # ℹ 493 more rows
graph <- kmeans_umap_tbl %>%
  
  #Create Graph Label 
  mutate(text_label = str_glue("Ticker Symbol: {symbol},
                                Cluster: {.cluster}")) %>%
  
  #Plot 
  ggplot(aes(V1, V2, color = .cluster, text = text_label)) + 
  geom_point()

graph %>% ggplotly(tooltip = "text")