20221021 Implementing Alphiers using Pandas and Python

Legal Disclaimer And Risk Disclosure

These materials are for educational and entertainment purposes only and are neither a solicitation, nor an offer to buy or sell any financial instrument.

All information provided here is the personal opinion of the authors. The authors, AAII, AAII-Silicon Valley, AAII-SV-CI Group leaders and members, make no claim that the information in any of these presentations is correct. Under no circumstances should any of the information in these presentations be taken as personal or individual trading advice. Past performance and/or hypothetical results of any trading method are not indicative of future results. Trading and investing in any financial instrument carries high levels of risk and may not be suitable for all investors. You should be aware of all the risks associated with trading, and seek advice from a financial professional, if you have any doubts.

The authors, AAII, AAII-Silicon Valley, AAII-SV-CI Group leaders and members, will not assume any responsibility whatsoever for the actions of the reader nor financial losses that may result from the use or misuse of the information presented.

Notes

Algorithm is based on this 1984 Barron's Article suggested by Tom Dineen.
Here is the jupyter workbook.
Note that this algoritm assumes 70 trading days = 14 weeks. It is not clear from the article that Alphier makes the same assumption.

In [3]:
import pandas_datareader as pdr
from datetime import datetime, timedelta

Sign

In [1]:
def sign(b):
  return (0 < b) - (0 > b)
print(sign(-3.2))
-1
In [3]:
print(sign(3.2))
1
In [4]:
print(sign(0.0))
0

Load S&P 500 Data from Yahoo

In [4]:
df= pdr.get_data_yahoo("%5EGSPC", datetime(1936, 1, 1), datetime.now())["Adj Close"].to_frame()
print(df)
              Adj Close
Date                   
1936-01-02    13.400000
1936-01-03    13.550000
1936-01-06    13.410000
1936-01-07    13.620000
1936-01-08    13.700000
...                 ...
2022-10-28  3901.060059
2022-10-31  3871.979980
2022-11-01  3856.100098
2022-11-02  3759.689941
2022-11-03  3719.889893

[21832 rows x 1 columns]

Calculate 'Adj Close' Fractional Change from prior Trading Day

In [5]:
df["pct_change"]= df['Adj Close'].pct_change()
print(df)
              Adj Close  pct_change
Date                               
1936-01-02    13.400000         NaN
1936-01-03    13.550000    0.011194
1936-01-06    13.410000   -0.010332
1936-01-07    13.620000    0.015660
1936-01-08    13.700000    0.005874
...                 ...         ...
2022-10-28  3901.060059    0.024626
2022-10-31  3871.979980   -0.007454
2022-11-01  3856.100098   -0.004101
2022-11-02  3759.689941   -0.025002
2022-11-03  3719.889893   -0.010586

[21832 rows x 2 columns]

Calculate Sign of each pct_change

In [7]:
df["sign"]= df['pct_change'].map(sign) #also works with apply(sign)
print(df)
              Adj Close  pct_change  sign
Date                                     
1936-01-02    13.400000         NaN     0
1936-01-03    13.550000    0.011194     1
1936-01-06    13.410000   -0.010332    -1
1936-01-07    13.620000    0.015660     1
1936-01-08    13.700000    0.005874     1
...                 ...         ...   ...
2022-10-25  3859.110107    0.016267     1
2022-10-26  3830.600098   -0.007388    -1
2022-10-27  3807.300049   -0.006083    -1
2022-10-28  3901.060059    0.024626     1
2022-10-31  3871.979980   -0.007454    -1

[21829 rows x 3 columns]

Show where Sign is zero

In [8]:
print(df.loc[df['sign']==0])
              Adj Close  pct_change  sign
Date                                     
1936-01-02    13.400000         NaN     0
1936-05-12    13.860000         0.0     0
1936-05-15    14.290000         0.0     0
1936-06-02    14.390000         0.0     0
1936-12-15    17.320000         0.0     0
...                 ...         ...   ...
1992-09-03   417.980011         0.0     0
1997-01-28   765.020020         0.0     0
2003-01-10   927.570007         0.0     0
2008-01-03  1447.160034         0.0     0
2017-01-10  2268.899902         0.0     0

[275 rows x 3 columns]

Replace zero 'Sign'ed cells with value from prior 'Sign'ed cell

In [9]:
df["ffill"]= df['sign'].replace(to_replace=0, method='ffill')
print(df.loc[df['sign']==0])
              Adj Close  pct_change  sign  ffill
Date                                            
1936-01-02    13.400000         NaN     0      0
1936-05-12    13.860000         0.0     0     -1
1936-05-15    14.290000         0.0     0      1
1936-06-02    14.390000         0.0     0     -1
1936-12-15    17.320000         0.0     0      1
...                 ...         ...   ...    ...
1992-09-03   417.980011         0.0     0      1
1997-01-28   765.020020         0.0     0     -1
2003-01-10   927.570007         0.0     0      1
2008-01-03  1447.160034         0.0     0     -1
2017-01-10  2268.899902         0.0     0     -1

[275 rows x 4 columns]

Calculate Rolling Sum of ffill over a 70 day Window

In [10]:
window=70
df["rollingSum"]= df['ffill'].rolling(window).sum()
print(df)
              Adj Close  pct_change  sign  ffill  rollingSum
Date                                                        
1936-01-02    13.400000         NaN     0      0         NaN
1936-01-03    13.550000    0.011194     1      1         NaN
1936-01-06    13.410000   -0.010332    -1     -1         NaN
1936-01-07    13.620000    0.015660     1      1         NaN
1936-01-08    13.700000    0.005874     1      1         NaN
...                 ...         ...   ...    ...         ...
2022-10-25  3859.110107    0.016267     1      1        -8.0
2022-10-26  3830.600098   -0.007388    -1     -1       -10.0
2022-10-27  3807.300049   -0.006083    -1     -1       -12.0
2022-10-28  3901.060059    0.024626     1      1       -12.0
2022-10-31  3871.979980   -0.007454    -1     -1       -12.0

[21829 rows x 5 columns]

Find days where rolling sum is less than a limit

In [11]:
downLimit=-17
df["downLimit"]= df['rollingSum']<=downLimit
print(df)
              Adj Close  pct_change  sign  ffill  rollingSum  downLimit
