forked from AdityaDas-IITM/Wells-QuantAI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prediction_plots.py
136 lines (115 loc) · 3.75 KB
/
prediction_plots.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
import pandas as pd
import matplotlib.pyplot as plt
train_df = pd.read_csv("data/training_data.csv")
pred_df = pd.read_csv("prediction_spatial_15.csv")
print(pred_df.head())
tenor_vals = [30*v for v in [2,3,6,9]] + [365*v for v in [1,2,3,4,5,6,7,8,9,10,15,20,25,30,40]]
# mnns = pred_df.columns[2:]
# mnns = [float(c) for c in mnns]
vol_2m_10_15 = pred_df.iloc[0, 2:]
vol_2m_01_06 = pred_df.iloc[1121, 2:]
vol_40y_10_15 = pred_df.iloc[18, 2:]
vol_40y_01_06 = pred_df.iloc[1139, 2:]
vol_train_40y_01_05 = train_df.iloc[18, 2:]
vol_10_mnns_10_15 = pred_df.iloc[0:19, 11]
vol_10_mnns_01_06 = pred_df.iloc[1121:1140, 11]
vol_19_mnns_10_15 = pred_df.iloc[0:19, 20]
vol_19_mnns_01_06 = pred_df.iloc[1121:1140, 20]
vol_01_mnns_10_15 = pred_df.iloc[0:19, 2]
vol_01_mnns_01_06 = pred_df.iloc[1121:1140, 2]
vol_train_19_mnns_01_05 = train_df.iloc[0:19, 20]
vol_train_01_mnns_01_05 = train_df.iloc[0:19, 2]
vol_train_10_mnns_01_05 = train_df.iloc[0:19, 11]
# print(vol_01_mnns_10_15[0])
'''
# Volatility vs Moneyness Plots for 2M, 40Y Tenors
plt.figure()
plt.plot(vol_2m_10_15)
plt.title("Volatility vs Moneyness for 2M Tenor, 10/15/2019")
plt.xlabel("Moneyness")
plt.ylabel("Volatility (at 2M)")
plt.ylim([0,0.7])
plt.figure()
plt.plot(vol_2m_01_06)
plt.title("Volatility vs Moneyness for 2M Tenor, 01/06/2020")
plt.xlabel("Moneyness")
plt.ylabel("Volatility (at 2M)")
plt.ylim([0,0.7])
plt.figure()
plt.plot(vol_40y_10_15)
plt.title("Volatility vs Moneyness for 40Y Tenor, 10/15/2019")
plt.xlabel("Moneyness")
plt.ylabel("Volatility (at 40Y)")
plt.ylim([0,0.7])
plt.figure()
plt.plot(vol_40y_01_06)
plt.title("Volatility vs Moneyness for 40Y Tenor, 01/06/2020")
plt.xlabel("Moneyness")
plt.ylabel("Volatility (at 40Y)")
plt.ylim([0,0.7])
plt.figure()
plt.plot(vol_train_40y_01_05)
plt.title("Volatility vs Moneyness for 40Y Tenor, 01/05/2017")
plt.xlabel("Moneyness")
plt.ylabel("Volatility (at 40Y)")
plt.ylim([0,0.7])
plt.show()
#'''
#'''
# Volatility vs. Tenor for few moneynesses
plt.figure()
plt.plot(tenor_vals, vol_10_mnns_10_15)
plt.title("Volatility vs Tenor for 1.0 Moneyness, 10/15/2019")
plt.xlabel("Tenor")
plt.ylabel("Volatility (at 1.0 Moneyness)")
plt.ylim([0.1,0.3])
plt.figure()
plt.plot(tenor_vals, vol_10_mnns_01_06)
plt.title("Volatility vs Tenor for 1.0 Moneyness, 01/06/2020")
plt.xlabel("Tenor")
plt.ylabel("Volatility (at 1.0 Moneyness)")
plt.ylim([0.1,0.3])
plt.figure()
plt.plot(tenor_vals, vol_train_10_mnns_01_05)
plt.title("Train Volatility vs Tenor for 1.0 Moneyness, 01/05/2017")
plt.xlabel("Tenor")
plt.ylabel("Volatility (at 1.0 Moneyness)")
plt.ylim([0.1,0.3])
plt.figure()
plt.plot(tenor_vals, vol_train_01_mnns_01_05)
plt.title("Train Volatility vs Tenor for 0.1 Moneyness, 01/05/2017")
plt.xlabel("Tenor")
plt.ylabel("Volatility (at 0.1 Moneyness)")
plt.ylim([0,0.7])
plt.figure()
plt.plot(tenor_vals, vol_train_19_mnns_01_05)
plt.title("Train Volatility vs Tenor for 1.9 Moneyness, 01/05/2017")
plt.xlabel("Tenor")
plt.ylabel("Volatility (at 1.9 Moneyness)")
plt.ylim([0,0.7])
plt.figure()
plt.plot(tenor_vals, vol_01_mnns_10_15)
plt.title("Volatility vs Tenor for 0.1 Moneyness, 10/15/2019")
plt.xlabel("Tenor")
plt.ylabel("Volatility (at 0.1 Moneyness)")
plt.ylim([0,0.7])
plt.figure()
plt.plot(tenor_vals, vol_01_mnns_01_06)
plt.title("Volatility vs Tenor for 0.1 Moneyness, 01/06/2020")
plt.xlabel("Tenor")
plt.ylabel("Volatility (at 0.1 Moneyness)")
plt.ylim([0,0.7])
plt.figure()
plt.plot(tenor_vals, vol_19_mnns_10_15)
plt.title("Volatility vs Tenor for 1.9 Moneyness, 10/15/2019")
plt.xlabel("Tenor")
plt.ylabel("Volatility (at 1.9 Moneyness)")
plt.ylim([0,0.7])
plt.figure()
plt.plot(tenor_vals, vol_19_mnns_01_06)
plt.title("Volatility vs Tenor for 1.9 Moneyness, 01/06/2020")
plt.xlabel("Tenor")
plt.ylabel("Volatility (at 1.9 Moneyness)")
plt.ylim([0,0.7])
plt.show()
#'''