Synthetic Data Generation Experiments

In this notebook I experiment with synthetic data generation using block bootstrap methods available from the arch package. The basic idea is to compare the aspects of the real series with the bootstrapped versions.

In [1]:
%load_ext autoreload
%autoreload 2

%load_ext watermark

from pathlib import Path
import time 
from pprint import pprint, pformat

import pandas as pd
import numpy as np
import scipy.stats as stats
import statsmodels.api as sm
import numba as nb
from arch.bootstrap import CircularBlockBootstrap

# import visual tools
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
%matplotlib inline
import seaborn as sns

sns_params = {
    'font.size':9.5,
    'font.weight':'medium',
    'figure.figsize':(10,7),
}

plt.style.use('seaborn-talk')
plt.style.use('bmh')
#plt.style.use('dark_background')
sns.set_context(sns_params)
savefig_kwds=dict(dpi=300, bbox_inches='tight', frameon=True, format='png')
nanex_colors = ("#f92b20", "#fe701b", "#facd1f", "#d6fd1c", "#65fe1b",
                "#1bfe42", "#1cfdb4", "#1fb9fa", "#1e71fb", "#261cfd")
nanex_cmap = mpl.colors.ListedColormap(nanex_colors,name='nanex_cmap')
plt.register_cmap('nanex_cmap', cmap=nanex_cmap)
# import util libs
from tqdm import tqdm, tqdm_notebook
import warnings
warnings.filterwarnings("ignore")

from src.tools.pystore_tools import *
from src.tools.utils import *
from src.CONSTANTS import PROJECT_REPO_NAME

pdir = get_relative_project_dir(
    project_repo_name=PROJECT_REPO_NAME, partial=False)
data_dir = Path(pdir/'data')

%watermark -v -m -g
print()
%watermark --iversions
CPython 3.7.2
IPython 6.5.0

compiler   : GCC 7.3.0
system     : Linux
release    : 4.19.11-041911-generic
machine    : x86_64
processor  : x86_64
CPU cores  : 12
interpreter: 64bit
Git hash   : 35d8ca2d13e1b93c7e794bba4ad5deadba2f69fb

pandas      0.23.4
numpy       1.15.4
numba       0.41.0
matplotlib  3.0.2
seaborn     0.9.0
pystore     0.1.5
dask        1.0.0
logzero     1.5.0

Convenience Functions

Below I have aggregated some convenience functions to plot the various statistics such as mean, std, min, max, and autocorrelation structures between the real series and the synthetic. The plots also feature comparisons of the indexed price series among the various realizations.

In [2]:
def plot_autocorr(s, lags=50, figsize=(10,7), title=None): 
    fig = plt.figure(figsize=figsize)
    layout = 2, 2
    acf_ax = plt.subplot2grid(layout, (0, 0))
    abs_acf_ax = plt.subplot2grid(layout, (0, 1))
    pacf_ax = plt.subplot2grid(layout, (1, 0))
    squared_ax = plt.subplot2grid(layout, (1, 1))
    
    sm.graphics.tsa.plot_acf(s, fft=True, zero=False, lags=lags, ax=acf_ax,
                             title='Autocorrelation of Returns');
    
    sm.graphics.tsa.plot_acf(s.abs(), fft=True, zero=False,
                             lags=lags, ax=abs_acf_ax,
                             title='Autocorrelation of Absolute Returns');
    
    sm.graphics.tsa.plot_pacf(s, zero=False, lags=lags, ax=pacf_ax,
                              title='Partial Autocorrelation of Returns');
    
    sm.graphics.tsa.plot_acf(s**2, fft=True, zero=False,
                             lags=lags, ax=squared_ax,
                             title='Autocorrelation of Squared Returns');
    
    if title: fig.suptitle(title, fontweight='demi', fontsize=16)
    fig.tight_layout()
    fig.subplots_adjust(top=0.88)
    return

def plot_mean_dist(returns, sim_returns, ax):
    
    mean_return = returns.mean()
    
    ax.set_title(f'{returns.name} mean return: {mean_return:.4f}')
    sim_means = sim_returns.mean().squeeze()

    g = sns.distplot(sim_means, kde=False, ax=ax)
    g.axvline(mean_return, color='r')    
    return
    
def plot_std_dist(returns, sim_returns, ax):
    
    std = returns.std()
    
    ax.set_title(f'{returns.name} return std: {std:.4f}')
    sim_stds = sim_returns.std().squeeze()

    g = sns.distplot(sim_stds, kde=False, ax=ax)
    g.axvline(std, color='r')    
    return

