mirror of
https://github.com/bspeice/speice.io
synced 2024-11-14 22:18:10 -05:00
Another conversion
This commit is contained in:
parent
be9cb0e9c3
commit
212d213359
3974
blog/2015-11-27-autocallable/2015-11-27-autocallable.ipynb
Normal file
3974
blog/2015-11-27-autocallable/2015-11-27-autocallable.ipynb
Normal file
File diff suppressed because one or more lines are too long
121
blog/2015-11-27-autocallable/2015-11-27-autocallable_12_0.svg
Normal file
121
blog/2015-11-27-autocallable/2015-11-27-autocallable_12_0.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 81 KiB |
121
blog/2015-11-27-autocallable/2015-11-27-autocallable_6_0.svg
Normal file
121
blog/2015-11-27-autocallable/2015-11-27-autocallable_6_0.svg
Normal file
@ -0,0 +1,121 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:gadfly="http://www.gadflyjl.org/ns"
|
||||
version="1.2"
|
||||
width="141.42mm" height="100mm" viewBox="0 0 141.42 100"
|
||||
stroke="none"
|
||||
fill="#000000"
|
||||
stroke-width="0.3"
|
||||
font-size="3.88"
|
||||
>
|
||||
<g class="plotroot xscalable yscalable" id="fig-5f2bef255c9640798a762cea30b280d2-element-1">
|
||||
<g font-size="3.88" font-family="'PT Sans','Helvetica Neue','Helvetica',sans-serif" fill="#564A55" stroke="#000000" stroke-opacity="0.000" id="fig-5f2bef255c9640798a762cea30b280d2-element-2">
|
||||
<text x="73.61" y="88.39" text-anchor="middle" dy="0.6em">Months</text>
|
||||
</g>
|
||||
<g class="guide colorkey" id="fig-5f2bef255c9640798a762cea30b280d2-element-3">
|
||||
<g font-size="2.82" font-family="'PT Sans','Helvetica Neue','Helvetica',sans-serif" fill="#4C404B" id="fig-5f2bef255c9640798a762cea30b280d2-element-4">
|
||||
<text x="131.9" y="66.46" dy="0.35em">1</text>
|
||||
<text x="131.9" y="39.15" dy="0.35em">5</text>
|
||||
<text x="131.9" y="59.63" dy="0.35em">2</text>
|
||||
<text x="131.9" y="52.81" dy="0.35em">3</text>
|
||||
<text x="131.9" y="45.98" dy="0.35em">4</text>
|
||||
</g>
|
||||
<g shape-rendering="crispEdges" stroke="#000000" stroke-opacity="0.000" id="fig-5f2bef255c9640798a762cea30b280d2-element-5">
|
||||
<rect x="129.58" y="65.78" width="1.31" height="0.68" fill="#004D84"/>
|
||||
<rect x="129.58" y="65.1" width="1.31" height="0.68" fill="#005B8D"/>
|
||||
<rect x="129.58" y="64.41" width="1.31" height="0.68" fill="#006995"/>
|
||||
<rect x="129.58" y="63.73" width="1.31" height="0.68" fill="#00769D"/>
|
||||
<rect x="129.58" y="63.05" width="1.31" height="0.68" fill="#0083A3"/>
|
||||
<rect x="129.58" y="62.36" width="1.31" height="0.68" fill="#278FA9"/>
|
||||
<rect x="129.58" y="61.68" width="1.31" height="0.68" fill="#409BAF"/>
|
||||
<rect x="129.58" y="61" width="1.31" height="0.68" fill="#55A7B5"/>
|
||||
<rect x="129.58" y="60.32" width="1.31" height="0.68" fill="#69B2BA"/>
|
||||
<rect x="129.58" y="59.63" width="1.31" height="0.68" fill="#7BBCC0"/>
|
||||
<rect x="129.58" y="58.95" width="1.31" height="0.68" fill="#8DC6C5"/>
|
||||
<rect x="129.58" y="58.27" width="1.31" height="0.68" fill="#9ED0CB"/>
|
||||
<rect x="129.58" y="57.59" width="1.31" height="0.68" fill="#A5CFC7"/>
|
||||
<rect x="129.58" y="56.9" width="1.31" height="0.68" fill="#ABCEC4"/>
|
||||
<rect x="129.58" y="56.22" width="1.31" height="0.68" fill="#B1CCC2"/>
|
||||
<rect x="129.58" y="55.54" width="1.31" height="0.68" fill="#B5CCC1"/>
|
||||
<rect x="129.58" y="54.85" width="1.31" height="0.68" fill="#B7CBBF"/>
|
||||
<rect x="129.58" y="54.17" width="1.31" height="0.68" fill="#B9CBBD"/>
|
||||
<rect x="129.58" y="53.49" width="1.31" height="0.68" fill="#BBCBBB"/>
|
||||
<rect x="129.58" y="52.81" width="1.31" height="0.68" fill="#BDCABA"/>
|
||||
<rect x="129.58" y="52.12" width="1.31" height="0.68" fill="#BFCAB8"/>
|
||||
<rect x="129.58" y="51.44" width="1.31" height="0.68" fill="#C2C9B7"/>
|
||||
<rect x="129.58" y="50.76" width="1.31" height="0.68" fill="#C4C9B6"/>
|
||||
<rect x="129.58" y="50.07" width="1.31" height="0.68" fill="#C6C8B5"/>
|
||||
<rect x="129.58" y="49.39" width="1.31" height="0.68" fill="#C9C7B4"/>
|
||||
<rect x="129.58" y="48.71" width="1.31" height="0.68" fill="#CCC7B2"/>
|
||||
<rect x="129.58" y="48.03" width="1.31" height="0.68" fill="#CFC6AE"/>
|
||||
<rect x="129.58" y="47.34" width="1.31" height="0.68" fill="#D4C5AA"/>
|
||||
<rect x="129.58" y="46.66" width="1.31" height="0.68" fill="#D8C3A6"/>
|
||||
<rect x="129.58" y="45.98" width="1.31" height="0.68" fill="#D3B79A"/>
|
||||
<rect x="129.58" y="45.3" width="1.31" height="0.68" fill="#CDAB8E"/>
|
||||
<rect x="129.58" y="44.61" width="1.31" height="0.68" fill="#C89E82"/>
|
||||
<rect x="129.58" y="43.93" width="1.31" height="0.68" fill="#C19177"/>
|
||||
<rect x="129.58" y="43.25" width="1.31" height="0.68" fill="#BA836C"/>
|
||||
<rect x="129.58" y="42.56" width="1.31" height="0.68" fill="#B27563"/>
|
||||
<rect x="129.58" y="41.88" width="1.31" height="0.68" fill="#AA665A"/>
|
||||
<rect x="129.58" y="41.2" width="1.31" height="0.68" fill="#A05752"/>
|
||||
<rect x="129.58" y="40.52" width="1.31" height="0.68" fill="#96484A"/>
|
||||
<rect x="129.58" y="39.83" width="1.31" height="0.68" fill="#8B3844"/>
|
||||
<rect x="129.58" y="39.15" width="1.31" height="0.68" fill="#7E273E"/>
|
||||
<g stroke="#FFFFFF" stroke-width="0.2" id="fig-5f2bef255c9640798a762cea30b280d2-element-6">
|
||||
<path fill="none" d="M129.58,66.46 L 130.9 66.46"/>
|
||||
<path fill="none" d="M129.58,39.15 L 130.9 39.15"/>
|
||||
<path fill="none" d="M129.58,59.63 L 130.9 59.63"/>
|
||||
<path fill="none" d="M129.58,52.81 L 130.9 52.81"/>
|
||||
<path fill="none" d="M129.58,45.98 L 130.9 45.98"/>
|
||||
</g>
|
||||
</g>
|
||||
<g fill="#362A35" font-size="3.88" font-family="'PT Sans','Helvetica Neue','Helvetica',sans-serif" stroke="#000000" stroke-opacity="0.000" id="fig-5f2bef255c9640798a762cea30b280d2-element-7">
|
||||
<text x="129.58" y="35.15">Color</text>
|
||||
</g>
|
||||
</g>
|
||||
<g clip-path="url(#fig-5f2bef255c9640798a762cea30b280d2-element-9)" id="fig-5f2bef255c9640798a762cea30b280d2-element-8">
|
||||
<g pointer-events="visible" opacity="1" fill="#000000" fill-opacity="0.000" stroke="#000000" stroke-opacity="0.000" class="guide background" id="fig-5f2bef255c9640798a762cea30b280d2-element-10">
|
||||
<rect x="19.63" y="5" width="107.95" height="80.39"/>
|
||||
</g>
|
||||
<g class="guide ygridlines xfixed" stroke-dasharray="0.5,0.5" stroke-width="0.2" stroke="#D0D0E0" id="fig-5f2bef255c9640798a762cea30b280d2-element-11">
|
||||
<path fill="none" d="M19.63,83.39 L 127.58 83.39"/>
|
||||
<path fill="none" d="M19.63,68.11 L 127.58 68.11"/>
|
||||
<path fill="none" d="M19.63,52.83 L 127.58 52.83"/>
|
||||
<path fill="none" d="M19.63,37.56 L 127.58 37.56"/>
|
||||
<path fill="none" d="M19.63,22.28 L 127.58 22.28"/>
|
||||
<path fill="none" d="M19.63,7 L 127.58 7"/>
|
||||
</g>
|
||||
<g class="guide xgridlines yfixed" stroke-dasharray="0.5,0.5" stroke-width="0.2" stroke="#D0D0E0" id="fig-5f2bef255c9640798a762cea30b280d2-element-12">
|
||||
<path fill="none" d="M55.93,5 L 55.93 85.39"/>
|
||||
<path fill="none" d="M90.76,5 L 90.76 85.39"/>
|
||||
<path fill="none" d="M125.58,5 L 125.58 85.39"/>
|
||||
</g>
|
||||
<g class="plotpanel" id="fig-5f2bef255c9640798a762cea30b280d2-element-13">
|
||||
<g stroke-width="0.3" fill="#000000" fill-opacity="0.000" stroke-dasharray="none" id="fig-5f2bef255c9640798a762cea30b280d2-element-14">
|
||||
<path fill="none" d="M21.63,61.39 L 22.15 63.01 22.68 64.88 23.2 65.75 23.72 65.53 24.24 66.19 24.77 65.44 25.29 64.6 25.81 62.6 26.33 64.24 26.86 63.14 27.38 62.41 27.9 61.76 28.42 60.15 28.94 59.51 29.47 59.43 29.99 57.05 30.51 57.31 31.03 58.76 31.56 60.04 32.08 59.29 32.6 56.95 33.12 58.64 33.65 58.8 34.17 60.04 34.69 61.19 35.21 60.49 35.74 58.06 36.26 59.33 36.78 59.15 37.3 60.03 37.83 57.9 38.35 60.9 38.87 60.47 39.39 61.8 39.91 62.99 40.44 62.59 40.96 62.85 41.48 61.37 42 60.8 42.53 60.36 43.05 61.74 43.57 59.57 44.09 63.47 44.62 65.21 45.14 64.53 45.66 61.4 46.18 60.13 46.71 58.91 47.23 57.72 47.75 55.68 48.27 54.24 48.8 52.75 49.32 51.15 49.84 51.7 50.36 51.13 50.88 50.26 51.41 50.58 51.93 49.94 52.45 49.43 52.97 47.26 53.5 47.63 54.02 43.28 54.54 41.73 55.06 38.71 55.59 36.85 56.11 38.83 56.63 40.76 57.15 40.38 57.68 38.32 58.2 40.53 58.72 41.71 59.24 45.53 59.77 44.75 60.29 42.69 60.81 43.54 61.33 47.48 61.85 46.26 62.38 49.17 62.9 51.72 63.42 51.08 63.94 48.32 64.47 49.22 64.99 46.99 65.51 45.37 66.03 44.84 66.56 49.23 67.08 49.47 67.6 48.5 68.12 48.55 68.65 50.2 69.17 52.04 69.69 48.28 70.21 49.14 70.74 47.87 71.26 44.77 71.78 45.94 72.3 46.46 72.82 48.27 73.35 45.57 73.87 44.73 74.39 44.69 74.91 41.97 75.44 42.75 75.96 42.73 76.48 42.15 77 42.15 77.53 42.06 78.05 42.3 78.57 42.05 79.09 38.58 79.62 37.43 80.14 37.45 80.66 37.58 81.18 37.02 81.71 37.77 82.23 34.18 82.75 34.92 83.27 34.3 83.79 31.3 84.32 30.74 84.84 31.04 85.36 33.45 85.88 37.48 86.41 40.9 86.93 38.85 87.45 40.71 87.97 39.53 88.5 37.84 89.02 35.57 89.54 34.28 90.06 32.61 90.59 31.25 91.11 31.69 91.63 30.35 92.15 28.63 92.67 32.02 93.2 31.58 93.72 31.03 94.24 30.32 94.76 33.63 95.29 37.51 95.81 38.21 96.33 38.63 96.85 39 97.38 38.02 97.9 39.92 98.42 41.11 98.94 41.89 99.47 40.85 99.99 39.33 100.51 36.48 101.03 37.12 101.56 33.6 102.08 33.78 102.6 30.27 103.12 29.93 103.64 26.12 104.17 26.05 104.69 24.24 105.21 25.87 105.73 27.08 106.26 25.68 106.78 28.93 107.3 28.27 107.82 29.74 108.35 29.07 108.87 27.61 109.39 28.83 109.91 27.94 110.44 24.59 110.96 21.98 111.48 23.57 112 22.27 112.53 23.76 113.05 24.49 113.57 24.01 114.09 27.19 114.61 29.62 115.14 30.47 115.66 31.48 116.18 34.04 116.7 29.61 117.23 29.29 117.75 31.04 118.27 29.64 118.79 32.69 119.32 33.45 119.84 35.26 120.36 36.97 120.88 36.6 121.41 37.29 121.93 39.06 122.45 38.48 122.97 39.26 123.5 39.98 124.02 38.69 124.54 38.15 125.06 37.06 125.58 39.61" class="geometry color_" stroke="#004D84"/>
|
||||
<path fill="none" d="M21.63,61.39 L 22.15 61.55 22.68 59.53 23.2 62.63 23.72 61.1 24.24 60.87 24.77 63.38 25.29 63.77 25.81 65.57 26.33 63.22 26.86 63.73 27.38 63.29 27.9 60.76 28.42 60.09 28.94 60 29.47 58.56 29.99 59.7 30.51 59.73 31.03 57.99 31.56 58.25 32.08 60.02 32.6 63.02 33.12 63.52 33.65 64.28 34.17 63.56 34.69 65.89 35.21 65.14 35.74 64.68 36.26 61.26 36.78 60.1 37.3 58.77 37.83 58.54 38.35 59.44 38.87 61.08 39.39 59.79 39.91 59.06 40.44 59.77 40.96 58.28 41.48 60.23 42 59.88 42.53 55.28 43.05 58.62 43.57 58.51 44.09 58.98 44.62 56.77 45.14 54.9 45.66 55.78 46.18 55.1 46.71 56.55 47.23 58.27 47.75 56.82 48.27 56.24 48.8 54.06 49.32 56.41 49.84 55.68 50.36 58.5 50.88 57.87 51.41 58.81 51.93 59.87 52.45 61.56 52.97 65.32 53.5 65.49 54.02 65.91 54.54 67.73 55.06 66.87 55.59 67.38 56.11 64.09 56.63 63.02 57.15 63.89 57.68 62.49 58.2 61.84 58.72 63.22 59.24 62.02 59.77 62.72 60.29 62.27 60.81 62.55 61.33 58.97 61.85 57.07 62.38 60.9 62.9 61.93 63.42 61.82 63.94 61.85 64.47 61.73 64.99 62.68 65.51 64.04 66.03 61.26 66.56 62.96 67.08 64.38 67.6 65.88 68.12 66.68 68.65 68.22 69.17 67.78 69.69 69.38 70.21 70.75 70.74 72.39 71.26 70.94 71.78 72.08 72.3 72.27 72.82 73.58 73.35 73.74 73.87 72.35 74.39 72.22 74.91 74.12 75.44 75.3 75.96 74.87 76.48 75.32 77 74.8 77.53 74.11 78.05 74.5 78.57 69.69 79.09 72.14 79.62 69.69 80.14 69.75 80.66 69.51 81.18 71.33 81.71 73.9 82.23 72.82 82.75 70.59 83.27 71.59 83.79 71.58 84.32 71.71 84.84 69.86 85.36 70.05 85.88 69.15 86.41 72.2 86.93 69.53 87.45 70.69 87.97 70.15 88.5 69.51 89.02 67.76 89.54 67.41 90.06 67.64 90.59 67.5 91.11 68.27 91.63 68.42 92.15 68.23 92.67 68.39 93.2 68.47 93.72 69.07 94.24 71.95 94.76 74.34 95.29 75.63 95.81 74.08 96.33 71.92 96.85 71.36 97.38 71.17 97.9 68.55 98.42 70.43 98.94 71.01 99.47 70.5 99.99 69.72 100.51 69.93 101.03 66.34 101.56 64.29 102.08 67.1 102.6 68.99 103.12 70.73 103.64 67.44 104.17 68.72 104.69 71.08 105.21 70.44 105.73 71.41 106.26 69.46 106.78 67.03 107.3 66.86 107.82 68.11 108.35 67.18 108.87 67.67 109.39 66.77 109.91 67.01 110.44 65.42 110.96 66.32 111.48 68.51 112 68.31 112.53 66.43 113.05 67.65 113.57 68.46 114.09 67.9 114.61 69.27 115.14 65.25 115.66 63.92 116.18 63.66 116.7 62.69 117.23 62.57 117.75 63.19 118.27 64.28 118.79 61.75 119.32 62.08 119.84 62.38 120.36 62.89 120.88 61.83 121.41 60.06 121.93 58.9 122.45 57.83 122.97 56.53 123.5 58.83 124.02 57.9 124.54 59.82 125.06 59.66 125.58 60.89" class="geometry color_" stroke="#7E273E"/>
|
||||
<path fill="none" d="M21.63,61.39 L 22.15 62.01 22.68 62.12 23.2 64.62 23.72 64.89 24.24 60.83 24.77 58.38 25.29 57.87 25.81 59.4 26.33 59.29 26.86 58.42 27.38 58.88 27.9 61.48 28.42 61.57 28.94 63.47 29.47 63.35 29.99 64.6 30.51 66.75 31.03 67.31 31.56 66.27 32.08 66.88 32.6 66.7 33.12 68.45 33.65 68.23 34.17 69.78 34.69 70.71 35.21 68.96 35.74 71.3 36.26 71.51 36.78 72.6 37.3 71.53 37.83 68.39 38.35 67.9 38.87 68.04 39.39 66.79 39.91 65.4 40.44 66.69 40.96 66.18 41.48 65.4 42 63.44 42.53 61.3 43.05 63.19 43.57 61.69 44.09 58.24 44.62 57.65 45.14 56.99 45.66 58.92 46.18 58.42 46.71 57.78 47.23 56.04 47.75 55.47 48.27 53.63 48.8 50.38 49.32 50.16 49.84 47.49 50.36 46.04 50.88 45.37 51.41 45.88 51.93 46.2 52.45 48.8 52.97 46.81 53.5 47.41 54.02 44.95 54.54 42.2 55.06 40.28 55.59 40.95 56.11 41.25 56.63 42.26 57.15 45.49 57.68 49.57 58.2 51.75 58.72 51.28 59.24 50.92 59.77 50.58 60.29 49.25 60.81 48.75 61.33 50.04 61.85 51.83 62.38 56.12 62.9 58.24 63.42 53.76 63.94 48.49 64.47 49.53 64.99 48.91 65.51 47.5 66.03 44.98 66.56 45.34 67.08 45.47 67.6 47.09 68.12 45.28 68.65 46.64 69.17 46.73 69.69 47.31 70.21 41.61 70.74 40.78 71.26 39.14 71.78 38.12 72.3 38.34 72.82 38.18 73.35 38.73 73.87 38.42 74.39 38.55 74.91 38.09 75.44 37.59 75.96 37.78 76.48 35.41 77 31.8 77.53 33.17 78.05 33.1 78.57 31.68 79.09 33.07 79.62 34.53 80.14 34.08 80.66 33.6 81.18 32.97 81.71 32.22 82.23 32.64 82.75 35.43 83.27 36.8 83.79 37.78 84.32 39.79 84.84 40.84 85.36 40.79 85.88 37.93 86.41 34.02 86.93 33.81 87.45 34.55 87.97 32.24 88.5 29.77 89.02 29.49 89.54 34.31 90.06 34.92 90.59 36.37 91.11 33.74 91.63 37.64 92.15 36.01 92.67 39.21 93.2 39.67 93.72 38.94 94.24 41.03 94.76 42.02 95.29 41.38 95.81 40.65 96.33 41.11 96.85 42.33 97.38 41.38 97.9 39.81 98.42 37.69 98.94 38.54 99.47 35.99 99.99 35.41 100.51 38.56 101.03 38.77 101.56 40.05 102.08 42.32 102.6 43.14 103.12 43.52 103.64 46.7 104.17 45.1 104.69 43.26 105.21 42.06 105.73 45.01 106.26 44.86 106.78 43.66 107.3 43.57 107.82 43.53 108.35 44.76 108.87 44.65 109.39 46.06 109.91 44.57 110.44 49.26 110.96 49.18 111.48 51.74 112 51.36 112.53 52.06 113.05 55.72 113.57 57.48 114.09 59.83 114.61 61.84 115.14 63.48 115.66 63.61 116.18 62.01 116.7 62.46 117.23 62.32 117.75 63.34 118.27 61.52 118.79 61.6 119.32 59.09 119.84 61.22 120.36 62.07 120.88 62.68 121.41 64.73 121.93 65.46 122.45 63.95 122.97 63.8 123.5 65.66 124.02 63.97 124.54 62.93 125.06 62.62 125.58 59.34" class="geometry color_" stroke="#88C4C4"/>
|
||||
<path fill="none" d="M21.63,61.39 L 22.15 61.13 22.68 60.81 23.2 62.02 23.72 62.26 24.24 60.5 24.77 57.82 25.29 56.74 25.81 56.51 26.33 58.2 26.86 60.28 27.38 61.78 27.9 58.53 28.42 57.05 28.94 57.46 29.47 56.25 29.99 55.53 30.51 56.65 31.03 57.59 31.56 54.25 32.08 55.32 32.6 56.21 33.12 59.52 33.65 59.2 34.17 60.8 34.69 62.11 35.21 62.65 35.74 63.18 36.26 65.53 36.78 62.71 37.3 61.28 37.83 62.17 38.35 64.09 38.87 65.57 39.39 68.22 39.91 69.83 40.44 71.7 40.96 72.83 41.48 72.38 42 73.06 42.53 75.36 43.05 74.31 43.57 72.7 44.09 72.32 44.62 72.66 45.14 71.6 45.66 70.6 46.18 71.62 46.71 70.85 47.23 71.92 47.75 72.63 48.27 70.05 48.8 70.08 49.32 66.73 49.84 67.47 50.36 66.88 50.88 69.37 51.41 68.11 51.93 68.23 52.45 68.51 52.97 68.65 53.5 68.56 54.02 70.73 54.54 69.14 55.06 69.57 55.59 69.92 56.11 72.37 56.63 73.95 57.15 73.32 57.68 73.92 58.2 73.39 58.72 73.43 59.24 73.68 59.77 74.47 60.29 72.03 60.81 72.45 61.33 73.14 61.85 73.15 62.38 71.74 62.9 69.85 63.42 70.7 63.94 71.26 64.47 72.88 64.99 74.1 65.51 70.79 66.03 70.7 66.56 70.99 67.08 70.58 67.6 69.57 68.12 68.88 68.65 70.25 69.17 68.44 69.69 66.43 70.21 66.82 70.74 67.93 71.26 66.66 71.78 68.22 72.3 67.71 72.82 70.26 73.35 69.76 73.87 70.48 74.39 68.83 74.91 69.78 75.44 69.89 75.96 73.59 76.48 67.68 77 68.15 77.53 64.77 78.05 62.61 78.57 63.48 79.09 64.13 79.62 63.34 80.14 64.97 80.66 66.9 81.18 67.84 81.71 65.25 82.23 65.96 82.75 68.01 83.27 67.94 83.79 67.69 84.32 67.66 84.84 65.74 85.36 66.5 85.88 66.92 86.41 66.41 86.93 68.51 87.45 71.01 87.97 71.21 88.5 72.5 89.02 73.18 89.54 70.08 90.06 72.06 90.59 74.8 91.11 74.42 91.63 75.56 92.15 73.31 92.67 74.09 93.2 75.35 93.72 74.34 94.24 77.32 94.76 74.76 95.29 72.97 95.81 71.55 96.33 72.98 96.85 75.64 97.38 75.6 97.9 76.73 98.42 74.28 98.94 73.56 99.47 73.22 99.99 74.74 100.51 74.37 101.03 73.72 101.56 75.73 102.08 76.29 102.6 75.49 103.12 74.57 103.64 76.28 104.17 75.11 104.69 74.66 105.21 77.83 105.73 80.01 106.26 78.94 106.78 80.86 107.3 81.08 107.82 80.19 108.35 77.17 108.87 79.12 109.39 82.08 109.91 80.5 110.44 78.48 110.96 77.93 111.48 77.62 112 77.35 112.53 78.06 113.05 78 113.57 78.5 114.09 77.21 114.61 78.04 115.14 78.9 115.66 78.49 116.18 78.9 116.7 76.42 117.23 75.58 117.75 76.93 118.27 75.55 118.79 72.22 119.32 71.57 119.84 70.44 120.36 70.09 120.88 73.61 121.41 72.94 121.93 70.79 122.45 73.21 122.97 75.36 123.5 75.87 124.02 78.45 124.54 78.19 125.06 79.03 125.58 75.53" class="geometry color_" stroke="#BECAB9"/>
|
||||
<path fill="none" d="M21.63,61.39 L 22.15 62.55 22.68 62.37 23.2 63.25 23.72 63.25 24.24 64.02 24.77 65.99 25.29 69.66 25.81 71.24 26.33 70.93 26.86 70.19 27.38 71.55 27.9 73.13 28.42 70.7 28.94 73.34 29.47 72.47 29.99 71.56 30.51 71.95 31.03 71.63 31.56 71.16 32.08 73.57 32.6 73.55 33.12 76.27 33.65 73.77 34.17 73.68 34.69 73.68 35.21 76.32 35.74 78.54 36.26 78.59 36.78 78.96 37.3 79.49 37.83 81.13 38.35 81.3 38.87 81.14 39.39 82.98 39.91 80.8 40.44 80.57 40.96 79.64 41.48 81.32 42 78.97 42.53 79.94 43.05 82.18 43.57 81.76 44.09 80.36 44.62 79.69 45.14 78.74 45.66 76.71 46.18 74.35 46.71 73.54 47.23 75.11 47.75 75.3 48.27 72.13 48.8 71.57 49.32 73.81 49.84 70.57 50.36 70.7 50.88 69.51 51.41 67.7 51.93 68.7 52.45 68.49 52.97 67.36 53.5 68.38 54.02 68.57 54.54 69.48 55.06 67.24 55.59 67.91 56.11 68.49 56.63 69.85 57.15 70.98 57.68 72.27 58.2 72.59 58.72 72.89 59.24 71.74 59.77 74.72 60.29 75.85 60.81 76.74 61.33 76.47 61.85 78.94 62.38 80.68 62.9 79.33 63.42 79.29 63.94 80.75 64.47 78.89 64.99 75.99 65.51 76.3 66.03 75.83 66.56 74.26 67.08 73.28 67.6 73.07 68.12 76.32 68.65 79.61 69.17 78.24 69.69 79.84 70.21 78.28 70.74 79.19 71.26 80.4 71.78 82.76 72.3 81.01 72.82 78.82 73.35 80.8 73.87 79.4 74.39 79.97 74.91 79.62 75.44 78.4 75.96 80.89 76.48 80.82 77 80.98 77.53 78.76 78.05 78.89 78.57 78.74 79.09 78.77 79.62 79.58 80.14 80.03 80.66 79.16 81.18 78.87 81.71 77.29 82.23 79.92 82.75 80.48 83.27 76.93 83.79 74.47 84.32 75.54 84.84 73.87 85.36 72.13 85.88 69.8 86.41 70.82 86.93 71.83 87.45 73.26 87.97 72.86 88.5 74.19 89.02 72.37 89.54 70.28 90.06 70.37 90.59 71.36 91.11 69.93 91.63 67.03 92.15 69.87 92.67 66.08 93.2 65.76 93.72 65.11 94.24 65.89 94.76 66.82 95.29 67.4 95.81 66.67 96.33 65.37 96.85 66.11 97.38 66.54 97.9 68.48 98.42 69.86 98.94 66.92 99.47 66.68 99.99 68.42 100.51 71.29 101.03 69.59 101.56 67.99 102.08 67.6 102.6 68.79 103.12 68.83 103.64 72.71 104.17 69.46 104.69 68.62 105.21 64.75 105.73 66.78 106.26 64.76 106.78 67.81 107.3 70.4 107.82 70.97 108.35 72.14 108.87 72.67 109.39 72.77 109.91 74.44 110.44 75.67 110.96 77.33 111.48 76.89 112 75.27 112.53 73.3 113.05 75.32 113.57 74.37 114.09 76.24 114.61 75.89 115.14 72.65 115.66 72.29 116.18 70.49 116.7 71.87 117.23 69.1 117.75 70.16 118.27 66.35 118.79 65.95 119.32 67.92 119.84 67.88 120.36 68.62 120.88 69.89 121.41 68.68 121.93 65.93 122.45 64.6 122.97 64.63 123.5 64.11 124.02 65.81 124.54 63.74 125.06 61.66 125.58 61.11" class="geometry color_" stroke="#D2B497"/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g class="guide ylabels" font-size="2.82" font-family="'PT Sans Caption','Helvetica Neue','Helvetica',sans-serif" fill="#6C606B" id="fig-5f2bef255c9640798a762cea30b280d2-element-15">
|
||||
<text x="18.63" y="83.39" text-anchor="end" dy="0.35em">95</text>
|
||||
<text x="18.63" y="68.11" text-anchor="end" dy="0.35em">100</text>
|
||||
<text x="18.63" y="52.83" text-anchor="end" dy="0.35em">105</text>
|
||||
<text x="18.63" y="37.56" text-anchor="end" dy="0.35em">110</text>
|
||||
<text x="18.63" y="22.28" text-anchor="end" dy="0.35em">115</text>
|
||||
<text x="18.63" y="7" text-anchor="end" dy="0.35em">120</text>
|
||||
</g>
|
||||
<g font-size="3.88" font-family="'PT Sans','Helvetica Neue','Helvetica',sans-serif" fill="#564A55" stroke="#000000" stroke-opacity="0.000" id="fig-5f2bef255c9640798a762cea30b280d2-element-16">
|
||||
<text x="8.81" y="43.19" text-anchor="middle" dy="0.35em" transform="rotate(-90, 8.81, 45.19)">Value</text>
|
||||
</g>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="fig-5f2bef255c9640798a762cea30b280d2-element-9">
|
||||
<path d="M19.63,5 L 127.58 5 127.58 85.39 19.63 85.39" />
|
||||
</clipPath
|
||||
></defs>
|
||||
</svg>
|
After Width: | Height: | Size: 20 KiB |
459
blog/2015-11-27-autocallable/_notebook.md
Normal file
459
blog/2015-11-27-autocallable/_notebook.md
Normal file
@ -0,0 +1,459 @@
|
||||
```julia
|
||||
using Gadfly
|
||||
```
|
||||
|
||||
## Underlying simulation
|
||||
|
||||
In order to price the autocallable bonds, we need to simulate the underlying assets. Let's go ahead and set up the simulation first, as this lays the foundation for what we're trying to do. We're going to use [JNJ](http://finance.yahoo.com/q?s=jnj) as the basis for our simulation. This implies the following parameters:
|
||||
|
||||
- $S_0$ = \$102.2 (as of time of writing)
|
||||
- $q$ = 2.84%
|
||||
- $r$ = [.49, .9, 1.21, 1.45, 1.69] (term structure as of time of writing, linear interpolation)
|
||||
- $\mu$ = $r - q$ (note that this implies a negative drift because of current low rates)
|
||||
- $\sigma$ = $\sigma_{imp}$ = 15.62% (from VIX implied volatility)
|
||||
|
||||
We additionally define some parameters for simulation:
|
||||
|
||||
- `T`: The number of years to simulate
|
||||
- `m`: The number of paths to simulate
|
||||
- `n`: The number of steps to simulate in a year
|
||||
|
||||
|
||||
```julia
|
||||
S0 = 102.2
|
||||
nominal = 100
|
||||
q = 2.84 / 100
|
||||
σ = 15.37 / 100
|
||||
term = [0, .49, .9, 1.21, 1.45, 1.69] / 100 + 1
|
||||
|
||||
###
|
||||
# Potential: Based on PEP
|
||||
# S0 = 100.6
|
||||
# σ = 14.86
|
||||
# q = 2.7
|
||||
###
|
||||
|
||||
# Simulation parameters
|
||||
T = 5 # Using years as the unit of time
|
||||
n = 250 # simulations per year
|
||||
m = 100000 # paths
|
||||
num_simulations = 5; # simulation rounds per price
|
||||
```
|
||||
|
||||
```
|
||||
5
|
||||
```
|
||||
|
||||
### Defining the simulation
|
||||
To make things simpler, we simulate a single year at a time. This allows us to easily add in a dividend policy without too much difficulty, and update the simulation every year to match the term structure. The underlying uses GBM for simulation between years.
|
||||
|
||||
|
||||
```julia
|
||||
simulate_gbm = function(S0, μ, σ, T, n)
|
||||
# Set the initial state
|
||||
m = length(S0)
|
||||
t = T / n
|
||||
motion = zeros(m, n)
|
||||
motion[:,1] = S0
|
||||
|
||||
# Build out all states
|
||||
for i=1:(n-1)
|
||||
motion[:,i+1] = motion[:,i] .* exp((μ - σ^2/2)*t) .* exp(sqrt(t) * σ .* randn(m))
|
||||
end
|
||||
|
||||
return motion
|
||||
end
|
||||
|
||||
function display_motion(motion, T)
|
||||
# Given a matrix of paths, display the motion
|
||||
n = length(motion[1,:])
|
||||
m = length(motion[:,1])
|
||||
x = repmat(1:n, m)
|
||||
|
||||
# Calculate the ticks we're going to use. We'd like to
|
||||
# have an xtick every month, so calculate where those
|
||||
# ticks will actually be at.
|
||||
if (T > 3)
|
||||
num_ticks = T
|
||||
xlabel = "Years"
|
||||
else
|
||||
num_ticks = T * 12
|
||||
xlabel = "Months"
|
||||
end
|
||||
tick_width = n / num_ticks
|
||||
x_ticks = []
|
||||
for i=1:round(num_ticks)
|
||||
x_ticks = vcat(x_ticks, i*tick_width)
|
||||
end
|
||||
|
||||
# Use one color for each path. I'm not sure if there's
|
||||
# a better way to do this without going through DataFrames
|
||||
colors = []
|
||||
for i = 1:m
|
||||
colors = vcat(colors, ones(n)*i)
|
||||
end
|
||||
|
||||
plot(x=x, y=motion', color=colors, Geom.line,
|
||||
Guide.xticks(ticks=x_ticks, label=false),
|
||||
Guide.xlabel(xlabel),
|
||||
Guide.ylabel("Value"))
|
||||
end;
|
||||
```
|
||||
|
||||
### Example simulation
|
||||
|
||||
Let's go ahead and run a sample simulation to see what the functions got us!
|
||||
|
||||
|
||||
```julia
|
||||
initial = ones(5) * S0
|
||||
# Using μ=0, T=.25 for now, we'll use the proper values later
|
||||
motion = simulate_gbm(initial, 0, σ, .25, 200)
|
||||
|
||||
display_motion(motion, .25)
|
||||
```
|
||||
|
||||
![](./2015-11-27-autocallable_6_0.svg)
|
||||
|
||||
### Computing the term structure
|
||||
|
||||
Now that we've got the basic motion set up, let's start making things a bit more sophisticated for the model. We're going to assume that the drift of the stock is the difference between the implied forward rate and the quarterly dividend rate.
|
||||
|
||||
We're given the yearly term structure, and need to calculate the quarterly forward rate to match this structure. The term structure is assumed to follow:
|
||||
|
||||
$d(0, t) = d(0,t-1)\cdot f_{i-1, i}$
|
||||
|
||||
Where $f_{i-1, i}$ is the quarterly forward rate.
|
||||
|
||||
|
||||
```julia
|
||||
forward_term = function(yearly_term)
|
||||
# It is assumed that we have a yearly term structure passed in, and starts at year 0
|
||||
# This implies a nominal rate above 0 for the first year!
|
||||
years = length(term)-1 # because we start at 0
|
||||
structure = [(term[i+1] / term[i]) for i=1:years]
|
||||
end;
|
||||
```
|
||||
|
||||
### Illustrating the term structure
|
||||
|
||||
Now that we've got our term structure, let's validate that we're getting the correct results! If we've done this correctly, then:
|
||||
|
||||
```
|
||||
term[2] == term[1] * structure[1]
|
||||
```
|
||||
|
||||
|
||||
```julia
|
||||
# Example term structure taken from:
|
||||
# http://www.treasury.gov/resource-center/data-chart-center/interest-rates/Pages/TextView.aspx?data=yield
|
||||
# Linear interpolation used years in-between periods, assuming real-dollar
|
||||
# interest rates
|
||||
forward_yield = forward_term(term)
|
||||
calculated_term2 = term[1] * forward_yield[1]
|
||||
|
||||
println("Actual term[2]: $(term[2]); Calculated term[2]: $(calculated_term2)")
|
||||
```
|
||||
|
||||
```
|
||||
Actual term[2]: 1.0049; Calculated term[2]: 1.0049
|
||||
```
|
||||
|
||||
### The full underlying simulation
|
||||
|
||||
Now that we have the term structure set up, we can actually start doing some real simulation! Let's construct some paths through the full 5-year time frame. In order to do this, we will simulate 1 year at a time, and use the forward rates at those times to compute the drift. Thus, there will be 5 total simulations batched together.
|
||||
|
||||
|
||||
```julia
|
||||
full_motion = ones(5) * S0
|
||||
full_term = vcat(term[1], forward_yield)
|
||||
for i=1:T
|
||||
μ = (full_term[i] - 1 - q)
|
||||
year_motion = simulate_gbm(full_motion[:,end], μ, σ, 1, n)
|
||||
full_motion = hcat(full_motion, year_motion)
|
||||
end
|
||||
|
||||
display_motion(full_motion, T)
|
||||
```
|
||||
|
||||
![](./2015-11-27-autocallable_12_0.svg)
|
||||
|
||||
### Final simulation
|
||||
|
||||
We're now going to actually build out the full motion that we'll use for computing the pricing of our autocallable products. It will be largely the same, but we will use far more sample paths for the simulation.
|
||||
|
||||
|
||||
```julia
|
||||
full_simulation = function(S0, T, n, m, term)
|
||||
forward = vcat(term[1], forward_term(term))
|
||||
|
||||
# And an S0 to kick things off.
|
||||
final_motion = ones(m) * S0
|
||||
for i=1:T
|
||||
μ = (forward[i] - 1 - q)
|
||||
year_motion = simulate_gbm(final_motion[:,end], μ, σ, 1, n)
|
||||
final_motion = hcat(final_motion, year_motion)
|
||||
end
|
||||
return final_motion
|
||||
end
|
||||
|
||||
tic()
|
||||
full_simulation(S0, T, n, m, term)
|
||||
time = toq()
|
||||
@printf("Time to run simulation: %.2fs", time)
|
||||
```
|
||||
|
||||
```
|
||||
Time to run simulation: 5.34s
|
||||
```
|
||||
|
||||
## Athena Simulation
|
||||
|
||||
Now that we've defined our underlying simulation, let's actually try and price an Athena note. Athena has the following characteristics:
|
||||
|
||||
- Automatically called if the underlying is above the **call barrier** at observation
|
||||
- Accelerated coupon paid if the underlying is above the **call barrier** at observation
|
||||
- The coupon paid is $c \cdot i$ with $i$ as the current year, and $c$ the coupon rate
|
||||
- Principle protection up until a **protection barrier** at observation; All principle at risk if this barrier not met
|
||||
- Observed yearly
|
||||
|
||||
|
||||
```julia
|
||||
call_barrier = S0
|
||||
strike = S0
|
||||
protection_barrier = S0 * .6
|
||||
coupon = nominal * .07
|
||||
|
||||
price_athena = function(initial_price, year_prices, call_barrier,
|
||||
protection_barrier, coupon, forward_structure)
|
||||
|
||||
total_coupons = 0
|
||||
|
||||
t = length(year_prices)
|
||||
|
||||
for i=1:t
|
||||
price = year_prices[i]
|
||||
if price ≥ call_barrier
|
||||
return (nominal + coupon*i) * exp((prod(forward_structure[i:end])-1)*(t-i))
|
||||
end
|
||||
end
|
||||
|
||||
# We've reached maturity, time to check capital protection
|
||||
if year_prices[end] > protection_barrier
|
||||
return nominal
|
||||
else
|
||||
put = (strike - year_prices[end]) / strike
|
||||
return nominal*(1-put)
|
||||
end
|
||||
end
|
||||
|
||||
forward_structure = forward_term(term)
|
||||
price_function = (year_prices) -> price_athena(S0, year_prices,
|
||||
call_barrier, protection_barrier, coupon, forward_structure)
|
||||
|
||||
athena = function()
|
||||
year_indexes = [n*i for i=1:T]
|
||||
motion = full_simulation(S0, T, n, m, term)
|
||||
payoffs = [price_function(motion[i, year_indexes]) for i=1:m]
|
||||
return mean(payoffs)
|
||||
end
|
||||
|
||||
mean_payoffs = zeros(num_simulations)
|
||||
for i=1:num_simulations
|
||||
tic()
|
||||
mean_payoffs[i] = athena()
|
||||
time = toq()
|
||||
@printf("Mean of simulation %i: \$%.4f; Simulation time: %.2fs\n", i, mean_payoffs[i], time)
|
||||
end
|
||||
|
||||
final_mean = mean(mean_payoffs)
|
||||
println("Mean over $num_simulations simulations: $(mean(mean_payoffs))")
|
||||
pv = final_mean * (exp(-(prod(forward_structure)-1)*T))
|
||||
@printf("Present value of Athena note: \$%.2f, notional: \$%.2f", pv, nominal)
|
||||
```
|
||||
|
||||
```
|
||||
Mean of simulation 1: $103.2805; Simulation time: 5.59s
|
||||
Mean of simulation 2: $103.3796; Simulation time: 5.05s
|
||||
Mean of simulation 3: $103.4752; Simulation time: 5.18s
|
||||
Mean of simulation 4: $103.4099; Simulation time: 5.37s
|
||||
Mean of simulation 5: $103.3260; Simulation time: 5.32s
|
||||
Mean over 5 simulations: 103.37421610015554
|
||||
Present value of Athena note: $95.00, notional: $100.00
|
||||
```
|
||||
|
||||
## Phoenix without Memory Simulation
|
||||
|
||||
Let's move into pricing a Phoenix without memory. It's very similar to the Athena production, with the exception that we introduce a coupon barrier so coupons are paid even when the underlying is below the initial price.
|
||||
|
||||
The Phoenix product has the following characteristics (example [here](https://www.rbccm.com/usstructurednotes/file-780079.pdf)):
|
||||
|
||||
- Automatically called if the underlying is above the **call barrier** at observation
|
||||
- Coupon paid if the underlying is above a **coupon barrier** at observation
|
||||
- Principle protection up until a **protection barrier** at observation; All principle at risk if this barrier not met
|
||||
- Observed yearly
|
||||
|
||||
Some example paths (all assume that a call barrier of the current price, and coupon barrier some level below that):
|
||||
|
||||
- At the end of year 1, the stock is above the call barrier; the note is called and you receive the value of the stock plus the coupon being paid.
|
||||
- At the end of year 1, the stock is above the coupon barrier, but not the call barrier; you receive the coupon. At the end of year 2, the stock is below the coupon barrier; you receive nothing. At the end of year 3, the stock is above the call barrier; the note is called and you receive the value of the stock plus a coupon for year 3.
|
||||
|
||||
We're going to re-use the same simulation, with the following parameters:
|
||||
|
||||
- Call barrier: 100%
|
||||
- Coupon barrier: 70%
|
||||
- Coupon: 6%
|
||||
- Capital protection until 70% (at maturity)
|
||||
|
||||
|
||||
```julia
|
||||
call_barrier = S0
|
||||
coupon_barrier = S0 * .8
|
||||
protection_barrier = S0 * .6
|
||||
coupon = nominal * .06
|
||||
|
||||
price_phoenix_no_memory = function(initial_price, year_prices, call_barrier, coupon_barrier,
|
||||
protection_barrier, coupon, forward_structure)
|
||||
|
||||
total_coupons = 0
|
||||
t = length(year_prices)
|
||||
|
||||
for i=1:t
|
||||
price = year_prices[i]
|
||||
if price ≥ call_barrier
|
||||
return (nominal + coupon + total_coupons)*exp((prod(forward_structure[i:end])-1)*(t-i))
|
||||
elseif price ≥ coupon_barrier
|
||||
total_coupons = total_coupons * exp(forward_structure[i]-1) + coupon
|
||||
else
|
||||
total_coupons *= exp(forward_structure[i]-1)
|
||||
end
|
||||
end
|
||||
|
||||
# We've reached maturity, time to check capital protection
|
||||
if year_prices[end] > protection_barrier
|
||||
return nominal + total_coupons
|
||||
else
|
||||
put = (strike - year_prices[end]) / strike
|
||||
return nominal*(1-put)
|
||||
end
|
||||
end
|
||||
|
||||
forward_structure = forward_term(term)
|
||||
price_function = (year_prices) -> price_phoenix_no_memory(S0, year_prices,
|
||||
call_barrier, coupon_barrier, protection_barrier, coupon, forward_structure)
|
||||
|
||||
phoenix_no_memory = function()
|
||||
year_indexes = [n*i for i=1:T]
|
||||
motion = full_simulation(S0, T, n, m, term)
|
||||
payoffs = [price_function(motion[i, year_indexes]) for i=1:m]
|
||||
return mean(payoffs)
|
||||
end
|
||||
|
||||
mean_payoffs = zeros(num_simulations)
|
||||
for i=1:num_simulations
|
||||
tic()
|
||||
mean_payoffs[i] = phoenix_no_memory()
|
||||
time = toq()
|
||||
@printf("Mean of simulation %i: \$%.4f; Simulation time: %.2fs\n", i, mean_payoffs[i], time)
|
||||
end
|
||||
|
||||
final_mean = mean(mean_payoffs)
|
||||
println("Mean over $num_simulations simulations: $(mean(mean_payoffs))")
|
||||
pv = final_mean * exp(-(prod(forward_structure)-1)*(T))
|
||||
@printf("Present value of Phoenix without memory note: \$%.2f", pv)
|
||||
```
|
||||
|
||||
```
|
||||
Mean of simulation 1: $106.0562; Simulation time: 5.72s
|
||||
Mean of simulation 2: $106.0071; Simulation time: 5.85s
|
||||
Mean of simulation 3: $105.9959; Simulation time: 5.87s
|
||||
Mean of simulation 4: $106.0665; Simulation time: 5.93s
|
||||
Mean of simulation 5: $106.0168; Simulation time: 5.81s
|
||||
Mean over 5 simulations: 106.02850857209883
|
||||
Present value of Phoenix without memory note: $97.44
|
||||
```
|
||||
|
||||
## Phoenix with Memory Simulation
|
||||
|
||||
The Phoenix with Memory structure is very similar to the Phoenix, but as the name implies, has a special "memory" property: **It remembers any coupons that haven't been paid at prior observation times, and pays them all if the underlying crosses the coupon barrier**. For example:
|
||||
- Note issued with 100% call barrier, 70% coupon barrier. At year 1, the underlying is at 50%, so no coupons are paid. At year 2, the underlying is at 80%, so coupons for both year 1 and 2 are paid, resulting in a double coupon.
|
||||
|
||||
You can also find an example [here](https://www.rbccm.com/usstructurednotes/file-781232.pdf).
|
||||
|
||||
Let's go ahead and set up the simulation! The parameters will be the same, but we can expect that the value will go up because of the memory attribute
|
||||
|
||||
|
||||
```julia
|
||||
call_barrier = S0
|
||||
coupon_barrier = S0 * .8
|
||||
protection_barrier = S0 * .6
|
||||
coupon = nominal * .07
|
||||
|
||||
price_phoenix_with_memory = function(initial_price, year_prices, call_barrier,
|
||||
coupon_barrier, protection_barrier, coupon, forward_structure)
|
||||
|
||||
last_coupon = 0
|
||||
total_coupons = 0
|
||||
|
||||
t = length(year_prices)
|
||||
|
||||
for i=1:t
|
||||
price = year_prices[i]
|
||||
if price > call_barrier
|
||||
return (nominal + coupon + total_coupons)*exp((prod(forward_structure[i:end])-1)*(t-i))
|
||||
elseif price > coupon_barrier
|
||||
####################################################################
|
||||
# The only difference between with/without memory is the below lines
|
||||
memory_coupons = (i - last_coupon) * coupon
|
||||
last_coupon = i
|
||||
total_coupons = total_coupons * exp(forward_structure[i]-1) + memory_coupons
|
||||
####################################################################
|
||||
else
|
||||
total_coupons *= exp(forward_structure[i]-1)
|
||||
end
|
||||
end
|
||||
|
||||
# We've reached maturity, time to check capital protection
|
||||
if year_prices[end] > protection_barrier
|
||||
return nominal + total_coupons
|
||||
else
|
||||
put = (strike - year_prices[end]) / strike
|
||||
return nominal*(1-put)
|
||||
end
|
||||
end
|
||||
|
||||
forward_structure = forward_term(term)
|
||||
price_function = (year_prices) -> price_phoenix_with_memory(S0, year_prices,
|
||||
call_barrier, coupon_barrier, protection_barrier, coupon, forward_structure)
|
||||
|
||||
phoenix_with_memory = function()
|
||||
year_indexes = [n*i for i=1:T]
|
||||
motion = full_simulation(S0, T, n, m, term)
|
||||
payoffs = [price_function(motion[i, year_indexes]) for i=1:m]
|
||||
return mean(payoffs)
|
||||
end
|
||||
|
||||
mean_payoffs = zeros(num_simulations)
|
||||
for i=1:num_simulations
|
||||
tic()
|
||||
mean_payoffs[i] = phoenix_with_memory()
|
||||
time = toq()
|
||||
@printf("Mean of simulation %i: \$%.4f; Simulation time: %.2fs\n",
|
||||
i, mean_payoffs[i], time)
|
||||
end
|
||||
|
||||
final_mean = mean(mean_payoffs)
|
||||
println("Mean over $num_simulations simulations: $(mean(mean_payoffs))")
|
||||
pv = final_mean * exp(-(prod(forward_structure)-1)*(T))
|
||||
@printf("Present value of Phoenix with memory note: \$%.2f", pv)
|
||||
```
|
||||
|
||||
```
|
||||
Mean of simulation 1: $108.8612; Simulation time: 5.89s
|
||||
Mean of simulation 2: $109.0226; Simulation time: 5.90s
|
||||
Mean of simulation 3: $108.9175; Simulation time: 5.92s
|
||||
Mean of simulation 4: $108.9426; Simulation time: 5.94s
|
||||
Mean of simulation 5: $108.8087; Simulation time: 6.06s
|
||||
Mean over 5 simulations: 108.91052564051816
|
||||
Present value of Phoenix with memory note: $100.09
|
||||
```
|
20
blog/2015-11-27-autocallable/index.mdx
Normal file
20
blog/2015-11-27-autocallable/index.mdx
Normal file
@ -0,0 +1,20 @@
|
||||
---
|
||||
title: Autocallable Bonds
|
||||
date: 2015-11-27
|
||||
slug: 2015/11/autocallable
|
||||
authors: [bspeice]
|
||||
tags: []
|
||||
---
|
||||
|
||||
import Notebook from './_notebook.md'
|
||||
|
||||
For a final project, my group was tasked with understanding three exotic derivatives: The Athena, Phoenix without memory, and Phoenix with memory autocallable products.
|
||||
|
||||
<!-- truncate -->
|
||||
|
||||
My only non-core class this semester has been in Structure Products. We've been surveying a wide variety of products, and the final project was to pick one to report on.
|
||||
Because these are all very similar, we decided to demonstrate all 3 products at once.
|
||||
|
||||
What follows below is a notebook demonstrating the usage of [Julia](http://julialang.com) for Monte-Carlo simulation of some exotic products.
|
||||
|
||||
<Notebook/>
|
@ -80,6 +80,7 @@ const config: Config = {
|
||||
prism: {
|
||||
theme: prismThemes.oneLight,
|
||||
darkTheme: prismThemes.oneDark,
|
||||
additionalLanguages: ['julia']
|
||||
},
|
||||
} satisfies Preset.ThemeConfig,
|
||||
plugins: [require.resolve('docusaurus-lunr-search')],
|
||||
|
Loading…
Reference in New Issue
Block a user