Skip to content

Instantly share code, notes, and snippets.

@3catz
Last active December 20, 2019 21:51
Show Gist options
  • Select an option

  • Save 3catz/163150b9232b1ec7f0b437ad2cd4b4a1 to your computer and use it in GitHub Desktop.

Select an option

Save 3catz/163150b9232b1ec7f0b437ad2cd4b4a1 to your computer and use it in GitHub Desktop.
Adaptive Norming
trainstock = yf.Ticker("SPY")
start = "2009-01-01"
end = "2016-01-01"
st = trainstock.history(start = start,end = end)
st = st[["Close","Open","Volume","High","Low"]]
D = reconstruct(st["Close"].values, dim = 45, tau = 1)
win = D[:,:-1] ; s = D[:,-1]
std = np.std(win, axis = -1)
mu = np.mean(win, axis = -1)
print(std.shape, mu.shape)
s = (s - mu)/std
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment