Skip to content

Commit dbe4ee2

Browse files
committed
add headers and improve organization of examples when generating docs
1 parent 247c78d commit dbe4ee2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+918
-1401
lines changed

docs/source/Buy_and_hold.rst

+18-42
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
Buy and Hold Strategy
2+
---------------------
3+
14
.. code:: ipython3
25
36
import numpy as np
@@ -29,23 +32,14 @@ Create Fake Index Data
2932
rdf['rf'] = 0.
3033
3134
pdf = 100*np.cumprod(1+rdf)
32-
pdf.plot()
33-
34-
35-
36-
37-
.. parsed-literal::
38-
:class: pynb-result
39-
40-
<AxesSubplot:>
35+
pdf.plot();
4136
4237
4338
44-
45-
.. image:: _static/Buy_and_hold_2_1.png
39+
.. image:: _static/Buy_and_hold_3_0.png
4640
:class: pynb
47-
:width: 375px
48-
:height: 259px
41+
:width: 377px
42+
:height: 262px
4943

5044

5145
Build Strategy
@@ -379,10 +373,10 @@ backtest.
379373
380374
381375
382-
.. image:: _static/Buy_and_hold_9_0.png
376+
.. image:: _static/Buy_and_hold_10_0.png
383377
:class: pynb
384-
:width: 874px
385-
:height: 295px
378+
:width: 876px
379+
:height: 297px
386380

387381

388382
Strategy value over time
@@ -391,23 +385,14 @@ Strategy value over time
391385
392386
performanceStats = res['static']
393387
#performance stats is an ffn object
394-
res.backtest_list[0].strategy.values.plot()
395-
396-
397-
388+
res.backtest_list[0].strategy.values.plot();
398389
399-
.. parsed-literal::
400-
:class: pynb-result
401390
402-
<AxesSubplot:>
403391
404-
405-
406-
407-
.. image:: _static/Buy_and_hold_11_1.png
392+
.. image:: _static/Buy_and_hold_12_0.png
408393
:class: pynb
409-
:width: 378px
410-
:height: 256px
394+
:width: 380px
395+
:height: 259px
411396

412397

413398
Strategy Outlays
@@ -417,23 +402,14 @@ securities.
417402

418403
.. code:: ipython3
419404
420-
res.backtest_list[0].strategy.outlays.plot()
421-
422-
423-
424-
425-
.. parsed-literal::
426-
:class: pynb-result
427-
428-
<AxesSubplot:>
429-
405+
res.backtest_list[0].strategy.outlays.plot();
430406
431407
432408
433-
.. image:: _static/Buy_and_hold_13_1.png
409+
.. image:: _static/Buy_and_hold_14_0.png
434410
:class: pynb
435-
:width: 394px
436-
:height: 246px
411+
:width: 395px
412+
:height: 248px
437413

438414

439415
You can get the change in number of shares purchased a

docs/source/ERC.rst

+20-52
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
Equally Weighted Risk Contributions Portfolio
2+
---------------------------------------------
3+
14
.. code:: ipython3
25
36
import numpy as np
@@ -57,23 +60,14 @@ Create Fake Index Data
5760
rdf['rf'] = 0.02/252
5861
5962
pdf = 100*np.cumprod(1+rdf)
60-
pdf.plot()
61-
62-
63-
64-
65-
.. parsed-literal::
66-
:class: pynb-result
67-
68-
<AxesSubplot:>
69-
63+
pdf.plot();
7064
7165
7266
73-
.. image:: _static/ERC_3_1.png
67+
.. image:: _static/ERC_4_0.png
7468
:class: pynb
75-
:width: 375px
76-
:height: 259px
69+
:width: 377px
70+
:height: 262px
7771

7872

7973
Build and run ERC Strategy
@@ -123,44 +117,26 @@ http://thierry-roncalli.com/download/erc.pdf
123117
124118
.. code:: ipython3
125119
126-
res_target.get_security_weights().plot()
127-
128-
129-
130-
131-
.. parsed-literal::
132-
:class: pynb-result
133-
134-
<AxesSubplot:>
135-
120+
res_target.get_security_weights().plot();
136121
137122
138123
139-
.. image:: _static/ERC_6_1.png
124+
.. image:: _static/ERC_7_0.png
140125
:class: pynb
141-
:width: 372px
142-
:height: 259px
126+
:width: 373px
127+
:height: 262px
143128

144129

145130
.. code:: ipython3
146131
147-
res_target.prices.plot()
132+
res_target.prices.plot();
148133
149134
150135
151-
152-
.. parsed-literal::
153-
:class: pynb-result
154-
155-
<AxesSubplot:>
156-
157-
158-
159-
160-
.. image:: _static/ERC_7_1.png
136+
.. image:: _static/ERC_8_0.png
161137
:class: pynb
162-
:width: 375px
163-
:height: 260px
138+
:width: 376px
139+
:height: 264px
164140

165141

166142
.. code:: ipython3
@@ -182,25 +158,17 @@ http://thierry-roncalli.com/download/erc.pdf
182158
fig, ax = plt.subplots(nrows=1,ncols=1)
183159
trc_target.plot(ax=ax)
184160
ax.set_title('Total Risk Contribution')
185-
ax.plot()
186-
161+
ax.plot();
187162
188163
189164
190165
191-
.. parsed-literal::
192-
:class: pynb-result
193-
194-
[]
195-
196-
197-
198-
199-
.. image:: _static/ERC_8_1.png
166+
.. image:: _static/ERC_9_0.png
200167
:class: pynb
201-
:width: 385px
202-
:height: 274px
168+
:width: 386px
169+
:height: 277px
203170

204171

205172
You can see the Total Risk Contribution is roughly equal from both
206173
assets.
174+

0 commit comments

Comments
 (0)