Date                                                                   
1936-01-02    13.400000         NaN     0      0         NaN      False
1936-01-03    13.550000    0.011194     1      1         NaN      False
1936-01-06    13.410000   -0.010332    -1     -1         NaN      False
1936-01-07    13.620000    0.015660     1      1         NaN      False
1936-01-08    13.700000    0.005874     1      1         NaN      False
...                 ...         ...   ...    ...         ...        ...
2022-10-25  3859.110107    0.016267     1      1        -8.0      False
2022-10-26  3830.600098   -0.007388    -1     -1       -10.0      False
2022-10-27  3807.300049   -0.006083    -1     -1       -12.0      False
2022-10-28  3901.060059    0.024626     1      1       -12.0      False
2022-10-31  3871.979980   -0.007454    -1     -1       -12.0      False

[21829 rows x 6 columns]

Add Weekday Column

In [5]:
df["weekday"]=[df.index[i].weekday() for i in range(len(df))] #0 is Monday, 4 is Friday
print(df)
              Adj Close  Prolonged Liquidation  weekday
Date                                                   
1936-01-02    13.400000                  False        3
1936-01-03    13.550000                  False        4
1936-01-06    13.410000                  False        0
1936-01-07    13.620000                  False        1
1936-01-08    13.700000                  False        2
...                 ...                    ...      ...
2022-10-27  3807.300049                  False        3
2022-10-28  3901.060059                  False        4
2022-10-31  3871.979980                  False        0
2022-11-01  3856.100098                  False        1
2022-11-02  3832.639893                  False        2

[21831 rows x 3 columns]

Show All Fridays with Prolonged Liquidation

In [15]:
aDf= df.loc[df["downLimit"] & (4==df["weekday"])] # 4 is Friday
print(aDf.to_string()) #Note: 'to_string' eliminates elipses in print
              Adj Close  pct_change  sign  ffill  rollingSum  downLimit  weekday
Date                                                                            
1937-11-05    11.460000    0.000000     0     -1       -18.0       True        4
1937-11-12    11.910000   -0.004181    -1     -1       -18.0       True        4
1937-11-19    10.510000   -0.058244    -1     -1       -22.0       True        4
1937-11-26    10.670000    0.049164     1      1       -22.0       True        4
1938-04-01     8.910000    0.048235     1      1       -18.0       True        4
1941-12-12     8.730000   -0.010204    -1     -1       -20.0       True        4
1941-12-19     8.490000    0.000000     0     -1       -24.0       True        4
1941-12-26     8.420000    0.003576     1      1       -24.0       True        4
1942-01-02     8.890000    0.023015     1      1       -26.0       True        4
1942-01-09     8.850000   -0.003378    -1     -1       -26.0       True        4
1942-01-16     8.960000   -0.008850    -1     -1       -24.0       True        4
1942-01-23     8.840000    0.003405     1      1       -22.0       True        4
1942-01-30     8.850000   -0.006734    -1     -1       -20.0       True        4
1942-02-06     8.850000   -0.011173    -1     -1       -24.0       True        4
1942-02-13     8.620000    0.002326     1      1       -22.0       True        4
1942-02-20     8.470000   -0.003529    -1     -1       -22.0       True        4
1942-02-27     8.590000    0.008216     1      1       -18.0       True        4
1942-03-06     8.160000   -0.026253    -1     -1       -22.0       True        4
1942-03-13     8.030000    0.006266     1      1       -18.0       True        4
1942-03-20     8.110000   -0.010976    -1     -1       -20.0       True        4
1942-03-27     8.050000   -0.009840    -1     -1       -18.0       True        4
1942-04-17     7.700000   -0.015345    -1     -1       -18.0       True        4
1956-10-26    46.270000    0.009160     1      1       -18.0       True        4
1956-11-02    46.980000    0.009888     1      1       -18.0       True        4
1956-11-09    46.340000   -0.008346    -1     -1       -20.0       True        4
1956-11-16    45.740002    0.000437     1      1       -24.0       True        4
1956-11-23    45.139999    0.010522     1      1       -22.0       True        4
1956-11-30    45.080002    0.015773     1      1       -20.0       True        4
1957-11-01    40.439999   -0.015100    -1     -1       -18.0       True        4
1962-05-11    62.650002   -0.014472    -1     -1       -18.0       True        4
1962-05-18    63.820000   -0.001721    -1     -1       -24.0       True        4
1962-05-25    59.470001   -0.018971    -1     -1       -26.0       True        4
1962-06-01    59.380001   -0.004193    -1     -1       -26.0       True        4
1962-06-08    58.450001    0.000856     1      1       -22.0       True        4
1962-06-15    55.889999    0.028713     1      1       -22.0       True        4
1962-06-22    52.680000   -0.016981    -1     -1       -30.0       True        4
1962-06-29    54.750000    0.006249     1      1       -26.0       True        4
1962-07-06    56.169998   -0.011266    -1     -1       -22.0       True        4
1970-04-17    85.669998   -0.002445    -1     -1       -18.0       True        4
1970-04-24    82.769997   -0.003251    -1     -1       -20.0       True        4
1970-05-01    81.440002   -0.000981    -1     -1       -24.0       True        4
1970-05-08    79.440002   -0.004885    -1     -1       -22.0       True        4
1970-05-15    76.900002    0.019353     1      1       -24.0       True        4
1970-05-22    72.250000    0.001247     1      1       -26.0       True        4
1970-05-29    76.550003    0.026002     1      1       -22.0       True        4
1970-06-05    76.169998   -0.015383    -1     -1       -22.0       True        4
1970-06-12    73.879997   -0.007656    -1     -1       -26.0       True        4
1970-06-19    77.050003    0.007058     1      1       -20.0       True        4
1970-06-26    73.470001   -0.007430    -1     -1       -22.0       True        4
1970-07-10    74.449997    0.005266     1      1       -22.0       True        4
1974-02-01    95.320000   -0.012944    -1     -1       -18.0       True        4
1974-02-08    92.330002   -0.010397    -1     -1       -20.0       True        4
1974-08-23    71.550003   -0.017170    -1     -1       -18.0       True        4
1974-09-13    65.199997   -0.022635    -1     -1       -24.0       True        4
1974-09-20    70.139999    0.000713     1      1       -20.0       True        4
1974-09-27    64.940002   -0.022871    -1     -1       -22.0       True        4
1974-10-04    62.340000    0.000963     1      1       -24.0       True        4
1974-10-11    71.139999    0.019344     1      1       -18.0       True        4
1974-10-25    70.120003   -0.001424    -1     -1       -20.0       True        4
1974-11-01    73.879997   -0.000271    -1     -1       -22.0       True        4
1974-11-08    74.910004   -0.003989    -1     -1       -18.0       True        4
1974-11-15    71.910004   -0.015740    -1     -1       -22.0       True        4
1974-11-22    68.900002    0.010560     1      1       -18.0       True        4
1982-07-30   107.089996   -0.005849    -1     -1       -18.0       True        4
1982-08-06   103.709999   -0.013789    -1     -1       -22.0       True        4
1982-08-13   103.849998    0.013962     1      1       -28.0       True        4
1982-08-20   113.019997    0.035361     1      1       -26.0       True        4
1982-08-27   117.110001   -0.012147    -1     -1       -20.0       True        4
1984-03-09   154.350006   -0.005413    -1     -1       -18.0       True        4
1984-04-13   157.309998   -0.002663    -1     -1       -18.0       True        4
2000-12-15  1312.150024   -0.021463    -1     -1       -18.0       True        4
2001-09-21   965.799988   -0.019034    -1     -1       -18.0       True        4
2002-07-19   847.750000   -0.038352    -1     -1       -20.0       True        4
2002-07-26   852.840027    0.016884     1      1       -20.0       True        4

