In [13]:
# [Step 1] Set up the environment
import refinitiv.dataplatform as rdp
import datetime
import pandas as pd
rdp.open_desktop_session('DEFAULT_CODE_BOOK_APP_KEY')
Out[13]:
<refinitiv.dataplatform.core.session.desktop_session.DesktopSession at 0x1b9de4bb700>
In [19]:
# [Step 2] Using RDP Search API to retrieve the data
df = rdp.search(
    view = rdp.SearchViews.GovCorpInstruments,
    top = 10000,
    filter = "((DbType eq 'GOVT' or DbType eq 'CORP' or DbType eq 'AGNC' or DbType eq 'OMUN' or DbType eq 'OTHR') and IsActive eq true and (RCSParentDomicileGenealogy in ('G:53' 'G:3H') and RCSCurrencyLeaf eq 'US Dollar' and RCSCountryGenealogy ne 'M:DQ\G:B6'))",
    select = "RIC,RCSTRBC2012Leaf,IssueDate,EOMAmountOutstanding,PricingRedemDate,IssuerLegalName,PricingClosingYield, CurrentYield, FaceIssuedTotal,EOMPriceChange,RCSBondGradeLeaf,EOMPriceReturn"
)
display(df)
EOMAmountOutstanding RCSTRBC2012Leaf PricingRedemDate EOMPriceChange RCSBondGradeLeaf IssuerLegalName EOMPriceReturn CurrentYield PricingClosingYield FaceIssuedTotal IssueDate RIC
0 300000000.0 Real Estate Rental, Development & Operations (... <NA> 0.125 High Yield RKI Overseas Finance 2017 (A) Limited 0.158713 8.96 8.958019 300000000.0 2017-06-23T00:00:00.000Z BM163599660=
1 500000000.0 Corporate Financial Services (NEC) 2023-01-03T00:00:00.000Z 0.25 Investment Grade Franshion Brilliant Limited 0.253943 4.066074 5.969128 500000000.0 2017-07-03T00:00:00.000Z HK163733218=
2 300000000.0 Real Estate Rental, Development & Operations (... <NA> -0.75 High Yield CIFI HOLDINGS (GROUP) CO. LTD. 0.0 5.764075 10.897199 300000000.0 2017-08-24T00:00:00.000Z KY165347072=
3 775000000.0 Corporate Financial Services (NEC) 2022-09-14T00:00:00.000Z -0.375 Investment Grade Wei Chai Guo Ji (Xiang Gang) Neng Yuan Ji Tuan... -0.365631 3.722084 2.374339 775000000.0 2017-09-14T00:00:00.000Z CN167935001=
4 600000000.0 Commercial Buildings 2022-09-21T00:00:00.000Z -1.875 High Yield Sino-Ocean Land Treasure III Limited -2.350123 6.436782 60.04407 600000000.0 2017-09-21T00:00:00.000Z HK167702457=
... ... ... ... ... ... ... ... ... ... ... ... ...
5597 <NA> Corporate Financial Services (NEC) <NA> <NA> <NA> TEWOO GROUP FINANCE NO 3 LIMITED <NA> <NA> <NA> 300000000.0 2017-04-06T00:00:00.000Z CN158789434=
5598 <NA> Investment Banking & Brokerage Services (NEC) <NA> <NA> <NA> Nuoxi Capital Limited <NA> <NA> <NA> 300000000.0 2017-04-20T00:00:00.000Z CN159913279=
5599 500000000.0 Fossil Fuel Electric Utilities <NA> 0.0 <NA> Hua Chen Dian Li Gu Fen Gong Si <NA> <NA> <NA> 500000000.0 2017-05-18T00:00:00.000Z CN159317196=
5600 2247453000.0 Real Estate Rental, Development & Operations (... 2024-07-01T00:00:00.000Z -3.0 High Yield KAISA GROUP HOLDINGS LTD. -11.320755 39.893617 72.272454 3119000000.0 2017-06-30T00:00:00.000Z KY162759809=
5601 1147000000.0 Real Estate Rental, Development & Operations (... 2022-06-30T00:00:00.000Z -2.75 High Yield KAISA GROUP HOLDINGS LTD. -10.185185 35.051546 899.628866 1255000000.0 2017-06-30T00:00:00.000Z KY162759795=

5602 rows × 12 columns

In [20]:
# [Step 3] Visualize the Kungfu bonds
# 3.1 ) TRBC Pie
import plotly.express as px
rt = df.groupby("RCSTRBC2012Leaf",as_index=False).agg('count')
rt = rt.sort_values('RIC', ascending = False).head(10)
fig = px.pie(rt, values='RIC', names='RCSTRBC2012Leaf', title='TRBC Pie',color_discrete_sequence=px.colors.sequential.RdBu)
fig.show()