forked from matthewtrotter/assetuniverse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.py
31 lines (25 loc) · 1.08 KB
/
example.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
from assetuniverse import AssetUniverse
from assetuniverse import Asset
import datetime
days = 1*365
end = datetime.date.today()
start = end - datetime.timedelta(days=days)
cashasset = Asset(start, end, 'VFISX')
# tickers = ['AAPL', 'MSFT', 'SPY', 'TLT', 'UUP', 'GLD']
# assets = [Asset(start, end, ticker) for ticker in tickers]
assets = [
Asset(start, end, 'GLD', readable_name='Gold'),
Asset(start, end, 'USO', readable_name='Oil'),
Asset(start, end, 'AAPL', readable_name='Apple'),
Asset(start, end, 'MSFT', readable_name='Microsoft'),
Asset(start, end, 'SPY', readable_name='S&P 500'),
Asset(start, end, 'TLT', readable_name='30-year Treasury Bonds'),
Asset(start, end, 'UUP', readable_name='US Dollar'),
# Asset(start, end, 'YK', readable_name='Corn', exchange='ECBOT', data_source='Interactive Brokers'),
# Asset(start, end, 'MCD', readable_name='CAD.USD', exchange='GLOBEX', data_source='Interactive Brokers', ),
]
AU = AssetUniverse(start, end, assets, cashasset=cashasset)
AU.download()
AU.plot_prices()
print(AU.returns())
print(AU.last_dates_downloaded)