Functional Composition via Method Chaining

Calculate sign of Adj Close's percent change. Zero fill. Mark values <=17 in 70 day rolling window. Note: 70 days may not be the same as 14 weeks!

In [27]:
import pandas_datareader as pdr
from datetime import datetime, timedelta
sign = lambda b: (0 < b) - (0 > b) # Lambda is python's shorthand for creating one line functions
df= pdr.get_data_yahoo("%5EGSPC", datetime(1936, 1, 1), datetime.now())["Adj Close"].to_frame()
window=70
downLimit=-17
df["Prolonged Liquidation"]= df['Adj Close'].pct_change().map(sign).replace(to_replace=0, method='ffill').rolling(window).sum()<=downLimit
df["weekday"]=[df.index[i].weekday() for i in range(len(df))]
aDf= df.loc[df["Prolonged Liquidation"] & (4==df["weekday"])] # 4 is Friday
print(aDf.to_string())
              Adj Close  Prolonged Liquidation  weekday
Date                                                   
1937-11-05    11.460000                   True        4
1937-11-12    11.910000                   True        4
1937-11-19    10.510000                   True        4
1937-11-26    10.670000                   True        4
1938-04-01     8.910000                   True        4
1941-12-12     8.730000                   True        4
1941-12-19     8.490000                   True        4
1941-12-26     8.420000                   True        4
1942-01-02     8.890000                   True        4
1942-01-09     8.850000                   True        4
1942-01-16     8.960000                   True        4
1942-01-23     8.840000                   True        4
1942-01-30     8.850000                   True        4
1942-02-06     8.850000                   True        4
1942-02-13     8.620000                   True        4
1942-02-20     8.470000                   True        4
1942-02-27     8.590000                   True        4
1942-03-06     8.160000                   True        4
1942-03-13     8.030000                   True        4
1942-03-20     8.110000                   True        4
1942-03-27     8.050000                   True        4
1942-04-17     7.700000                   True        4
1956-10-26    46.270000                   True        4
1956-11-02    46.980000                   True        4
1956-11-09    46.340000                   True        4
1956-11-16    45.740002                   True        4
1956-11-23    45.139999                   True        4
1956-11-30    45.080002                   True        4
1957-11-01    40.439999                   True        4
1962-05-11    62.650002                   True        4
1962-05-18    63.820000                   True        4
1962-05-25    59.470001                   True        4
1962-06-01    59.380001                   True        4
1962-06-08    58.450001                   True        4
1962-06-15    55.889999                   True        4
1962-06-22    52.680000                   True        4
1962-06-29    54.750000                   True        4
1962-07-06    56.169998                   True        4
1970-04-17    85.669998                   True        4
1970-04-24    82.769997                   True        4
1970-05-01    81.440002                   True        4
1970-05-08    79.440002                   True        4
1970-05-15    76.900002                   True        4
1970-05-22    72.250000                   True        4
1970-05-29    76.550003                   True        4
1970-06-05    76.169998                   True        4
1970-06-12    73.879997                   True        4
1970-06-19    77.050003                   True        4
1970-06-26    73.470001                   True        4
1970-07-10    74.449997                   True        4
1974-02-01    95.320000                   True        4
1974-02-08    92.330002                   True        4
1974-08-23    71.550003                   True        4
1974-09-13    65.199997                   True        4
1974-09-20    70.139999                   True        4
1974-09-27    64.940002                   True        4
1974-10-04    62.340000                   True        4
1974-10-11    71.139999                   True        4
1974-10-25    70.120003                   True        4
1974-11-01    73.879997                   True        4
1974-11-08    74.910004                   True        4
1974-11-15    71.910004                   True        4
1974-11-22    68.900002                   True        4
1982-07-30   107.089996                   True        4
1982-08-06   103.709999                   True        4
1982-08-13   103.849998                   True        4
1982-08-20   113.019997                   True        4
1982-08-27   117.110001                   True        4
1984-03-09   154.350006                   True        4
1984-04-13   157.309998                   True        4
2000-12-15  1312.150024                   True        4
2001-09-21   965.799988                   True        4
2002-07-19   847.750000                   True        4
2002-07-26   852.840027                   True        4

Don's Question

Compute the return for the next month, quarter, 6 months and year return AFTER each of bottom signals is made. I haven’t seen any metrics which show Alphier’s bottom picker had any value – only when it fired. And it doesn’t seem to be doing too well OOS for ^GSPC since last signal was in 2002. It totally missed 2008-2009.

In [10]:
import pandas_datareader as pdr
import pandas as pd
from datetime import datetime, timedelta
sign = lambda b: (0 < b) - (0 > b)
IdxTkrs=[
["DJI" , "%5EDJI"],
["N100" , "%5ENDX"],
["SP500" , "%5EGSPC"],
["SP400" , "%5ESP400"],
["SP600" , "%5ESP600"],
["R1000" , "%5ERUI"],
["R2000" , "%5ERUT"],
]
def Alphier(df,window=70,downLimit=-17):
  df["ProLiq"]= df['Adj Close'].pct_change().map(sign).replace(to_replace=0, method='ffill').rolling(window).sum()<=downLimit
  df["weekday"]=[df.index[i].weekday() for i in range(len(df))]
  aDf= df.loc[df["ProLiq"] & (4==df["weekday"])] # 4 is Friday
  return aDf[['Adj Close']]
  print(aDf.to_string())

def IndexComparison(IdxTkrs,window=70,downLimit=-17):
  deltas=[30,int(365/4),int(365/2),365]
  rows=[]
  for Idx, Tkr in IdxTkrs:
    print("\n",Idx," returns over 1,3,6 and 12 months")
    iDf= pdr.get_data_yahoo(Tkr, datetime(1936, 1, 1), datetime.now())["Adj Close"].to_frame()
    aDf=Alphier(iDf,window,downLimit)
    # df hold the 1,3,6 and 12 mo quotes after each bottom in aDf
    df=pd.DataFrame([[iDf.loc[idx+timedelta(delta):].iloc[0]["Adj Close"] for delta in deltas]
                      for idx in aDf.index],columns=deltas,index=aDf.index)
    df=pd.concat([aDf,df],axis=1)
    # Turn Quotes into changes
    for delta in deltas: df['%d chg'%delta] = (df[delta]-aDf["Adj Close"])/df["Adj Close"]
    # rows holds one summary statistic for each Idx
    rows.append([Idx]+[df['%d chg'%delta].mean() for delta in deltas])
    print(df.to_string())
  return pd.DataFrame(rows,columns=["Index"]+deltas)

IndexComparisonDf=IndexComparison(IdxTkrs)
 DJI  returns over 1,3,6 and 12 months
              Adj Close           30            91           182          365    30 chg    91 chg   182 chg   365 chg
Date                                                                                                                 
2001-09-21  8235.809570  9377.030273  10035.339844  10427.669922  7872.149902  0.138568  0.218501  0.266138 -0.044156
2002-07-19  8019.259766  8990.790039   8322.400391   8586.740234  9096.690430  0.121150  0.037802  0.070765  0.134355
2002-07-26  8264.389648  8919.009766   8443.990234   8131.009766  9266.509766  0.079210  0.021732 -0.016139  0.121258
2002-08-30  8663.500000  7591.930176   8896.089844   7891.080078  9523.269531 -0.123688  0.026847 -0.089158  0.099240

 N100  returns over 1,3,6 and 12 months
              Adj Close           30           91          182          365    30 chg    91 chg   182 chg   365 chg
Date                                                                                                               
1992-04-24   303.815002   305.894989   303.424988   325.440002   327.279999  0.006846 -0.001284  0.071178  0.077234
1992-05-01   307.475006   318.980011   310.894989   329.154999   344.970001  0.037418  0.011123  0.070510  0.121945
1992-05-15   303.015015   303.864990   302.230011   348.489990   352.670013  0.002805 -0.002591  0.150075  0.163870
2000-12-01  2549.739990  2128.780029  1881.339966  1840.829956  1567.540039 -0.165099 -0.262144 -0.278032 -0.385216
2000-12-08  2895.389893  2281.540039  1813.020020  1896.219971  1645.359985 -0.212009 -0.373825 -0.345090 -0.431731
2000-12-15  2543.090088  2470.719971  1647.510010  1701.530029  1640.339966 -0.028458 -0.352162 -0.330920 -0.354982
2000-12-22  2436.260010  2643.129883  1705.020020  1727.469971  1577.310059  0.084913 -0.300149 -0.290934 -0.352569
2000-12-29  2341.699951  2694.530029  1573.250000  1830.189941  1577.050049  0.150673 -0.328159 -0.218435 -0.326536
2001-01-05  2267.850098  2467.300049  1448.160034  1668.589966  1649.829956  0.087947 -0.361439 -0.264242 -0.272514
2002-05-10  1188.780029  1135.619995   937.330017  1008.349976  1160.420044 -0.044718 -0.211519 -0.151777 -0.023856
2006-07-14  1462.170044  1494.329956  1727.209961  1844.810059  2028.020020  0.021995  0.181265  0.261693  0.386993
2006-07-28  1510.300049  1570.290039  1717.609985  1772.969971  1973.930054  0.039721  0.137264  0.173919  0.306979
2008-11-21  1085.569946  1189.150024  1172.709961  1363.170044  1792.939941  0.095415  0.080271  0.255718  0.651612

 SP500  returns over 1,3,6 and 12 months
              Adj Close           30           91          182          365    30 chg    91 chg   182 chg   365 chg
