Skip to content
This repository has been archived by the owner on Aug 29, 2024. It is now read-only.

Commit

Permalink
upgrade to v0.7.1 - replace None check with isNull (#376)
Browse files Browse the repository at this point in the history
* upgrade to v0.7.1 - replace None check with isNull

* Remove data comment for XVA
  • Loading branch information
HuifangYeo committed Oct 31, 2022
1 parent e392981 commit 7faff00
Show file tree
Hide file tree
Showing 29 changed files with 3,769 additions and 4,555 deletions.
212 changes: 114 additions & 98 deletions notebooks/01-use-cases/finance/front-office/cumulative-pnl/main.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -89,71 +89,71 @@
" </tr>\n",
" <tr>\n",
" <th>2021-02-05</th>\n",
" <th>bm_02_05_0_a</th>\n",
" <th>ra_02_05_0</th>\n",
" <th>CH0258404455_yhfds</th>\n",
" <th>Benchmark</th>\n",
" <td>9909</td>\n",
" <td>-430.8</td>\n",
" <td>-0.959</td>\n",
" <th>a_02_05_5_a</th>\n",
" <th>ra_02_05_5</th>\n",
" <th>CH0131078435_hwkqu</th>\n",
" <th>Active</th>\n",
" <td>-5212</td>\n",
" <td>402.9</td>\n",
" <td>0.855</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2020-01-31</th>\n",
" <th>a_03_05_11_a</th>\n",
" <th>ra_03_05_11</th>\n",
" <th>CH0187695553_5walc</th>\n",
" <th>Active</th>\n",
" <td>-4025</td>\n",
" <td>660.7</td>\n",
" <td>-0.925</td>\n",
" <th>bm_02_04_2_a</th>\n",
" <th>ra_02_04_2</th>\n",
" <th>CH0193040604_ztgq4</th>\n",
" <th>Benchmark</th>\n",
" <td>1877</td>\n",
" <td>-481.0</td>\n",
" <td>-0.279</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"2\" valign=\"top\">2021-02-05</th>\n",
" <th>ra_01_02_3</th>\n",
" <th>ra_01_02_3</th>\n",
" <th>CH0238053125_l2ddb</th>\n",
" <th>Real Asset</th>\n",
" <td>6488</td>\n",
" <td>-110.3</td>\n",
" <td>1.926</td>\n",
" <th rowspan=\"2\" valign=\"top\">2021-02-08</th>\n",
" <th>a_01_01_10_c</th>\n",
" <th>ra_01_01_10</th>\n",
" <th>HK0004000045_wv6t6</th>\n",
" <th>Active</th>\n",
" <td>-655</td>\n",
" <td>-92.5</td>\n",
" <td>1.382</td>\n",
" </tr>\n",
" <tr>\n",
" <th>a_02_05_7_b</th>\n",
" <th>ra_02_05_7</th>\n",
" <th>HK1097008929_c33f4</th>\n",
" <th>Active</th>\n",
" <td>-10870</td>\n",
" <td>-324.5</td>\n",
" <td>0.009</td>\n",
" <th>bm_03_05_0_b</th>\n",
" <th>ra_03_05_0</th>\n",
" <th>TW0006285000_ktl0j</th>\n",
" <th>Benchmark</th>\n",
" <td>717</td>\n",
" <td>-123.5</td>\n",
" <td>1.755</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Size \\\n",
"AsOfDate Portfolio ID Real Asset ID Instrument ID Portfolio Type \n",
"2020-01-31 a_02_2_b ra_02_2 US94974BEV80_ptz6d Active 4592 \n",
"2021-02-05 bm_02_05_0_a ra_02_05_0 CH0258404455_yhfds Benchmark 9909 \n",
"2020-01-31 a_03_05_11_a ra_03_05_11 CH0187695553_5walc Active -4025 \n",
"2021-02-05 ra_01_02_3 ra_01_02_3 CH0238053125_l2ddb Real Asset 6488 \n",
" a_02_05_7_b ra_02_05_7 HK1097008929_c33f4 Active -10870 \n",
" Size \\\n",
"AsOfDate Portfolio ID Real Asset ID Instrument ID Portfolio Type \n",
"2020-01-31 a_02_2_b ra_02_2 US94974BEV80_ptz6d Active 4592 \n",
"2021-02-05 a_02_05_5_a ra_02_05_5 CH0131078435_hwkqu Active -5212 \n",
"2020-01-31 bm_02_04_2_a ra_02_04_2 CH0193040604_ztgq4 Benchmark 1877 \n",
"2021-02-08 a_01_01_10_c ra_01_01_10 HK0004000045_wv6t6 Active -655 \n",
" bm_03_05_0_b ra_03_05_0 TW0006285000_ktl0j Benchmark 717 \n",
"\n",
" Investment \\\n",
"AsOfDate Portfolio ID Real Asset ID Instrument ID Portfolio Type \n",
"2020-01-31 a_02_2_b ra_02_2 US94974BEV80_ptz6d Active 327.5 \n",
"2021-02-05 bm_02_05_0_a ra_02_05_0 CH0258404455_yhfds Benchmark -430.8 \n",
"2020-01-31 a_03_05_11_a ra_03_05_11 CH0187695553_5walc Active 660.7 \n",
"2021-02-05 ra_01_02_3 ra_01_02_3 CH0238053125_l2ddb Real Asset -110.3 \n",
" a_02_05_7_b ra_02_05_7 HK1097008929_c33f4 Active -324.5 \n",
"2021-02-05 a_02_05_5_a ra_02_05_5 CH0131078435_hwkqu Active 402.9 \n",
"2020-01-31 bm_02_04_2_a ra_02_04_2 CH0193040604_ztgq4 Benchmark -481.0 \n",
"2021-02-08 a_01_01_10_c ra_01_01_10 HK0004000045_wv6t6 Active -92.5 \n",
" bm_03_05_0_b ra_03_05_0 TW0006285000_ktl0j Benchmark -123.5 \n",
"\n",
" Profit-and-loss \n",
"AsOfDate Portfolio ID Real Asset ID Instrument ID Portfolio Type \n",
"2020-01-31 a_02_2_b ra_02_2 US94974BEV80_ptz6d Active 2.798 \n",
"2021-02-05 bm_02_05_0_a ra_02_05_0 CH0258404455_yhfds Benchmark -0.959 \n",
"2020-01-31 a_03_05_11_a ra_03_05_11 CH0187695553_5walc Active -0.925 \n",
"2021-02-05 ra_01_02_3 ra_01_02_3 CH0238053125_l2ddb Real Asset 1.926 \n",
" a_02_05_7_b ra_02_05_7 HK1097008929_c33f4 Active 0.009 "
"2021-02-05 a_02_05_5_a ra_02_05_5 CH0131078435_hwkqu Active 0.855 \n",
"2020-01-31 bm_02_04_2_a ra_02_04_2 CH0193040604_ztgq4 Benchmark -0.279 \n",
"2021-02-08 a_01_01_10_c ra_01_01_10 HK0004000045_wv6t6 Active 1.382 \n",
" bm_03_05_0_b ra_03_05_0 TW0006285000_ktl0j Benchmark 1.755 "
]
},
"execution_count": 2,
Expand Down Expand Up @@ -233,52 +233,28 @@
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>US0567521085_m2102</th>\n",
" <td>Baidu.com Inc.</td>\n",
" <td>USD</td>\n",
" <td>Shares</td>\n",
" <td>N/A</td>\n",
" <td>USA</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>N/A</td>\n",
" <td>N/A</td>\n",
" </tr>\n",
" <tr>\n",
" <th>CNE1000003X6_d6j6z</th>\n",
" <td>Ping An Insurance Co.</td>\n",
" <th>KYG9829N1025_j35p4</th>\n",
" <td>Xinyi Solar Holdings Ltd</td>\n",
" <td>HKD</td>\n",
" <td>Shares</td>\n",
" <td>N/A</td>\n",
" <td>China</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>N/A</td>\n",
" <td>N/A</td>\n",
" </tr>\n",
" <tr>\n",
" <th>INE203G01027_hqj57</th>\n",
" <td>Indraprastha Gas Ltd</td>\n",
" <td>INR</td>\n",
" <td>Shares</td>\n",
" <td>N/A</td>\n",
" <td>India</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>N/A</td>\n",
" <td>N/A</td>\n",
" <td>1970-01-01</td>\n",
" <td>1970-01-01</td>\n",
" </tr>\n",
" <tr>\n",
" <th>KR7051910008_hsyls</th>\n",
" <td>Lg Chemical Ltd</td>\n",
" <td>KRW</td>\n",
" <th>SE0001174970_5fa37</th>\n",
" <td>Millicom Intl Cell./swed.dep.</td>\n",
" <td>SEK</td>\n",
" <td>Shares</td>\n",
" <td>N/A</td>\n",
" <td>South Korea</td>\n",
" <td>Luxembourg</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>N/A</td>\n",
" <td>N/A</td>\n",
" <td>1970-01-01</td>\n",
" <td>1970-01-01</td>\n",
" </tr>\n",
" <tr>\n",
" <th>DE000LEG1110_geusb</th>\n",
Expand All @@ -289,29 +265,69 @@
" <td>Germany</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>N/A</td>\n",
" <td>N/A</td>\n",
" <td>1970-01-01</td>\n",
" <td>1970-01-01</td>\n",
" </tr>\n",
" <tr>\n",
" <th>CH0278341224_77pjd</th>\n",
" <td>CS GR.FIN.GU 15-23</td>\n",
" <td>CHF</td>\n",
" <td>Bonds</td>\n",
" <td>CREDIT SUISSE GROUP FINANCE [Guernsey] Ltd.</td>\n",
" <td>Guernsey</td>\n",
" <td>1.0</td>\n",
" <td>NaN</td>\n",
" <td>2023-04-14</td>\n",
" <td>2015-04-15</td>\n",
" </tr>\n",
" <tr>\n",
" <th>US44932HAB96_t2twp</th>\n",
" <td>IBM CREDIT 17/21</td>\n",
" <td>USD</td>\n",
" <td>Bonds</td>\n",
" <td>IBM Credit LLC</td>\n",
" <td>USA</td>\n",
" <td>1.8</td>\n",
" <td>1.91</td>\n",
" <td>2021-01-20</td>\n",
" <td>2017-09-08</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Instrument Name Instrument Currency Instrument Type \\\n",
"Instrument ID \n",
"US0567521085_m2102 Baidu.com Inc. USD Shares \n",
"CNE1000003X6_d6j6z Ping An Insurance Co. HKD Shares \n",
"INE203G01027_hqj57 Indraprastha Gas Ltd INR Shares \n",
"KR7051910008_hsyls Lg Chemical Ltd KRW Shares \n",
"DE000LEG1110_geusb Leg Immobilien EUR Shares \n",
" Instrument Name Instrument Currency \\\n",
"Instrument ID \n",
"KYG9829N1025_j35p4 Xinyi Solar Holdings Ltd HKD \n",
"SE0001174970_5fa37 Millicom Intl Cell./swed.dep. SEK \n",
"DE000LEG1110_geusb Leg Immobilien EUR \n",
"CH0278341224_77pjd CS GR.FIN.GU 15-23 CHF \n",
"US44932HAB96_t2twp IBM CREDIT 17/21 USD \n",
"\n",
" Instrument Type \\\n",
"Instrument ID \n",
"KYG9829N1025_j35p4 Shares \n",
"SE0001174970_5fa37 Shares \n",
"DE000LEG1110_geusb Shares \n",
"CH0278341224_77pjd Bonds \n",
"US44932HAB96_t2twp Bonds \n",
"\n",
" Issuer Country \\\n",
"Instrument ID \n",
"KYG9829N1025_j35p4 N/A China \n",
"SE0001174970_5fa37 N/A Luxembourg \n",
"DE000LEG1110_geusb N/A Germany \n",
"CH0278341224_77pjd CREDIT SUISSE GROUP FINANCE [Guernsey] Ltd. Guernsey \n",
"US44932HAB96_t2twp IBM Credit LLC USA \n",
"\n",
" Issuer Country Coupon Yield Maturity Date Issue Date \n",
"Instrument ID \n",
"US0567521085_m2102 N/A USA NaN NaN N/A N/A \n",
"CNE1000003X6_d6j6z N/A China NaN NaN N/A N/A \n",
"INE203G01027_hqj57 N/A India NaN NaN N/A N/A \n",
"KR7051910008_hsyls N/A South Korea NaN NaN N/A N/A \n",
"DE000LEG1110_geusb N/A Germany NaN NaN N/A N/A "
" Coupon Yield Maturity Date Issue Date \n",
"Instrument ID \n",
"KYG9829N1025_j35p4 NaN NaN 1970-01-01 1970-01-01 \n",
"SE0001174970_5fa37 NaN NaN 1970-01-01 1970-01-01 \n",
"DE000LEG1110_geusb NaN NaN 1970-01-01 1970-01-01 \n",
"CH0278341224_77pjd 1.0 NaN 2023-04-14 2015-04-15 \n",
"US44932HAB96_t2twp 1.8 1.91 2021-01-20 2017-09-08 "
]
},
"execution_count": 3,
Expand Down Expand Up @@ -549,7 +565,7 @@
"m[\"Since Inception ROR\"].formatter = \"DOUBLE[#,##0.000%]\"\n",
"\n",
"m[\"MtD ROR\"] = tt.where(\n",
" l[\"Day\"] != None,\n",
" ~l[\"Day\"].isnull(),\n",
" (\n",
" tt.agg.prod(\n",
" m[\"Daily ROR + 1\"],\n",
Expand All @@ -561,7 +577,7 @@
"m[\"MtD ROR\"].formatter = \"DOUBLE[#,##0.000%]\"\n",
"\n",
"m[\"YtD ROR\"] = tt.where(\n",
" l[\"Day\"] != None,\n",
" ~l[\"Day\"].isnull(),\n",
" (\n",
" tt.agg.prod(\n",
" m[\"Daily ROR + 1\"],\n",
Expand All @@ -584,8 +600,8 @@
"application/vnd.atoti.link.v0+json": {
"path": "",
"sessionLocation": {
"https": null,
"port": 57540
"https": false,
"port": 50141
}
},
"text/plain": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3535,7 +3535,7 @@
"outputs": [],
"source": [
"m[\"NCD Years\"] = tt.where(\n",
" (l[\"NCD_YEARS\"] != None) & (l[\"PLAN_TYPE\"] != None),\n",
" (~l[\"NCD_YEARS\"].isnull()) & (~l[\"PLAN_TYPE\"].isnull()),\n",
" tt.agg.single_value(ncd_tbl[\"NCD_YEARS\"]),\n",
")\n",
"\n",
Expand Down Expand Up @@ -5241,7 +5241,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.12"
"version": "3.9.13"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 7faff00

Please sign in to comment.