def plot_min_dist(returns, sim_returns, ax):
    
    min_ = returns.min()
    
    ax.set_title(f'{returns.name} return min: {min_:.4f}')
    sim_mins = sim_returns.min().squeeze()

    g = sns.distplot(sim_mins, kde=False, ax=ax)
    g.axvline(min_, color='r')    
    return

def plot_max_dist(returns, sim_returns, ax):
    
    max_ = returns.max()
    
    ax.set_title(f'{returns.name} return max: {max_:.4f}')
    sim_maxs = sim_returns.max().squeeze()

    g = sns.distplot(sim_maxs, kde=False, ax=ax)
    g.axvline(max_, color='r')    
    return

def plot_autocorr_dist(returns, sim_returns, ax):
    
    autocorr = returns.autocorr()

    ax.set_title(f'{returns.name} return autocorr: {autocorr:.4f}')
    sim_autocorrs = sim_returns.apply(pd.Series.autocorr).squeeze()

    g = sns.distplot(sim_autocorrs, kde=False, ax=ax)
    g.axvline(autocorr, color='r') 
    return

def plot_stat_dist(returns, sim_returns, figsize=(10,7)):
    fig = plt.figure(figsize=figsize, constrained_layout=True)
    gs = fig.add_gridspec(3, 2)
    plot_mean_dist(returns, sim_returns, fig.add_subplot(gs[0,0]))
    plot_std_dist(returns, sim_returns, fig.add_subplot(gs[0,1]))
    plot_min_dist(returns, sim_returns, fig.add_subplot(gs[1,0])) 
    plot_max_dist(returns, sim_returns, fig.add_subplot(gs[1,1])) 
    plot_autocorr_dist(returns, sim_returns, fig.add_subplot(gs[2,:]))
    
    fig.suptitle(f'{returns.name} simulated stat distributions',
                 fontweight='demi', fontsize=16)
    fig.tight_layout()
    fig.subplots_adjust(top=0.88)
    return
In [3]:
def to_returns(s): return np.log(s/s.shift(1)).dropna()

def to_price_index(df, start=100):
    return (start * (np.exp(df.cumsum())))

def cdescribe(x, n_cols=None):
    if not n_cols:
        d = x.describe()
        d.loc['skew'] = x.skew()
        d.loc['kurtosis'] = x.kurtosis()
        return d
    else:
        x_ = x.sample(n_cols, axis=1)
        d = x_.describe()
        d.loc['skew'] = x_.skew()
        d.loc['kurtosis'] = x_.kurtosis()        
        return d
    
def CBB(s, blocksize, N_paths):
    sim_returns = []

    bs = CircularBlockBootstrap(blocksize, s)
    for i, data in enumerate(tqdm(bs.bootstrap(N_paths))):
        tmp = data[0][0].reset_index(drop=True)
        sim_returns.append(tmp)
    simulations = pd.concat(sim_returns, axis=1, ignore_index=True)
    return simulations      

def compare_stats(x, y, n_cols=None):
    pd.options.display.float_format = '{:,.4f}'.format
    data = (pd.concat([cdescribe(x), cdescribe(y, n_cols=n_cols)], axis=1))
    return data
In [4]:
def view_all(real, sims, n_cols=20, cmap=None):
    plt.set_cmap(cmap)
    display(compare_stats(real, sims, n_cols=20))
    plot_stat_dist(real, sims)
    plot_autocorr(real, title=f'{real.name} Real Returns')
    rand_col = np.random.randint(len(sims.columns), size=1)[0]
    plot_autocorr(sims[rand_col], 
                  title=f'Simulated Return Path {rand_col}')
    return
    
def plot_realizations(real, sims, start, 
                      n_plot_paths=50, figsize=(10,7), cmap=None):   
    plt.set_cmap(cmap)
    sim_prices = to_price_index(sims, start=100)

    fig, ax = plt.subplots(figsize=figsize)
    (sim_prices.sample(n_plot_paths, axis=1)
     .plot(legend=False, alpha=0.7, lw=1., ax=ax))
    (to_price_index(real.reset_index(drop=True))
     .plot(legend=True, ax=ax, lw=5, ls='--', color='k'))
    plt.title(f'{real.name} {n_plot_paths} simulated price paths')

Get some data.

Below is intraday data from the iex trading exchange sampled at a 30 sec resolution, resampled to 1 mean using the mean price over the period. The data covers approximately 3 months ending in December 2018.

In [5]:
infp = Path(data_dir/'processed'/'etf_symbols_01.parq')
all_df = pd.read_parquet(infp).swaplevel().sort_index()
cprint(all_df)
-------------------------------------------------------------------------------
dataframe information
-------------------------------------------------------------------------------
                            lastSalePrice  lastSaleSize         volume  \