Date                                                                                                               
1937-11-05    11.460000    11.130000    10.540000    10.430000    13.430000 -0.028796 -0.080279 -0.089878  0.171902
1937-11-12    11.910000    10.740000    10.930000    10.260000    13.430000 -0.098237 -0.082284 -0.138539  0.127624
1937-11-19    10.510000    11.310000    11.020000     9.960000    12.880000  0.076118  0.048525 -0.052331  0.225500
1937-11-26    10.670000    10.690000    11.570000     9.280000    12.370000  0.001874  0.084349 -0.130272  0.159325
1938-04-01     8.910000     9.590000    11.910000    12.240000    11.260000  0.076319  0.336700  0.373737  0.263749
1941-12-12     8.730000     8.840000     8.030000     8.320000     9.420000  0.012600 -0.080183 -0.046964  0.079038
1941-12-19     8.490000     8.960000     8.110000     8.400000     9.680000  0.055359 -0.044759 -0.010601  0.140165
1941-12-26     8.420000     8.970000     8.050000     8.230000     9.650000  0.065321 -0.043943 -0.022565  0.146081
1942-01-02     8.890000     8.840000     8.200000     8.440000     9.920000 -0.005624 -0.077615 -0.050619  0.115860
1942-01-09     8.850000     8.740000     7.980000     8.800000     9.960000 -0.012429 -0.098305 -0.005650  0.125424
1942-01-16     8.960000     8.650000     7.700000     8.720000    10.120000 -0.034598 -0.140625 -0.026786  0.129464
1942-01-23     8.840000     8.520000     7.550000     8.630000    10.300000 -0.036199 -0.145928 -0.023756  0.165158
1942-01-30     8.850000     8.470000     7.710000     8.560000    10.520000 -0.042938 -0.128814 -0.032768  0.188701
1942-02-06     8.850000     8.200000     7.890000     8.490000    10.500000 -0.073446 -0.108475 -0.040678  0.186441
1942-02-13     8.620000     8.120000     7.880000     8.580000    10.810000 -0.058005 -0.085847 -0.004640  0.254060
1942-02-20     8.470000     8.150000     8.010000     8.710000    10.840000 -0.037780 -0.054309  0.028335  0.279811
1942-02-27     8.590000     8.060000     8.150000     8.610000    10.920000 -0.061700 -0.051222  0.002328  0.271246
1942-03-06     8.160000     8.200000     8.370000     8.610000    11.010000  0.004902  0.025735  0.055147  0.349265
1942-03-13     8.030000     7.960000     8.320000     8.540000    11.040000 -0.008717  0.036115  0.063512  0.374844
1942-03-20     8.110000     7.790000     8.400000     8.660000    10.920000 -0.039457  0.035758  0.067818  0.346486
1942-03-27     8.050000     7.540000     8.230000     8.900000    11.490000 -0.063354  0.022360  0.105590  0.427329
1942-04-17     7.700000     7.940000     8.720000     9.350000    11.380000  0.031169  0.132468  0.214286  0.477922
1956-10-26    46.270000    44.869999    44.820000    45.500000    40.419998 -0.030257 -0.031338 -0.016641 -0.126432
1956-11-02    46.980000    45.980000    44.619999    46.340000    40.369999 -0.021286 -0.050234 -0.013623 -0.140698
1956-11-09    46.340000    46.799999    43.320000    46.590000    40.180000  0.009927 -0.065170  0.005395 -0.132931
1956-11-16    45.740002    46.540001    43.509998    47.150002    40.040001  0.017490 -0.048754  0.030826 -0.124617
1956-11-23    45.139999    46.389999    43.380001    47.209999    41.180000  0.027692 -0.038990  0.045857 -0.087727
1956-11-30    45.080002    46.669998    43.740002    47.430000    41.360001  0.035271 -0.029725  0.052130 -0.082520
1957-11-01    40.439999    41.360001    41.700001    43.689999    51.560001  0.022750  0.031157  0.080366  0.274975
1962-05-11    62.650002    57.820000    57.549999    58.779999    70.480003 -0.077095 -0.081405 -0.061772  0.124980
1962-05-18    63.820000    55.740002    59.009998    60.160000    69.959999 -0.126606 -0.075368 -0.057349  0.096208
1962-05-25    59.470001    52.450001    59.580002    61.540001    69.870003 -0.118043  0.001850  0.034807  0.174878
1962-06-01    59.380001    55.860001    59.119999    62.259998    70.690002 -0.059279 -0.004379  0.048501  0.190468
1962-06-08    58.450001    56.549999    58.380001    63.060001    69.940002 -0.032506 -0.001198  0.078871  0.196578
1962-06-15    55.889999    57.830002    58.889999    62.570000    69.949997  0.034711  0.053677  0.119520  0.251566
1962-06-22    52.680000    56.799999    57.689999    62.639999    70.199997  0.078208  0.095102  0.189066  0.332574
1962-06-29    54.750000    57.830002    56.270000    62.959999    68.860001  0.056256  0.027763  0.149954  0.257717
1962-07-06    56.169998    57.750000    57.070000    64.129997    69.739998  0.028129  0.016023  0.141713  0.241588
1970-04-17    85.669998    76.959999    77.690002    84.279999   104.010002 -0.101669 -0.093148 -0.016225  0.214077
1970-04-24    82.769997    70.250000    77.820000    83.769997   103.940002 -0.151263 -0.059804  0.012082  0.255769
1970-05-01    81.440002    77.839996    78.050003    83.250000   103.290001 -0.044204 -0.041626  0.022225  0.268296
1970-05-08    79.440002    76.290001    77.279999    84.220001   102.360001 -0.039653 -0.027190  0.060171  0.288520
1970-05-15    76.900002    74.580002    75.180000    83.370003   100.690002 -0.030169 -0.022367  0.084135  0.309363
1970-05-22    72.250000    76.639999    79.239998    83.720001   100.129997  0.060761  0.096747  0.158754  0.385882
1970-05-29    76.550003    72.889999    81.860001    85.930000   100.199997 -0.047812  0.069366  0.122534  0.308948
1970-06-05    76.169998    71.779999    82.830002    89.459999   101.089996 -0.057634  0.087436  0.174478  0.327163
1970-06-12    73.879997    74.550003    82.519997    90.260002   100.220001  0.009069  0.116946  0.221711  0.356524
1970-06-19    77.050003    77.790001    82.620003    90.220001    97.870003  0.009604  0.072291  0.170928  0.270214
1970-06-26    73.470001    77.650002    82.830002    91.089996    97.739998  0.056894  0.127399  0.239826  0.330339
1970-07-10    74.449997    76.199997    85.080002    92.190002   100.820000  0.023506  0.142780  0.238281  0.354197
1974-02-01    95.320000    95.529999    91.290001    78.589996    77.820000  0.002203 -0.042279 -0.175514 -0.183592
1974-02-08    92.330002    98.879997    91.470001    80.860001    78.360001  0.070941 -0.009314 -0.124228 -0.151305
1974-08-23    71.550003    69.419998    68.900002    82.620003    85.059998 -0.029769 -0.037037  0.154717  0.188819
1974-09-13    65.199997    72.739998    67.070000    84.760002    82.879997  0.115644  0.028681  0.300000  0.271166
1974-09-20    70.139999    73.500000    66.910004    83.389999    85.070000  0.047904 -0.046051  0.188908  0.212860
1974-09-27    64.940002    70.089996    67.139999    83.360001    85.029999  0.079304  0.033877  0.283646  0.309362
1974-10-04    62.340000    73.080002    70.709999    80.879997    86.879997  0.172281  0.134264  0.297401  0.393648
1974-10-11    71.139999    75.150002    72.610001    84.180000    89.459999  0.056368  0.020663  0.183301  0.257520
1974-10-25    70.120003    68.830002    72.980003    86.620003    89.730003 -0.018397  0.040787  0.235311  0.279663
1974-11-01    73.879997    68.110001    76.980003    89.220001    88.089996 -0.078100  0.041960  0.207634  0.192339
1974-11-08    74.910004    65.599998    78.629997    90.529999    89.339996 -0.124283  0.049660  0.208517  0.192631
1974-11-15    71.910004    66.459999    81.500000    90.430000    91.459999 -0.075789  0.133361  0.257544  0.271868
1974-11-22    68.900002    65.959999    82.620003    90.580002    89.699997 -0.042671  0.199129  0.314659  0.301887
1982-07-30   107.089996   117.660004   133.720001   144.509995   162.039993  0.098702  0.248669  0.349426  0.513120
1982-08-06   103.709999   121.370003   142.160004   146.139999   159.179993  0.170283  0.370745  0.409122  0.534857
1982-08-13   103.849998   122.239998   139.529999   147.649994   163.699997  0.177082  0.343572  0.421762  0.576312
1982-08-20   113.019997   122.510002   137.020004   148.000000   164.339996  0.083967  0.212352  0.309503  0.454079
1982-08-27   117.110001   123.620003   134.880005   149.740005   162.250000  0.055589  0.151738  0.278627  0.385450
1984-03-09   154.350006   155.449997   155.169998   164.369995   178.789993  0.007127  0.005313  0.064917  0.158341
1984-04-13   157.309998   157.500000   150.880005   164.179993   180.919998  0.001208 -0.040875  0.043672  0.150086
2000-12-15  1312.150024  1326.650024  1150.530029  1214.359985  1134.359985  0.011051 -0.123172 -0.074527 -0.135495
2001-09-21   965.799988  1089.900024  1144.890015  1148.699951   833.700012  0.128495  0.185432  0.189377 -0.136778
2002-07-19   847.750000   950.700012   884.390015   901.780029   978.799988  0.121439  0.043220  0.063733  0.154586
2002-07-26   852.840027   947.950012   897.650024   861.400024   996.520020  0.111521  0.052542  0.010037  0.168472

 SP400  returns over 1,3,6 and 12 months
             Adj Close          30          91         182         365    30 chg    91 chg   182 chg   365 chg
Date                                                                                                          
1982-08-13   31.790001   36.830002   43.169998   46.270000   53.029999  0.158540  0.357974  0.455489  0.668135
1982-08-20   33.990002   36.980000   42.610001   46.639999   52.970001  0.087967  0.253604  0.372168  0.558399
1984-02-03   50.220001   48.720001   48.320000   48.330002   54.169998 -0.029869 -0.037834 -0.037634  0.078654
1984-02-24   47.849998   48.220001   45.639999   50.360001   54.880001  0.007733 -0.046186  0.052456  0.146918
1984-03-02   48.980000   48.389999   46.299999   50.220001   55.520000 -0.012046 -0.054716  0.025316  0.133524
1984-03-09   47.669998   47.119999   46.900002   49.730000   54.549999 -0.011538 -0.016153  0.043214  0.144326
1984-03-16   49.029999   48.150002   46.099998   50.450001   54.070000 -0.017948 -0.059759  0.028962  0.102794
1984-03-23   48.320000   47.340000   47.090000   50.369999   54.070000 -0.020281 -0.025455  0.042425  0.118998
1984-04-06   47.200001   48.279999   46.599998   48.220001   55.009998  0.022881 -0.012712  0.021610  0.165466
1984-04-13   47.570000   47.689999   46.090000   48.560001   55.959999  0.002523 -0.031112  0.020811  0.176372
1984-04-27   47.869999   45.330002   45.180000   49.430000   55.910000 -0.053060 -0.056194  0.032588  0.167955
1992-05-15  142.559998  140.570007  144.399994  152.729996  161.949997 -0.013959  0.012907  0.071338  0.136013
1994-12-09  162.660004  170.059998  179.259995  191.630005  217.550003  0.045494  0.102053  0.178102  0.337452
2002-07-05  478.579987  406.980011  389.079987  439.339996  494.779999 -0.149609 -0.187012 -0.081993  0.033850
2002-07-12  444.790009  436.589996  401.109985  443.450012  502.350006 -0.018436 -0.098204 -0.003013  0.129409
2002-07-19  421.510010  457.149994  422.980011  432.549988  488.049988  0.084553  0.003487  0.026191  0.157861
2002-07-26  416.339996  460.660004  428.630005  418.079987  496.559998  0.106451  0.029519  0.004179  0.192679
2002-08-02  419.279999  429.850006  433.059998  416.910004  490.230011  0.025210  0.032866 -0.005653  0.169219
2002-08-09  436.420013  444.200012  423.950012  403.480011  486.790009  0.017827 -0.028573 -0.075478  0.115416

 SP600  returns over 1,3,6 and 12 months
             Adj Close          30          91         182          365    30 chg    91 chg   182 chg   365 chg
Date                                                                                                           
1990-09-14   51.790001   44.759998   48.320000   59.830002    65.339996 -0.135741 -0.067001  0.155242  0.261633
1990-09-21   50.139999   45.279999   48.240002   59.959999    66.269997 -0.096929 -0.037894  0.195852  0.321699
1990-09-28   47.669998   44.549999   48.180000   61.369999    66.580002 -0.065450  0.010699  0.287393  0.396686
1990-10-05   47.470001   45.119999   48.020000   62.680000    65.459999 -0.049505  0.011586  0.320413  0.378976
1990-10-12   44.900002   45.860001   46.869999   63.380001    66.389999  0.021381  0.043875  0.411581  0.478619
1990-10-19   45.340000   46.400002   47.340000   63.759998    68.320000  0.023379  0.044111  0.406264  0.506837
1990-10-26   44.970001   46.060001   49.669998   62.750000    67.300003  0.024238  0.104514  0.395375  0.496553
1990-11-02   44.750000   47.570000   52.869999   62.939999    68.510002  0.063017  0.181452  0.406480  0.530950
1990-11-09   45.119999   48.709999   55.509998   62.930000    69.470001  0.079566  0.230275  0.394725  0.539672
1990-11-16   46.340000   47.919998   57.279999   61.349998    67.720001  0.034096  0.236081  0.323910  0.461372
1990-11-23   46.139999   48.189999   57.110001   61.959999    65.750000  0.044430  0.237755  0.342870  0.425011
1998-10-09  132.559998  165.919998  178.899994  160.789993   176.779999  0.251660  0.349578  0.212960  0.333585
2002-07-19  192.619995  206.380005  190.639999  197.020004   224.889999  0.071436 -0.010279  0.022843  0.167532
2002-07-26  192.940002  207.839996  194.509995  191.029999   231.419998  0.077226  0.008137 -0.009899  0.199440
2002-08-02  189.850006  194.160004  198.259995  189.750000   227.869995  0.022702  0.044298 -0.000527  0.200263
2002-08-09  197.960007  201.509995  194.479996  182.789993   226.539993  0.017933 -0.017579 -0.076632  0.144373
2002-08-16  200.330002  198.520004  197.039993  183.229996   236.869995 -0.009035 -0.016423 -0.085359  0.182399
2002-08-23  204.729996  184.899994  202.759995  185.119995   238.190002 -0.096859 -0.009622 -0.095785  0.163435
2002-08-30  200.259995  187.860001  203.649994  183.500000   247.570007 -0.061919  0.016928 -0.083691  0.236243
2018-12-07  905.260010  874.479980  934.179993  919.890015   999.059998 -0.034001  0.031947  0.016161  0.103617
2018-12-14  878.109985  894.059998  947.250000  923.570007  1007.929993  0.018164  0.078737  0.051770  0.147840
2018-12-21  809.609985  908.960022  918.090027  937.049988  1022.669983  0.122713  0.133990  0.157409  0.263164
2018-12-28  840.210022  917.070007  939.299988  953.250000  1018.020020  0.091477  0.117935  0.134538  0.211626

 R1000  returns over 1,3,6 and 12 months
             Adj Close          30          91         182         365    30 chg    91 chg   182 chg   365 chg
Date                                                                                                          
2001-09-21  507.980011  572.729980  602.700012  607.909973  442.309998  0.127466  0.186464  0.196720 -0.129277
2002-07-19  450.640015  504.040009  467.440002  477.609985  521.780029  0.118498  0.037280  0.059848  0.157864
2002-07-26  452.920013  502.829987  474.230011  456.950012  531.309998  0.110196  0.047050  0.008898  0.173077

 R2000  returns over 1,3,6 and 12 months
              Adj Close           30           91          182          365    30 chg    91 chg   182 chg   365 chg
Date                                                                                                               
1990-09-21   133.740005   121.599998   130.850006   165.800003   178.800003 -0.090773 -0.021609  0.239719  0.336922
1998-10-09   318.399994   398.429993   431.230011   405.859985   430.190002  0.251351  0.354366  0.274686  0.351099
1998-10-16   342.869995   390.420013   427.049988   421.579987   408.899994  0.138682  0.245516  0.229562  0.192580
2000-12-15   458.029999   493.279999   441.799988   495.130005   479.940002  0.076960 -0.035434  0.080999  0.047835
2001-09-21   378.890015   430.500000   484.019989   502.390015   358.679993  0.136214  0.277468  0.325952 -0.053340
2002-07-19   386.200012   401.290009   363.369995   388.100006   457.170013  0.039073 -0.059114  0.004920  0.183765
2002-07-26   382.260010   407.730011   372.640015   375.059998   473.829987  0.066630 -0.025166 -0.018835  0.239549
2002-08-02   376.450012   379.130005   383.450012   372.170013   464.769989  0.007119  0.018595 -0.011369  0.234613
2002-08-09   388.450012   392.470001   379.000000   358.779999   459.269989  0.010349 -0.024327 -0.076381  0.182314
2018-12-21  1292.089966  1457.449951  1505.920044  1549.630005  1674.140015  0.127979  0.165492  0.199321  0.295684
2018-12-28  1337.920044  1473.540039  1539.739990  1566.569946  1664.150024  0.101366  0.150846  0.170900  0.243834
In [11]:
print(IndexComparisonDf)
   Index        30        91       182       365
0    DJI  0.053810  0.076220  0.057901  0.077674
1   N100  0.005958 -0.137181 -0.068949 -0.033752
2  SP500  0.005369  0.023845  0.093902  0.209205
3  SP400  0.012233  0.007290  0.061636  0.196497
4  SP600  0.017999  0.074917  0.168865  0.310936
5  R1000  0.118720  0.090265  0.088489  0.067222
6  R2000  0.078632  0.095148  0.129043  0.204987

https://www.mybanktracker.com/blog/investing/average-stock-market-return-302399
Average Stock Market Returns (end date of September 19, 2019)


Market index   DJIA    S&P 500  NASDAQ Composite
1-year return      2.61%  3.40%  2.94%
5-year average     9.41%  8.37% 12.31%
10-year average   10.68% 10.90% 14.39%
15-year average    6.67%  6.75% 10.19%

Setting downLimit to 16, gives a bottom at 10/14/2022 and 11/4/2022(!)

In [12]:
import pandas_datareader as pdr
from datetime import datetime, timedelta
sign = lambda b: (0 < b) - (0 > b)
df= pdr.get_data_yahoo("%5EGSPC", datetime(1936, 1, 1), datetime.now())["Adj Close"].to_frame()
window=70
downLimit=-16
df["Prolonged Liquidation"]= df['Adj Close'].pct_change().map(sign).replace(to_replace=0, method='ffill').rolling(window).sum()<=downLimit
df["weekday"]=[df.index[i].weekday() for i in range(len(df))]
aDf= df.loc[df["Prolonged Liquidation"] & (4==df["weekday"])] # 4 is Friday
print(aDf.to_string())
              Adj Close  Prolonged Liquidation  weekday
Date                                                   
1937-10-15    11.840000                   True        4
1937-11-05    11.460000                   True        4
1937-11-12    11.910000                   True        4
1937-11-19    10.510000                   True        4
1937-11-26    10.670000                   True        4
1938-03-25     9.350000                   True        4
1938-04-01     8.910000                   True        4
1938-04-08     9.620000                   True        4
1941-10-31     9.500000                   True        4
1941-12-12     8.730000                   True        4
1941-12-19     8.490000                   True        4
1941-12-26     8.420000                   True        4
1942-01-02     8.890000                   True        4
1942-01-09     8.850000                   True        4
1942-01-16     8.960000                   True        4
1942-01-23     8.840000                   True        4
1942-01-30     8.850000                   True        4
1942-02-06     8.850000                   True        4
1942-02-13     8.620000                   True        4
1942-02-20     8.470000                   True        4
1942-02-27     8.590000                   True        4
1942-03-06     8.160000                   True        4
1942-03-13     8.030000                   True        4
1942-03-20     8.110000                   True        4
1942-03-27     8.050000                   True        4
1942-04-17     7.700000                   True        4
1942-04-24     7.550000                   True        4
1946-11-22    14.130000                   True        4
1953-06-19    23.840000                   True        4
1956-10-26    46.270000                   True        4
1956-11-02    46.980000                   True        4
1956-11-09    46.340000                   True        4
1956-11-16    45.740002                   True        4
1956-11-23    45.139999                   True        4
1956-11-30    45.080002                   True        4
1956-12-14    46.540001                   True        4
1957-10-25    40.590000                   True        4
1957-11-01    40.439999                   True        4
1962-05-11    62.650002                   True        4
1962-05-18    63.820000                   True        4
1962-05-25    59.470001                   True        4
1962-06-01    59.380001                   True        4
1962-06-08    58.450001                   True        4
1962-06-15    55.889999                   True        4
1962-06-22    52.680000                   True        4
1962-06-29    54.750000                   True        4
1962-07-06    56.169998                   True        4
1962-07-13    57.830002                   True        4
1962-07-20    56.810001                   True        4
1966-10-14    76.599998                   True        4
1970-02-20    88.029999                   True        4
1970-04-17    85.669998                   True        4
1970-04-24    82.769997                   True        4
1970-05-01    81.440002                   True        4
1970-05-08    79.440002                   True        4
1970-05-15    76.900002                   True        4
1970-05-22    72.250000                   True        4
1970-05-29    76.550003                   True        4
1970-06-05    76.169998                   True        4
1970-06-12    73.879997                   True        4
1970-06-19    77.050003                   True        4
1970-06-26    73.470001                   True        4
1970-07-10    74.449997                   True        4
1970-07-17    77.690002                   True        4
1974-02-01    95.320000                   True        4
1974-02-08    92.330002                   True        4
1974-08-16    75.669998                   True        4
1974-08-23    71.550003                   True        4
1974-08-30    72.150002                   True        4
1974-09-06    71.419998                   True        4
1974-09-13    65.199997                   True        4
1974-09-20    70.139999                   True        4
1974-09-27    64.940002                   True        4
1974-10-04    62.340000                   True        4
1974-10-11    71.139999                   True        4
1974-10-25    70.120003                   True        4
1974-11-01    73.879997                   True        4
1974-11-08    74.910004                   True        4
1974-11-15    71.910004                   True        4
1974-11-22    68.900002                   True        4
1982-07-30   107.089996                   True        4
1982-08-06   103.709999                   True        4
1982-08-13   103.849998                   True        4
1982-08-20   113.019997                   True        4
1982-08-27   117.110001                   True        4
1984-03-09   154.350006                   True        4
1984-04-06   155.479996                   True        4
1984-04-13   157.309998                   True        4
2000-11-17  1367.719971                   True        4
2000-11-24  1341.770020                   True        4
2000-12-01  1315.229980                   True        4
2000-12-15  1312.150024                   True        4
2001-09-21   965.799988                   True        4
2002-07-12   921.390015                   True        4
2002-07-19   847.750000                   True        4
2002-07-26   852.840027                   True        4
2002-08-02   864.239990                   True        4
2018-12-28  2485.739990                   True        4
2022-10-14  3583.070068                   True        4
2022-11-04  3732.229980                   True        4

