<jupyter_start><jupyter_text>Section below is in progress to subset the overall data set when the SP500 has a significant negative movement.<jupyter_code>#Subsetting the SP5 data for when there is a significant drop. This helps evaluation if eth, btc are really 
#counter cyclical. 3 standard deviations away from mean would be considered a very large drop. 

SP_sdev=-3*pc1['Adj_Close_SP5'].std()

pc1[pc1.Adj_Close_SP5 < SP_sdev]

pc2=pc1

pc2['num']=range(0,pc2.shape[0])


neg_days= pc2.num[pc2.Adj_Close_SP5<SP_sdev]


def twendays(x):
  l1=list(range(x,x+20))
  return(l1)

neg_days_value =neg_days.apply(twendays)

import itertools

neg_days_index=list(itertools.chain.from_iterable(neg_days_value))
#Subsetting for when the sp 500 is 3 standard deviations negative. 

pc_s =pc2.iloc[neg_days_index]
pc_s.drop('num',axis=1,)
#Dropping number column for correlation. Correlation is much greater when 
pc_s.drop('num',axis=1,inplace=True)

pc_s.corr()
plt.figure(figsize=(8,6))
plt.hist(pc_s['Adj_Close_SP5'], bins=30, alpha=.5, label='Adj_Close_SP5');
plt.hist(pc_s['Adj_Close_BTC'], bins=30, alpha=.5, label='Adj_Close_BTC');
plt.hist(pc_s['Adj_Close_ETH'], bins=30, alpha=.5, label='Adj_Close_ETH');
plt.legend()

#looks like more negative downside present in the tails of eth and btc distributions.<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1219147344801795, 'fraction_numerical': 0.032909498878085267, 'mean_word_length': 6.734104046242774, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '302090', 'license': 'CC-BY-3.0', 'n_tokens_mistral': 541, 'n_tokens_neox': 506, 'n_words': 122, 'path': 'codeSheets/EMSE6574/CryptoProject/Plots_and_EDA_v1.ipynb', 'repo_name': 'kylearbide/kylearbide.github.io', 'size': '1337'}