Files
Volt/experiments/calibration/OutputTest.ipynb
T
2022-06-12 11:16:58 -04:00

25 KiB

In [2]:
import numpy as np
import torch
import pandas as pd
import gpytorch
import argparse
import datetime
import warnings
import os
from voltron.data import make_ticker_list, GetStockHistory
import matplotlib.pyplot as plt
import seaborn as sns
Warning no robinhood utils.
In [29]:
ntrain = 400
lookback = 1000
tckr = "MSFT"
data = GetStockHistory(tckr, history= ntrain + lookback)
In [30]:
pxs = data.Close[:-1].to_numpy()
date = "2021-12-29"
preds = torch.load("./saved-outputs/" + tckr + "/sm_constant100_" + date + ".pt")
In [31]:
cutoff = np.where(data.index == np.datetime64(datetime.datetime.strptime(date, "%Y-%m-%d").date()))[0][0]
pxs = data.Close[cutoff-100:cutoff]
trx = np.arange(pxs.shape[0])
tex = np.arange(pxs.shape[0], pxs.shape[0] + preds.shape[-1])
In [32]:
plt.plot(trx, pxs)
plt.plot(tex, preds[:10, :].T.exp(), color='gray', alpha=0.75, lw=0.2)
Out [32]:
[<matplotlib.lines.Line2D at 0x7f9d88a95f40>,
 <matplotlib.lines.Line2D at 0x7f9d88ab70a0>,
 <matplotlib.lines.Line2D at 0x7f9d88ab71c0>,
 <matplotlib.lines.Line2D at 0x7f9d88ab72e0>,
 <matplotlib.lines.Line2D at 0x7f9d88ab7400>,
 <matplotlib.lines.Line2D at 0x7f9d88ab7520>,
 <matplotlib.lines.Line2D at 0x7f9d88ab7640>,
 <matplotlib.lines.Line2D at 0x7f9d88ab7760>,
 <matplotlib.lines.Line2D at 0x7f9d88ab7880>,
 <matplotlib.lines.Line2D at 0x7f9d88ab79a0>]
In [ ]: