import os
os.chdir('../src/')
from importlib import reload
import pandas as pd
import numpy as np
import lightgbm as lgb
import matplotlib.pyplot as plt
from matplotlib import axes
from pandas.plotting import autocorrelation_plot
from sklearn import decomposition, model_selection, svm, linear_model
import math
from finta import TA
import statsmodels
import seaborn as sns
df = pd.read_json('../data/raw/BTC_ETH.json')
df.head()
s = df.close / df.close.shift(1)
s.plot()
s = df.close / df.close.shift(1)
g = sns.kdeplot(s)
g.set(xlim=(0.9, 1.1))
plt.axvline(s.quantile(0.05), c='red')
plt.axvline(s.quantile(0.25), c='green')
s.sort_values()
What in the actual fuck? We have a day with -33%! This can probably completely destroy our gains! Most of those tail events happened after the exchange opened. What if we only consider later events?
s2 = s[2000:]
g = sns.kdeplot(s2)
g.set(xlim=(0.9, 1.1))
plt.axvline(s2.quantile(0.05), c='red')
plt.axvline(s2.quantile(0.25), c='green')
s2[2000:].sort_values()
We still have extreme tail events, like 16% losses in a half an hour! Yay, the success of my strategy can drop heavily based on one prediction!