/
build.py
executable file
·41 lines (38 loc) · 1.02 KB
/
build.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
from staticjinja import make_site
from collections import OrderedDict as od
def get_sections():
sections = od([
('Basic Terminology', od(
[
('Calls and Puts', 'calls_and_puts.html'),
('Optionality', 'optionality.html'),
('Contracts', 'contract_specifications.html'),
('Exercising', 'when_to_exercise.html'),
('Moneyness', 'moneyness.html'),
('Downside vs Upside', 'down_upside.html'),
('Cost of Options', 'options_cost.html'),
]
)
),
('Profit Diagrams', od(
[
('Payoff', 'payoff_diagram.html'),
('Profit at Expiration', 'profit_at_expiration.html'),
]
)
)
]
)
return {'sections': sections}
def get_contents(template):
with open(template.filename) as f:
return {'page': f.read()}
if __name__ == '__main__':
site = make_site(
contexts=[
('.*.html', get_sections),
],
outpath="site",
staticpaths=['static'],
)
site.render(use_reloader=True)