-
Notifications
You must be signed in to change notification settings - Fork 0
/
finance_vix_flow.py
58 lines (49 loc) · 1.63 KB
/
finance_vix_flow.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
import os
from dataflows import Flow, update_resource, add_metadata,load, set_type, validate
def readme(fpath='README.md'):
if os.path.exists(fpath):
return open(fpath).read()
finance_vix = Flow(
add_metadata(
name="finance-vix",
title= "VIX - CBOE Volatility Index",
homepage= 'http://www.cboe.com/micro/VIX/',
sources=[
{
"name": "CBOE VIX Page",
"path": "http://www.cboe.com/micro/vix/historical.aspx",
"title": "CBOE VIX Page"
}
],
licenses=[
{
"id": "odc-pddl",
"path": "http://opendatacommons.org/licenses/pddl/",
"title": "Open Data Commons Public Domain Dedication and License v1.0",
'name': "open_data_commons_public_domain_dedication_and_license_v1.0"
}
],
version="0.2.0",
views=[
{
"name": "graph",
"title": "VIX - CBOE Volatility Index",
"specType": "simple",
"spec": {"type": "line","group": "Date","series": ["VIX Close"]}
}
],
readme=readme()
),
load(
load_source='http://www.cboe.com/publish/ScheduledTask/MktData/datahouse/vixcurrent.csv',
headers=2,
name='vix-daily'
),
set_type('Date', type='date', format='any'),
update_resource('vix-daily', **{'title': 'VIX Daily', 'path':'data/vix-daily.csv', 'dpp:streaming': True}),
validate()
)
def flow(parameters, datapackage, resources, stats):
return finance_vix
if __name__ == '__main__':
finance_vix.process()