Here are the 80 days before 11/4

In [26]:
df= pdr.get_data_yahoo("%5EGSPC", datetime(1936, 1, 1), datetime.now())["Adj Close"].to_frame()
window=70
downLimit=-16
df["ffill"]= df['Adj Close'].pct_change().map(sign).replace(to_replace=0, method='ffill')
df["rollingSum"]= df['ffill'].rolling(window=window).sum()
df["downLimit"]= df['rollingSum']<=downLimit
print(df.iloc[-80:].to_string())
              Adj Close  ffill  rollingSum  downLimit
Date                                                 
2022-07-15  3863.159912      1       -10.0      False
2022-07-18  3830.850098     -1       -10.0      False
2022-07-19  3936.689941      1        -8.0      False
2022-07-20  3959.899902      1        -8.0      False
2022-07-21  3998.949951      1        -6.0      False
2022-07-22  3961.629883     -1        -6.0      False
2022-07-25  3966.840088      1        -4.0      False
2022-07-26  3921.050049     -1        -6.0      False
2022-07-27  4023.610107      1        -4.0      False
2022-07-28  4072.429932      1        -2.0      False
2022-07-29  4130.290039      1        -2.0      False
2022-08-01  4118.629883     -1        -2.0      False
2022-08-02  4091.189941     -1        -2.0      False
2022-08-03  4155.169922      1         0.0      False
2022-08-04  4151.939941     -1        -2.0      False
2022-08-05  4145.189941     -1        -2.0      False
2022-08-08  4140.060059     -1        -4.0      False
2022-08-09  4122.470215     -1        -6.0      False
2022-08-10  4210.240234      1        -4.0      False
2022-08-11  4207.270020     -1        -6.0      False
2022-08-12  4280.149902      1        -6.0      False
2022-08-15  4297.140137      1        -6.0      False
2022-08-16  4305.200195      1        -4.0      False
2022-08-17  4274.040039     -1        -4.0      False
2022-08-18  4283.740234      1        -2.0      False
2022-08-19  4228.479980     -1        -4.0      False
2022-08-22  4137.990234     -1        -4.0      False
2022-08-23  4128.729980     -1        -4.0      False
2022-08-24  4140.770020      1        -4.0      False
2022-08-25  4199.120117      1        -2.0      False
2022-08-26  4057.659912     -1        -4.0      False
2022-08-29  4030.610107     -1        -4.0      False
2022-08-30  3986.159912     -1        -4.0      False
2022-08-31  3955.000000     -1        -6.0      False
2022-09-01  3966.850098      1        -6.0      False
2022-09-02  3924.260010     -1        -6.0      False
2022-09-06  3908.189941     -1        -8.0      False
2022-09-07  3979.870117      1        -8.0      False
2022-09-08  4006.179932      1        -8.0      False
2022-09-09  4067.360107      1        -6.0      False
2022-09-12  4110.410156      1        -4.0      False
2022-09-13  3932.689941     -1        -6.0      False
2022-09-14  3946.010010      1        -4.0      False
2022-09-15  3901.350098     -1        -6.0      False
2022-09-16  3873.330078     -1        -8.0      False
2022-09-19  3899.889893      1        -6.0      False
2022-09-20  3855.929932     -1        -6.0      False
2022-09-21  3789.929932     -1        -6.0      False
2022-09-22  3757.989990     -1        -6.0      False
2022-09-23  3693.229980     -1        -6.0      False
2022-09-26  3655.040039     -1        -8.0      False
2022-09-27  3647.290039     -1        -8.0      False
2022-09-28  3719.040039      1        -8.0      False
2022-09-29  3640.469971     -1       -10.0      False
2022-09-30  3585.620117     -1       -10.0      False
2022-10-03  3678.429932      1       -10.0      False
2022-10-04  3790.929932      1       -10.0      False
2022-10-05  3783.280029     -1       -10.0      False
2022-10-06  3744.520020     -1       -10.0      False
2022-10-07  3639.659912     -1       -10.0      False
2022-10-10  3612.389893     -1       -10.0      False
2022-10-11  3588.840088     -1       -12.0      False
2022-10-12  3577.030029     -1       -14.0      False
2022-10-13  3669.909912      1       -14.0      False
2022-10-14  3583.070068     -1       -16.0       True
2022-10-17  3677.949951      1       -14.0      False
2022-10-18  3719.979980      1       -12.0      False
2022-10-19  3695.159912     -1       -12.0      False
2022-10-20  3665.780029     -1       -12.0      False
2022-10-21  3752.750000      1       -10.0      False
2022-10-24  3797.340088      1       -10.0      False
2022-10-25  3859.110107      1        -8.0      False
2022-10-26  3830.600098     -1       -10.0      False
2022-10-27  3807.300049     -1       -12.0      False
2022-10-28  3901.060059      1       -12.0      False
2022-10-31  3871.979980     -1       -12.0      False
2022-11-01  3856.100098     -1       -14.0      False
2022-11-02  3759.689941     -1       -14.0      False
2022-11-03  3719.889893     -1       -16.0       True
2022-11-04  3770.550049      1       -16.0       True
In [ ]: