-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplot_performance.py
More file actions
38 lines (30 loc) · 1017 Bytes
/
plot_performance.py
File metadata and controls
38 lines (30 loc) · 1017 Bytes
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
# plot_performance.py
import os.path
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
if __name__ == "__main__":
data = pd.io.parsers.read_csv(
"equity.csv", header=0,
parse_dates=True, index_col=0
)
# Visualizza tre grafici: curva di Equity,
# rendimenti, drawdown
fig = plt.figure()
# Imposta il bianco come colore di sfondo
fig.patch.set_facecolor('white')
# Visualizza la curva di equity
ax1 = fig.add_subplot(311, ylabel='Portfolio value, % ')
data['equity_curve'].plot(ax=ax1, color="blue", lw=2.)
plt.grid(True)
# Visualizza i rendimenti
ax2 = fig.add_subplot(312, ylabel='Period returns, % ')
data['returns'].plot(ax=ax2, color="black", lw=2.)
plt.grid(True)
# Visualizza i drawdown
ax3 = fig.add_subplot(313, ylabel='Drawdowns, % ')
data['drawdown'].plot(ax=ax3, color="red", lw=2.)
plt.grid(True)
# Stampa i grafici
plt.show()
print("")