dates               symbol                                               
2018-12-31 13:59:00 XME         26.100000    603.333333   18626.000000   
                    XOP         26.425000     74.000000  394477.333333   
                    XPH         36.490000    200.000000    1328.000000   
                    XRT         40.868333    175.333333  134839.333333   
                    XSD         64.600000    100.000000     200.000000   

                               spread  mid_price  dollar_volume  
dates               symbol                                       
2018-12-31 13:59:00 XME      0.060000  26.130000      486141.60  
                    XOP    -17.610000  17.611667    10424067.99  
                    XPH      0.000000   0.000000       48458.72  
                    XRT    -13.613333   6.806667     5510663.71  
                    XSD      0.000000   0.000000       12920.00  
--------------------------------------------------
<class 'pandas.core.frame.DataFrame'>
MultiIndex: 4078721 entries, (2018-10-01 07:30:00, EEM) to (2018-12-31 13:59:00, XSD)
Data columns (total 6 columns):
lastSalePrice    float64
lastSaleSize     float64
volume           float64
spread           float64
mid_price        float64
dollar_volume    float64
dtypes: float64(6)
memory usage: 202.4+ MB
None
-------------------------------------------------------------------------------

In [6]:
prices = all_df['lastSalePrice'].unstack()
cprint(prices)
-------------------------------------------------------------------------------
dataframe information
-------------------------------------------------------------------------------
symbol                    AAXJ       ACWI    ACWV   ACWX         AGG     BIL  \
dates                                                                          
2018-12-31 13:55:00  63.971667  63.971667  81.090  41.86  106.455000  91.455   
2018-12-31 13:56:00  63.990000  63.990000  81.035  41.86  106.455000  91.455   
2018-12-31 13:57:00  63.905000  63.905000  81.035  41.86  106.465000  91.455   
2018-12-31 13:58:00  63.900000  63.900000  81.030  41.86  106.481667  91.455   
2018-12-31 13:59:00  63.936667  63.936667  81.030  41.86  106.498333  91.455   

symbol                  BIV    BKF        BLV        BND  ...         XLK  \
dates                                                     ...               
2018-12-31 13:55:00  81.265  37.45  87.420000  79.180000  ...   61.696667   
2018-12-31 13:56:00  81.265  37.45  87.420000  79.180000  ...   61.706667   
2018-12-31 13:57:00  81.265  37.45  87.420000  79.180000  ...   61.536667   
2018-12-31 13:58:00  81.265  37.45  87.446667  79.180000  ...   61.586667   
2018-12-31 13:59:00  81.265  37.45  87.460000  79.193333  ...   61.643333   

symbol                     XLP        XLU        XLV        XLY        XME  \
dates                                                                        
2018-12-31 13:55:00  50.583333  52.821667  86.020000  98.538333  26.080000   
2018-12-31 13:56:00  50.623333  52.841667  86.046667  98.610000  26.113333   
2018-12-31 13:57:00  50.505000  52.761667  85.843333  98.416667  26.080000   
2018-12-31 13:58:00  50.531667  52.768333  85.860000  98.396667  26.086667   
2018-12-31 13:59:00  50.578333  52.785000  85.943333  98.483333  26.100000   

symbol                     XOP    XPH        XRT   XSD  
dates                                                   
2018-12-31 13:55:00  26.393333  36.47  40.833333  64.6  
2018-12-31 13:56:00  26.423333  36.47  40.888333  64.6  
2018-12-31 13:57:00  26.373333  36.47  40.838333  64.6  
2018-12-31 13:58:00  26.390000  36.49  40.856667  64.6  
2018-12-31 13:59:00  26.425000  36.49  40.868333  64.6  

[5 rows x 236 columns]
--------------------------------------------------
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 20567 entries, 2018-10-01 07:30:00 to 2018-12-31 13:59:00
Columns: 236 entries, AAXJ to XSD
dtypes: float64(236)
memory usage: 37.2 MB
None
-------------------------------------------------------------------------------

Extracting SPY sector ETFs

In [7]:
sector = [x for x in prices.columns if x.startswith('XL')]
sectors = prices[sector].dropna()
cprint(sectors)
-------------------------------------------------------------------------------
dataframe information
-------------------------------------------------------------------------------
symbol                     XLB        XLE        XLF        XLI        XLK  \
dates                                                                        
2018-12-31 13:55:00  50.290000  57.011667  23.693333  64.116667  61.696667   
2018-12-31 13:56:00  50.278333  57.060000  23.713333  64.128333  61.706667   
2018-12-31 13:57:00  50.195000  56.940000  23.666667  63.996667  61.536667   
2018-12-31 13:58:00  50.190000  56.990000  23.668333  64.003333  61.586667   
2018-12-31 13:59:00  50.250000  57.091667  23.700000  64.076667  61.643333   

symbol                     XLP        XLU        XLV        XLY  
dates                                                            
2018-12-31 13:55:00  50.583333  52.821667  86.020000  98.538333  
2018-12-31 13:56:00  50.623333  52.841667  86.046667  98.610000  
2018-12-31 13:57:00  50.505000  52.761667  85.843333  98.416667  
2018-12-31 13:58:00  50.531667  52.768333  85.860000  98.396667  
2018-12-31 13:59:00  50.578333  52.785000  85.943333  98.483333  
--------------------------------------------------
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 20029 entries, 2018-10-01 07:32:00 to 2018-12-31 13:59:00
Data columns (total 9 columns):
XLB    20029 non-null float64
XLE    20029 non-null float64
XLF    20029 non-null float64
XLI    20029 non-null float64
XLK    20029 non-null float64
XLP    20029 non-null float64
XLU    20029 non-null float64
XLV    20029 non-null float64
XLY    20029 non-null float64
dtypes: float64(9)
memory usage: 1.5 MB
None
-------------------------------------------------------------------------------

compute the returns.

In [8]:
sector_returns = to_returns(sectors).dropna()

View example plots with XLE

In [9]:
xle = sector_returns['XLE']
cprint(xle)
-------------------------------------------------------------------------------
dataframe information
-------------------------------------------------------------------------------
                          XLE
dates                        
2018-12-31 13:55:00  0.000556
2018-12-31 13:56:00  0.000847
2018-12-31 13:57:00 -0.002105
2018-12-31 13:58:00  0.000878
2018-12-31 13:59:00  0.001782
--------------------------------------------------
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 20028 entries, 2018-10-01 07:33:00 to 2018-12-31 13:59:00
Data columns (total 1 columns):
XLE    20028 non-null float64
dtypes: float64(1)
memory usage: 312.9 KB
None
-------------------------------------------------------------------------------

Select the bootstrap parameters and run

In [10]:
N_paths = 1_000
block_size = 100
xle_sims = CBB(xle, blocksize=block_size, N_paths=N_paths)
1000it [00:00, 2103.48it/s]
In [11]:
view_all(xle, xle_sims, cmap=None)
XLE 62 15 82 922 601 290 293 871 457 ... 765 65 843 474 877 42 728 458 574 685
count 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 ... 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000
mean -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 ... -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000
std 0.0009 0.0010 0.0010 0.0010 0.0009 0.0009 0.0009 0.0009 0.0009 0.0009 ... 0.0010 0.0010 0.0010 0.0010 0.0008 0.0011 0.0010 0.0009 0.0009 0.0009
min -0.0285 -0.0285 -0.0285 -0.0285 -0.0285 -0.0190 -0.0285 -0.0285 -0.0243 -0.0285 ... -0.0285 -0.0285 -0.0237 -0.0285 -0.0148 -0.0285 -0.0285 -0.0243 -0.0285 -0.0285
25% -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 ... -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0004 -0.0004 -0.0003 -0.0003 -0.0003
50% 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 ... 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
75% 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 ... 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003
max 0.0276 0.0276 0.0238 0.0276 0.0276 0.0276 0.0238 0.0276 0.0276 0.0276 ... 0.0276 0.0276 0.0238 0.0276 0.0158 0.0276 0.0238 0.0276 0.0276 0.0276
skew -1.1478 -1.7493 -4.3336 -1.7894 -0.4918 4.8033 -3.7040 -3.3357 -2.9062 -1.3815 ... -1.6492 -1.8320 0.9217 -0.8227 0.0548 -1.7132 -0.3340 -0.8187 -6.3225 0.7036
kurtosis 214.0395 232.1456 205.1655 198.4600 196.8028 209.8321 224.1785 249.4489 224.3600 225.7883 ... 206.3803 244.7167 168.1456 226.0526 70.0080 256.0923 211.2428 189.3176 279.1243 196.5652

10 rows × 21 columns

<Figure size 432x288 with 0 Axes>
In [12]:
plot_realizations(xle, xle_sims, start=100, 
                  n_plot_paths=250, cmap='nanex_cmap')
<Figure size 432x288 with 0 Axes>

Correlation Investigation

correlation between sectors

In [13]:
sns.heatmap(sectors.corr())
Out[13]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f5feeaaaf60>

correlation between real and synthetic series

In [14]:
concat = pd.concat([xle.reset_index(drop=True), xle_sims],axis=1)
concat.corrwith(concat['XLE'])
Out[14]:
XLE    1.0000
0      0.0022
1     -0.0054
2      0.0080
3      0.0076
4      0.0053
5     -0.0108
6      0.0045
7     -0.0012
8      0.0106
9      0.0029
10    -0.0096
11     0.0003
12     0.0013
13    -0.0065
14    -0.0029
15     0.0016
16    -0.0020
17     0.0063
18    -0.0030
19     0.0059
20    -0.0052
21     0.0069
22     0.0023
23     0.0036
24     0.0000
25     0.0007
26    -0.0051
27     0.0154
28     0.0021
        ...  
970    0.0060
971   -0.0007
972    0.0004
973    0.0018
974    0.0017
975   -0.0063
976    0.0079
977   -0.0030
978   -0.0030
979   -0.0068
980    0.0001
981   -0.0023
982    0.0030
983   -0.0080
984   -0.0047
985   -0.0062
986    0.0047
987    0.0062
988   -0.0192
989    0.0028
990   -0.0018
991    0.0012
992   -0.0042
993    0.0084
994    0.0033
995    0.0108
996   -0.0051
997    0.0007
998   -0.0164
999   -0.0068
Length: 1001, dtype: float64
In [15]:
sns.heatmap(concat.corr())
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f5feeed0710>

Generate synthetics for all sectors

In [16]:
sim_dict = dict()

for sec in sector_returns:
    tmp = sector_returns[sec]
    N_paths = 2000
    block_size = 100
    sec_sims = CBB(tmp, blocksize=block_size, N_paths=N_paths)
    sim_dict[sec] = sec_sims
    view_all(tmp, sec_sims, cmap=None)
    plot_realizations(tmp, sec_sims, start=100, 
                      n_plot_paths=100, cmap='nanex_cmap')
2000it [00:01, 1898.11it/s]
XLB 1246 514 824 172 592 1876 62 1277 912 ... 1368 394 1766 720 821 613 360 871 1718 498
count 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 ... 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000
mean -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 ... -0.0000 0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000
std 0.0008 0.0008 0.0007 0.0008 0.0007 0.0008 0.0008 0.0007 0.0008 0.0008 ... 0.0008 0.0008 0.0008 0.0008 0.0008 0.0008 0.0007 0.0008 0.0008 0.0008
min -0.0212 -0.0212 -0.0212 -0.0165 -0.0212 -0.0210 -0.0210 -0.0165 -0.0212 -0.0212 ... -0.0212 -0.0212 -0.0210 -0.0212 -0.0212 -0.0165 -0.0212 -0.0212 -0.0212 -0.0210
25% -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 ... -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002
50% 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 ... 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
75% 0.0002 0.0001 0.0001 0.0001 0.0001 0.0001 0.0001 0.0001 0.0002 0.0002 ... 0.0002 0.0002 0.0001 0.0002 0.0002 0.0001 0.0002 0.0001 0.0002 0.0001
max 0.0215 0.0209 0.0185 0.0215 0.0185 0.0209 0.0215 0.0215 0.0209 0.0215 ... 0.0185 0.0159 0.0215 0.0215 0.0185 0.0215 0.0159 0.0209 0.0215 0.0215
skew 0.1371 3.4367 -3.6326 2.4115 -2.2794 2.1112 3.2886 3.3865 -3.1153 0.0855 ... -1.8573 -0.5275 -1.6819 1.9826 -2.1505 2.4286 -2.2752 -2.1781 -0.4862 -0.0017
kurtosis 181.2890 183.9256 167.0301 169.2249 163.8458 202.9235 177.4138 204.5612 186.1422 201.5498 ... 168.2814 115.5665 151.4552 178.6772 175.8756 204.7690 114.3395 188.8145 155.7606 165.3744

10 rows × 21 columns

2000it [00:00, 2220.22it/s]
XLE 759 103 71 598 221 1232 951 1581 1653 ... 113 1800 293 1002 260 1419 1109 233 305 1076
count 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 ... 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000
mean -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 ... -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 0.0000 -0.0000
std 0.0009 0.0009 0.0009 0.0009 0.0010 0.0009 0.0010 0.0010 0.0009 0.0009 ... 0.0010 0.0009 0.0009 0.0010 0.0010 0.0009 0.0009 0.0009 0.0009 0.0009
min -0.0285 -0.0243 -0.0285 -0.0243 -0.0243 -0.0243 -0.0285 -0.0285 -0.0285 -0.0285 ... -0.0285 -0.0285 -0.0285 -0.0285 -0.0285 -0.0190 -0.0237 -0.0285 -0.0285 -0.0243
25% -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0004 -0.0003 -0.0003 ... -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0004 -0.0003 -0.0003 -0.0003 -0.0003
50% 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 ... 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
75% 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 ... 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003
max 0.0276 0.0238 0.0206 0.0238 0.0276 0.0276 0.0238 0.0276 0.0238 0.0276 ... 0.0238 0.0206 0.0276 0.0276 0.0276 0.0238 0.0276 0.0276 0.0276 0.0276
skew -1.1478 -1.4830 -6.2481 -1.3173 -3.2397 0.3533 -3.6229 -2.4384 -1.2847 1.1128 ... -2.8863 -2.3939 0.9301 -0.5514 -0.6464 0.8583 1.5557 -1.4676 -0.4689 -1.7101
kurtosis 214.0395 182.4835 199.5656 178.6037 183.4771 197.4433 233.9060 241.9974 223.3564 214.7726 ... 236.0567 144.9644 253.6961 233.6655 229.3406 131.0603 188.0275 246.3730 193.9853 232.7259

10 rows × 21 columns

2000it [00:00, 2230.02it/s]
XLF 165 1801 942 857 66 95 1750 1791 1068 ... 1337 1076 1295 1477 621 759 545 1856 1443 1012
count 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 ... 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000
mean -0.0000 -0.0000 -0.0000 -0.0000 0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 ... -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000
std 0.0008 0.0008 0.0008 0.0009 0.0007 0.0008 0.0009 0.0008 0.0008 0.0008 ... 0.0008 0.0009 0.0008 0.0008 0.0009 0.0007 0.0008 0.0008 0.0009 0.0008
min -0.0240 -0.0240 -0.0240 -0.0240 -0.0157 -0.0199 -0.0240 -0.0240 -0.0199 -0.0240 ... -0.0240 -0.0240 -0.0240 -0.0240 -0.0240 -0.0199 -0.0240 -0.0240 -0.0240 -0.0199
25% -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 ... -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0003
50% 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 ... 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
75% 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 ... 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003
max 0.0196 0.0196 0.0196 0.0143 0.0196 0.0164 0.0196 0.0164 0.0196 0.0164 ... 0.0157 0.0196 0.0164 0.0196 0.0196 0.0164 0.0196 0.0164 0.0196 0.0164
skew -1.8309 -1.7554 -1.2435 -5.9189 1.6907 -1.5710 -2.1141 -5.0086 -2.2237 -2.2848 ... -1.3765 -1.3300 -1.3227 -4.9571 -4.6734 0.5736 -3.9689 -5.0355 -2.6802 -4.1898
kurtosis 163.3457 162.5939 155.3228 213.7059 107.4517 148.1915 151.4556 214.4406 128.9714 177.0564 ... 135.6505 166.5284 152.8402 204.5689 158.8608 143.0921 167.7563 233.8225 152.2562 142.7599

10 rows × 21 columns

2000it [00:00, 2003.05it/s]
XLI 1270 1052 1346 236 1144 786 387 506 664 ... 219 184 892 1127 1400 478 1888 1922 887 1237
count 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 ... 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000
mean -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 ... -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000
std 0.0008 0.0008 0.0009 0.0009 0.0008 0.0008 0.0007 0.0008 0.0008 0.0008 ... 0.0007 0.0008 0.0008 0.0009 0.0008 0.0008 0.0008 0.0008 0.0008 0.0008
min -0.0243 -0.0243 -0.0243 -0.0243 -0.0180 -0.0243 -0.0180 -0.0196 -0.0243 -0.0196 ... -0.0196 -0.0196 -0.0243 -0.0243 -0.0243 -0.0243 -0.0196 -0.0243 -0.0243 -0.0196
25% -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 ... -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0002 -0.0002 -0.0003 -0.0003
50% 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 ... 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
75% 0.0002 0.0002 0.0002 0.0002 0.0003 0.0002 0.0002 0.0002 0.0002 0.0002 ... 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002
max 0.0223 0.0155 0.0223 0.0223 0.0223 0.0223 0.0223 0.0155 0.0223 0.0155 ... 0.0223 0.0223 0.0223 0.0223 0.0223 0.0155 0.0139 0.0223 0.0223 0.0223
skew -2.0874 -0.3855 -3.9744 -3.4284 -0.8261 1.4367 -1.2278 -3.2678 -2.5994 -0.7865 ... 0.7236 0.1356 -4.8223 -4.7804 -3.5214 -3.7292 -3.7543 -2.6257 -2.0061 -1.4708
kurtosis 159.4556 122.5277 150.5805 183.2744 111.6865 210.6491 131.3226 119.1644 216.9766 112.6524 ... 150.5052 182.5728 168.0503 204.0371 198.9529 145.5943 119.1048 275.3121 146.9757 156.0997

10 rows × 21 columns

2000it [00:00, 2064.52it/s]
XLK 291 516 1721 241 483 760 1744 1799 847 ... 59 1293 626 1828 768 247 316 1425 807 1485
count 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 ... 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000
mean -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 ... -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 0.0000 -0.0000 -0.0000 0.0000
std 0.0010 0.0010 0.0010 0.0009 0.0010 0.0009 0.0010 0.0010 0.0009 0.0010 ... 0.0009 0.0009 0.0009 0.0010 0.0009 0.0009 0.0009 0.0011 0.0010 0.0009
min -0.0250 -0.0217 -0.0250 -0.0250 -0.0250 -0.0250 -0.0250 -0.0250 -0.0217 -0.0250 ... -0.0203 -0.0250 -0.0250 -0.0250 -0.0250 -0.0217 -0.0250 -0.0217 -0.0250 -0.0217
25% -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 ... -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0003
50% 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 ... 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
75% 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 ... 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003
max 0.0262 0.0262 0.0262 0.0168 0.0262 0.0262 0.0262 0.0262 0.0168 0.0234 ... 0.0262 0.0168 0.0262 0.0262 0.0262 0.0262 0.0262 0.0262 0.0262 0.0234
skew -1.4734 -1.9988 -0.7956 -4.0344 -2.8603 -0.5874 -0.4804 -3.8362 -5.1977 -5.1359 ... 3.3713 -2.2663 -2.6618 -0.7318 -3.6745 -2.6720 0.2229 0.5433 -0.5830 -1.6581
kurtosis 169.0033 183.8149 181.2500 180.9159 189.4075 210.7883 181.5797 174.5759 142.3784 169.0867 ... 168.3775 154.9194 160.4967 175.1471 177.1576 147.6783 204.2995 172.0769 181.2915 140.2097

10 rows × 21 columns

2000it [00:01, 1872.83it/s]
XLP 1963 1825 642 793 311 1973 1380 515 1088 ... 1624 653 1655 844 197 1421 343 1178 805 104
count 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 ... 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000
mean -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 0.0000 -0.0000 0.0000 -0.0000 -0.0000 ... -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 0.0000 -0.0000 -0.0000 -0.0000 -0.0000
std 0.0006 0.0005 0.0006 0.0006 0.0005 0.0006 0.0006 0.0005 0.0006 0.0006 ... 0.0006 0.0006 0.0005 0.0006 0.0005 0.0006 0.0006 0.0005 0.0006 0.0006
min -0.0205 -0.0123 -0.0205 -0.0205 -0.0205 -0.0205 -0.0205 -0.0085 -0.0120 -0.0205 ... -0.0205 -0.0120 -0.0123 -0.0205 -0.0123 -0.0123 -0.0123 -0.0123 -0.0123 -0.0205
25% -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 ... -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002
50% 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 ... 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
75% 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 ... 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002
max 0.0164 0.0164 0.0100 0.0100 0.0164 0.0164 0.0164 0.0164 0.0164 0.0164 ... 0.0164 0.0164 0.0085 0.0164 0.0164 0.0164 0.0164 0.0164 0.0164 0.0164
skew -2.6199 0.4735 -6.3335 -5.6294 -4.4051 -1.2431 -3.5686 1.4006 -0.8851 -3.8031 ... -5.7357 0.1819 -1.3182 -3.2559 -0.1692 1.0903 0.1457 0.8835 3.6471 -5.2236
kurtosis 179.0759 93.7858 219.0657 197.3337 278.7614 167.7890 276.9132 93.8713 124.8939 263.0938 ... 279.6832 96.0415 58.8187 240.3877 99.3617 94.3866 106.0708 143.9933 170.4192 248.1321

10 rows × 21 columns

2000it [00:00, 2133.72it/s]
XLU 1763 1546 295 1045 647 1626 1496 1056 1417 ... 561 526 1092 789 1805 282 800 1981 1512 946
count 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 ... 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000
mean 0.0000 0.0000 -0.0000 -0.0000 0.0000 -0.0000 -0.0000 0.0000 -0.0000 -0.0000 ... 0.0000 0.0000 -0.0000 0.0000 0.0000 -0.0000 0.0000 0.0000 -0.0000 -0.0000
std 0.0006 0.0007 0.0006 0.0007 0.0007 0.0007 0.0006 0.0006 0.0006 0.0006 ... 0.0006 0.0006 0.0007 0.0006 0.0006 0.0007 0.0006 0.0007 0.0006 0.0006
min -0.0288 -0.0288 -0.0288 -0.0288 -0.0288 -0.0288 -0.0122 -0.0117 -0.0288 -0.0288 ... -0.0288 -0.0131 -0.0288 -0.0288 -0.0288 -0.0288 -0.0131 -0.0131 -0.0288 -0.0288
25% -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 ... -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002
50% 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 ... 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
75% 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 ... 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002
max 0.0165 0.0165 0.0165 0.0127 0.0165 0.0127 0.0127 0.0127 0.0165 0.0165 ... 0.0165 0.0127 0.0083 0.0127 0.0127 0.0094 0.0165 0.0165 0.0083 0.0165
skew -4.6218 -5.1809 -4.9789 -4.4373 -10.7475 -10.0379 -0.6546 2.3524 -6.1388 -3.4668 ... -3.8949 -1.7346 -10.2977 -4.7932 -5.0850 -10.0283 0.4614 2.2001 -6.9951 -3.0642
kurtosis 288.4771 296.8368 342.5700 225.4223 524.2665 432.8416 77.9959 83.0560 346.8904 258.8393 ... 323.0389 77.5143 426.1454 285.1608 255.2015 389.2546 122.4439 144.1018 283.0038 282.4019

10 rows × 21 columns

2000it [00:01, 1847.68it/s]
XLV 1126 934 1935 1388 630 878 1889 1743 418 ... 1373 644 1048 461 280 873 600 1769 1010 1788
count 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 ... 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000
mean -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 0.0000 -0.0000 -0.0000 ... -0.0000 -0.0000 0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 0.0000
std 0.0007 0.0006 0.0007 0.0007 0.0007 0.0007 0.0007 0.0006 0.0007 0.0007 ... 0.0006 0.0006 0.0007 0.0007 0.0006 0.0007 0.0007 0.0007 0.0006 0.0006
min -0.0210 -0.0205 -0.0210 -0.0210 -0.0210 -0.0210 -0.0210 -0.0210 -0.0205 -0.0210 ... -0.0210 -0.0210 -0.0205 -0.0205 -0.0210 -0.0210 -0.0210 -0.0210 -0.0152 -0.0117
25% -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 ... -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002
50% 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 ... 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
75% 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 ... 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0001
max 0.0157 0.0157 0.0157 0.0157 0.0157 0.0156 0.0157 0.0157 0.0157 0.0156 ... 0.0065 0.0157 0.0157 0.0157 0.0157 0.0157 0.0157 0.0157 0.0156 0.0156
skew -2.3524 -5.3992 -0.9982 -1.7147 -1.4485 -7.4021 -2.2142 -2.0682 -0.5933 -4.1903 ... -4.4853 -3.8595 1.8440 -3.0257 -1.9949 -0.6967 -4.4813 -2.2599 -1.6680 2.0904
kurtosis 169.5654 206.9599 136.5111 139.8345 178.7073 247.7387 153.3463 197.5877 127.7627 206.5862 ... 110.4798 202.4384 140.8837 154.5529 137.1743 149.0507 281.4487 168.9785 98.2079 102.2093

10 rows × 21 columns

2000it [00:00, 2012.90it/s]
XLY 1288 1850 145 1838 1181 1259 785 483 1038 ... 1239 202 1943 1732 134 1240 1156 1965 1922 1453
count 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 ... 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000 20,028.0000
mean -0.0000 -0.0000 0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 ... -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000
std 0.0009 0.0008 0.0009 0.0009 0.0009 0.0009 0.0009 0.0009 0.0008 0.0009 ... 0.0009 0.0009 0.0009 0.0009 0.0008 0.0008 0.0010 0.0009 0.0008 0.0009
min -0.0347 -0.0347 -0.0347 -0.0347 -0.0347 -0.0347 -0.0347 -0.0347 -0.0347 -0.0306 ... -0.0306 -0.0347 -0.0306 -0.0347 -0.0239 -0.0347 -0.0347 -0.0306 -0.0237 -0.0306
25% -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 ... -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0001 -0.0001
50% 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 ... 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
75% 0.0001 0.0001 0.0001 0.0001 0.0001 0.0001 0.0001 0.0001 0.0001 0.0001 ... 0.0001 0.0001 0.0001 0.0001 0.0001 0.0002 0.0002 0.0001 0.0001 0.0001
max 0.0243 0.0170 0.0243 0.0243 0.0243 0.0243 0.0243 0.0170 0.0155 0.0155 ... 0.0243 0.0243 0.0243 0.0170 0.0170 0.0170 0.0243 0.0243 0.0243 0.0243
skew -5.8846 -3.4847 -3.4056 -7.5792 -3.4436 -5.0518 -7.5989 -6.8850 -5.2745 -9.2706 ... -3.3213 -1.5341 -1.7072 -7.2687 -6.0347 -9.1775 -7.8613 -3.1853 -0.5883 -2.5349
kurtosis 322.3403 226.9012 372.6300 292.7334 243.5613 311.0593 370.8100 290.6795 274.5929 325.9188 ... 276.9286 278.4367 281.7630 372.0641 198.2677 433.4681 363.6691 318.9820 179.0157 274.1203

10 rows × 21 columns

<Figure size 432x288 with 0 Axes>