forked from robcarver17/pysystemtrade
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prebakedsystems.py
44 lines (36 loc) · 1.33 KB
/
prebakedsystems.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
from systems.provided.example.simplesystem import simplesystem
my_system = simplesystem(log_level="on")
print(my_system)
print(my_system.portfolio.get_notional_position("EDOLLAR").tail(5))
from sysdata.csv.csv_sim_futures_data import csvFuturesSimData
from sysdata.configdata import Config
"""
Now loading config and data
"""
my_config = Config("systems.provided.example.simplesystemconfig.yaml")
my_data = csvFuturesSimData()
my_system = simplesystem(config=my_config, data=my_data)
print(my_system.portfolio.get_notional_position("EDOLLAR").tail(5))
"""
Let's get the chapter 15 system
"""
from systems.provided.futures_chapter15.basesystem import futures_system
from matplotlib.pyplot import show
system = futures_system(log_level="on")
print(system.accounts.portfolio().sharpe())
system.accounts.portfolio().curve().plot()
show()
"""
Same for estimated system
"""
from systems.provided.futures_chapter15.estimatedsystem import futures_system
system = futures_system(log_level="on")
print(system.accounts.portfolio().sharpe())
system.accounts.portfolio().curve().plot()
system.cache.pickle("private.this_system_name.pck")
show()
del (system) # just to make sure
system = futures_system(log_level="on")
system.cache.unpickle("private.this_system_name.pck")
# this will run much faster and reuse previous calculations
system.accounts.portfolio().sharpe()