Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
fof
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dr.李
fof
Commits
05b0d095
Commit
05b0d095
authored
Nov 06, 2021
by
Dr.李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modified bonds
parent
e75c5c34
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
135 additions
and
776 deletions
+135
-776
030 债券型基金.ipynb
030 债券型基金.ipynb
+135
-776
No files found.
030 债券型基金.ipynb
View file @
05b0d095
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
"cells": [
"cells": [
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
1
,
"execution_count":
2
,
"id": "938912de-30f4-443b-8c1d-d9168c4a1d06",
"id": "938912de-30f4-443b-8c1d-d9168c4a1d06",
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [],
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
2
,
"execution_count":
3
,
"id": "ce3b53e6-60f3-48e5-9cdd-8a92cc70c6d7",
"id": "ce3b53e6-60f3-48e5-9cdd-8a92cc70c6d7",
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [],
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
58
,
"execution_count":
4
,
"id": "07275364-e308-433e-9c3a-fe78ad8e9daa",
"id": "07275364-e308-433e-9c3a-fe78ad8e9daa",
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [],
...
@@ -57,7 +57,7 @@
...
@@ -57,7 +57,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 5
9
,
"execution_count": 5,
"id": "5049fc82-e1ee-476a-9fb6-79adedb6028e",
"id": "5049fc82-e1ee-476a-9fb6-79adedb6028e",
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [],
...
@@ -77,7 +77,7 @@
...
@@ -77,7 +77,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 6
0
,
"execution_count": 6,
"id": "0c2416b1-4edb-45d9-a31a-11fb70344539",
"id": "0c2416b1-4edb-45d9-a31a-11fb70344539",
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [],
...
@@ -89,235 +89,65 @@
...
@@ -89,235 +89,65 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
61
,
"execution_count":
15
,
"id": "7810ff27-b4b0-4b30-a77a-c3e6d531e1ae",
"id": "7810ff27-b4b0-4b30-a77a-c3e6d531e1ae",
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [],
"source": [
"source": [
"agg_port = pd.concat([last_portfolio, last_4_cov_portfolio, last_4_stk_portfolio], axis=1).reset_index()\n",
"agg_port = pd.concat([last_portfolio, last_4_cov_portfolio, last_4_stk_portfolio], axis=1).reset_index()\n",
"agg_port = pd.merge(agg_port, fd_typeclass(agg_port.SECURITYID, current_date))"
"agg_port = pd.merge(agg_port, fd_typeclass(agg_port.SECURITYID.tolist(), current_date))\n",
"basic_info = fd_basicinfo(agg_port.SECURITYID.tolist())\n",
"agg_port = pd.merge(agg_port, basic_info)"
]
]
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
62
,
"execution_count":
17
,
"id": "858a98ea-e17f-4b4b-be64-becb4ce0a9b9",
"id": "858a98ea-e17f-4b4b-be64-becb4ce0a9b9",
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
"data": {
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>SECURITYID</th>\n",
" <th>BDRTO</th>\n",
" <th>CONVBDRTO_TO_BDRTO</th>\n",
" <th>EQUITYINVERTO</th>\n",
" <th>L1CODE</th>\n",
" <th>L1NAME</th>\n",
" <th>L2CODE</th>\n",
" <th>L2NAME</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>1030000011</td>\n",
" <td>85.80</td>\n",
" <td>23.140246</td>\n",
" <td>2.7075</td>\n",
" <td>3</td>\n",
" <td>债券基金</td>\n",
" <td>3.2</td>\n",
" <td>普通债券型基金</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>1030000012</td>\n",
" <td>85.80</td>\n",
" <td>23.140246</td>\n",
" <td>2.7075</td>\n",
" <td>3</td>\n",
" <td>债券基金</td>\n",
" <td>3.2</td>\n",
" <td>普通债券型基金</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>1030000014</td>\n",
" <td>80.75</td>\n",
" <td>2.309944</td>\n",
" <td>10.3475</td>\n",
" <td>3</td>\n",
" <td>债券基金</td>\n",
" <td>3.2</td>\n",
" <td>普通债券型基金</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>1030000015</td>\n",
" <td>80.75</td>\n",
" <td>2.309944</td>\n",
" <td>10.3475</td>\n",
" <td>3</td>\n",
" <td>债券基金</td>\n",
" <td>3.2</td>\n",
" <td>普通债券型基金</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>1030000022</td>\n",
" <td>113.76</td>\n",
" <td>16.596532</td>\n",
" <td>0.0000</td>\n",
" <td>3</td>\n",
" <td>债券基金</td>\n",
" <td>3.2</td>\n",
" <td>普通债券型基金</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1284</th>\n",
" <td>1030010008</td>\n",
" <td>0.00</td>\n",
" <td>NaN</td>\n",
" <td>0.0000</td>\n",
" <td>3</td>\n",
" <td>债券基金</td>\n",
" <td>3.6</td>\n",
" <td>短期理财债券型基金</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1285</th>\n",
" <td>1030013271</td>\n",
" <td>114.12</td>\n",
" <td>0.020749</td>\n",
" <td>0.0000</td>\n",
" <td>3</td>\n",
" <td>债券基金</td>\n",
" <td>3.2</td>\n",
" <td>普通债券型基金</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1286</th>\n",
" <td>1030013280</td>\n",
" <td>93.34</td>\n",
" <td>13.607275</td>\n",
" <td>15.0875</td>\n",
" <td>3</td>\n",
" <td>债券基金</td>\n",
" <td>3.2</td>\n",
" <td>普通债券型基金</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1287</th>\n",
" <td>1030013281</td>\n",
" <td>93.34</td>\n",
" <td>13.607275</td>\n",
" <td>15.0875</td>\n",
" <td>3</td>\n",
" <td>债券基金</td>\n",
" <td>3.2</td>\n",
" <td>普通债券型基金</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1288</th>\n",
" <td>1030014382</td>\n",
" <td>88.81</td>\n",
" <td>15.350972</td>\n",
" <td>0.0000</td>\n",
" <td>3</td>\n",
" <td>债券基金</td>\n",
" <td>3.2</td>\n",
" <td>普通债券型基金</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>1289 rows × 8 columns</p>\n",
"</div>"
],
"text/plain": [
"text/plain": [
" SECURITYID BDRTO CONVBDRTO_TO_BDRTO EQUITYINVERTO L1CODE L1NAME \\\n",
"array(['普通债券型基金(一级A类)', '普通债券型基金(一级B/C类)', '普通债券型基金(二级A类)',\n",
"0 1030000011 85.80 23.140246 2.7075 3 债券基金 \n",
" '普通债券型基金(二级B/C类)', '中短期标准债券型基金', '普通债券型基金(可投转债A类)', '保本型基金',\n",
"1 1030000012 85.80 23.140246 2.7075 3 债券基金 \n",
" '普通债券型基金(可投转债B类)', '指数债券型基金(A类)', '封闭式普通债券型基金(一级)(A类)',\n",
"2 1030000014 80.75 2.309944 10.3475 3 债券基金 \n",
" '长期标准债券型基金(A类)', '封闭式普通债券型基金(二级)(A类)', '可转换债券型基金(A类)',\n",
"3 1030000015 80.75 2.309944 10.3475 3 债券基金 \n",
" '可转换债券型基金(B/C类)', '债券型分级子基金(优先份额)', '债券型分级子基金(进取份额)',\n",
"4 1030000022 113.76 16.596532 0.0000 3 债券基金 \n",
" '指数债券型基金(B/C类)', '封闭式债券型分级子基金(优先份额)', '封闭式长期标准债券型基金(A类)',\n",
"... ... ... ... ... ... ... \n",
" '长期标准债券型基金(B/C类)', '短期理财债券型基金(A类)', '短期理财债券型基金(B/C类)',\n",
"1284 1030010008 0.00 NaN 0.0000 3 债券基金 \n",
" '封闭式普通债券型基金(可投转债)(A类)', '灵活策略基金(A类)', '封闭式长期标准债券型基金(B/C类)',\n",
"1285 1030013271 114.12 0.020749 0.0000 3 债券基金 \n",
" '灵活配置型基金(股票上限95%)(A类)', '灵活配置型基金(股票上限95%)(B/C类)'], dtype=object)"
"1286 1030013280 93.34 13.607275 15.0875 3 债券基金 \n",
"1287 1030013281 93.34 13.607275 15.0875 3 债券基金 \n",
"1288 1030014382 88.81 15.350972 0.0000 3 债券基金 \n",
"\n",
" L2CODE L2NAME \n",
"0 3.2 普通债券型基金 \n",
"1 3.2 普通债券型基金 \n",
"2 3.2 普通债券型基金 \n",
"3 3.2 普通债券型基金 \n",
"4 3.2 普通债券型基金 \n",
"... ... ... \n",
"1284 3.6 短期理财债券型基金 \n",
"1285 3.2 普通债券型基金 \n",
"1286 3.2 普通债券型基金 \n",
"1287 3.2 普通债券型基金 \n",
"1288 3.2 普通债券型基金 \n",
"\n",
"[1289 rows x 8 columns]"
]
]
},
},
"execution_count":
62
,
"execution_count":
17
,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
],
],
"source": [
"source": [
"agg_port"
"agg_port
.L3NAME.unique()
"
]
]
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
4
4,
"execution_count":
2
4,
"id": "894e01ee-8f44-472f-b37a-1d23fc8c57c1",
"id": "894e01ee-8f44-472f-b37a-1d23fc8c57c1",
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [],
"source": [
"source": [
"# 分类\n",
"# 分类\n",
"agg_port.loc[(agg_port[\"BDRTO\"] >= 80) & (agg_port.L2NAME == \"短期理财债券型基金\"), \"债券型(子类)\"] = \"短期纯债型基金\"\n",
"agg_port.loc[(agg_port[\"BDRTO\"] >= 80) & (agg_port[\"CONVBDRTO_TO_BDRTO\"] >= 80), \"债券型(子类)\"] = \"可转债基金\"\n",
"agg_port.loc[(agg_port[\"BDRTO\"] >= 80) & (agg_port[\"CONVBDRTO_TO_BDRTO\"] >= 80), \"债券型(子类)\"] = \"可转债基金\"\n",
"agg_port.loc[(agg_port[\"BDRTO\"] >= 80) & (agg_port[\"CONVBDRTO_TO_BDRTO\"] >= 5) & (agg_port[\"CONVBDRTO_TO_BDRTO\"] < 80) & (agg_port[\"EQUITYINVERTO\"] <= 0.1), \"债券型(子类)\"] = \"可投转债型债券基金\"\n",
"agg_port.loc[(agg_port[\"BDRTO\"] >= 80) & (agg_port[\"CONVBDRTO_TO_BDRTO\"] >= 5) & (agg_port[\"CONVBDRTO_TO_BDRTO\"] < 80) & (agg_port[\"EQUITYINVERTO\"] <= 0.1), \"债券型(子类)\"] = \"可投转债型债券基金\"\n",
"agg_port.loc[(agg_port[\"BDRTO\"] >= 80) & (agg_port[\"EQUITYINVERTO\"] >= 0.1) & (~agg_port[\"债券型(子类)\"].isin([\"可投转债型债券基金\", \"可转债基金\"])), \"债券型(子类)\"] = \"可投股票型债券基金\"\n",
"agg_port.loc[(agg_port[\"BDRTO\"] >= 80) & (agg_port[\"EQUITYINVERTO\"] >= 0.1) & (~agg_port[\"债券型(子类)\"].isin([\"可投转债型债券基金\", \"可转债基金\"])), \"债券型(子类)\"] = \"可投股票型债券基金\"\n",
"agg_port.loc[(agg_port[\"BDRTO\"] >= 80) & (agg_port[\"L2NAME\"] == \"指数债券型基金\") & (~agg_port[\"债券型(子类)\"].isin([\"可投转债型债券基金\", \"可转债基金\"])), \"债券型(子类)\"] = \"被动指数型债券基金\""
"agg_port.loc[(agg_port[\"BDRTO\"] >= 80) & (agg_port[\"L2NAME\"] == \"指数债券型基金\") & (~agg_port[\"债券型(子类)\"].isin([\"可投转债型债券基金\", \"可转债基金\"])), \"债券型(子类)\"] = \"被动指数型债券基金\"\n",
"agg_port.loc[pd.isnull(agg_port[\"债券型(子类)\"]), \"债券型(子类)\"] = \"中长期纯债型基金\""
]
]
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
45
,
"execution_count":
26
,
"id": "0fddaf03-8e90-474d-9584-7a5b60c3a15d",
"id": "0fddaf03-8e90-474d-9584-7a5b60c3a15d",
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
...
@@ -350,6 +180,13 @@
...
@@ -350,6 +180,13 @@
" <th>L1NAME</th>\n",
" <th>L1NAME</th>\n",
" <th>L2CODE</th>\n",
" <th>L2CODE</th>\n",
" <th>L2NAME</th>\n",
" <th>L2NAME</th>\n",
" <th>L3CODE</th>\n",
" <th>L3NAME</th>\n",
" <th>FDNAME</th>\n",
" <th>SNAMECOMP</th>\n",
" <th>FSYMBOL</th>\n",
" <th>FDNATURE</th>\n",
" <th>INVESTSTYLE</th>\n",
" </tr>\n",
" </tr>\n",
" <tr>\n",
" <tr>\n",
" <th>债券型(子类)</th>\n",
" <th>债券型(子类)</th>\n",
...
@@ -361,121 +198,6 @@
...
@@ -361,121 +198,6 @@
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>可投股票型债券基金</th>\n",
" <td>374</td>\n",
" <td>374</td>\n",
" <td>374</td>\n",
" <td>374</td>\n",
" <td>374</td>\n",
" <td>374</td>\n",
" <td>374</td>\n",
" <td>374</td>\n",
" </tr>\n",
" <tr>\n",
" <th>可投转债型债券基金</th>\n",
" <td>118</td>\n",
" <td>118</td>\n",
" <td>118</td>\n",
" <td>118</td>\n",
" <td>118</td>\n",
" <td>118</td>\n",
" <td>118</td>\n",
" <td>118</td>\n",
" </tr>\n",
" <tr>\n",
" <th>可转债基金</th>\n",
" <td>52</td>\n",
" <td>52</td>\n",
" <td>52</td>\n",
" <td>52</td>\n",
" <td>52</td>\n",
" <td>52</td>\n",
" <td>52</td>\n",
" <td>52</td>\n",
" </tr>\n",
" <tr>\n",
" <th>被动指数型债券基金</th>\n",
" <td>17</td>\n",
" <td>17</td>\n",
" <td>17</td>\n",
" <td>17</td>\n",
" <td>17</td>\n",
" <td>17</td>\n",
" <td>17</td>\n",
" <td>17</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" SECURITYID BDRTO CONVBDRTO_TO_BDRTO EQUITYINVERTO L1CODE \\\n",
"债券型(子类) \n",
"可投股票型债券基金 374 374 374 374 374 \n",
"可投转债型债券基金 118 118 118 118 118 \n",
"可转债基金 52 52 52 52 52 \n",
"被动指数型债券基金 17 17 17 17 17 \n",
"\n",
" L1NAME L2CODE L2NAME \n",
"债券型(子类) \n",
"可投股票型债券基金 374 374 374 \n",
"可投转债型债券基金 118 118 118 \n",
"可转债基金 52 52 52 \n",
"被动指数型债券基金 17 17 17 "
]
},
"execution_count": 45,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"agg_port.groupby(\"债券型(子类)\").count()"
]
},
{
"cell_type": "code",
"execution_count": 46,
"id": "6f6fe957-79b3-4e19-9cae-b8e9e489fd8d",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>SECURITYID</th>\n",
" <th>BDRTO</th>\n",
" <th>CONVBDRTO_TO_BDRTO</th>\n",
" <th>EQUITYINVERTO</th>\n",
" <th>L1CODE</th>\n",
" <th>L1NAME</th>\n",
" <th>L2CODE</th>\n",
" <th>L2NAME</th>\n",
" </tr>\n",
" <tr>\n",
" <th>债券型(子类)</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
...
@@ -487,26 +209,58 @@
...
@@ -487,26 +209,58 @@
" </thead>\n",
" </thead>\n",
" <tbody>\n",
" <tbody>\n",
" <tr>\n",
" <tr>\n",
" <th>中长期纯债型基金</th>\n",
" <td>663</td>\n",
" <td>663</td>\n",
" <td>648</td>\n",
" <td>657</td>\n",
" <td>663</td>\n",
" <td>663</td>\n",
" <td>663</td>\n",
" <td>663</td>\n",
" <td>663</td>\n",
" <td>663</td>\n",
" <td>663</td>\n",
" <td>466</td>\n",
" <td>663</td>\n",
" <td>663</td>\n",
" <td>663</td>\n",
" </tr>\n",
" <tr>\n",
" <th>可投股票型债券基金</th>\n",
" <th>可投股票型债券基金</th>\n",
" <td>374</td>\n",
" <td>403</td>\n",
" <td>374</td>\n",
" <td>403</td>\n",
" <td>374</td>\n",
" <td>403</td>\n",
" <td>374</td>\n",
" <td>403</td>\n",
" <td>374</td>\n",
" <td>403</td>\n",
" <td>374</td>\n",
" <td>403</td>\n",
" <td>374</td>\n",
" <td>403</td>\n",
" <td>374</td>\n",
" <td>403</td>\n",
" <td>403</td>\n",
" <td>403</td>\n",
" <td>403</td>\n",
" <td>349</td>\n",
" <td>403</td>\n",
" <td>403</td>\n",
" <td>403</td>\n",
" </tr>\n",
" </tr>\n",
" <tr>\n",
" <tr>\n",
" <th>可投转债型债券基金</th>\n",
" <th>可投转债型债券基金</th>\n",
" <td>118</td>\n",
" <td>89</td>\n",
" <td>118</td>\n",
" <td>89</td>\n",
" <td>118</td>\n",
" <td>89</td>\n",
" <td>118</td>\n",
" <td>89</td>\n",
" <td>118</td>\n",
" <td>89</td>\n",
" <td>118</td>\n",
" <td>89</td>\n",
" <td>118</td>\n",
" <td>89</td>\n",
" <td>118</td>\n",
" <td>89</td>\n",
" <td>89</td>\n",
" <td>89</td>\n",
" <td>89</td>\n",
" <td>82</td>\n",
" <td>89</td>\n",
" <td>89</td>\n",
" <td>89</td>\n",
" </tr>\n",
" </tr>\n",
" <tr>\n",
" <tr>\n",
" <th>可转债基金</th>\n",
" <th>可转债基金</th>\n",
...
@@ -518,6 +272,31 @@
...
@@ -518,6 +272,31 @@
" <td>52</td>\n",
" <td>52</td>\n",
" <td>52</td>\n",
" <td>52</td>\n",
" <td>52</td>\n",
" <td>52</td>\n",
" <td>52</td>\n",
" <td>52</td>\n",
" <td>52</td>\n",
" <td>41</td>\n",
" <td>52</td>\n",
" <td>52</td>\n",
" <td>52</td>\n",
" </tr>\n",
" <tr>\n",
" <th>短期纯债型基金</th>\n",
" <td>65</td>\n",
" <td>65</td>\n",
" <td>65</td>\n",
" <td>65</td>\n",
" <td>65</td>\n",
" <td>65</td>\n",
" <td>65</td>\n",
" <td>65</td>\n",
" <td>65</td>\n",
" <td>65</td>\n",
" <td>65</td>\n",
" <td>64</td>\n",
" <td>65</td>\n",
" <td>65</td>\n",
" <td>65</td>\n",
" </tr>\n",
" </tr>\n",
" <tr>\n",
" <tr>\n",
" <th>被动指数型债券基金</th>\n",
" <th>被动指数型债券基金</th>\n",
...
@@ -529,6 +308,13 @@
...
@@ -529,6 +308,13 @@
" <td>17</td>\n",
" <td>17</td>\n",
" <td>17</td>\n",
" <td>17</td>\n",
" <td>17</td>\n",
" <td>17</td>\n",
" <td>17</td>\n",
" <td>17</td>\n",
" <td>17</td>\n",
" <td>11</td>\n",
" <td>17</td>\n",
" <td>17</td>\n",
" <td>17</td>\n",
" </tr>\n",
" </tr>\n",
" </tbody>\n",
" </tbody>\n",
"</table>\n",
"</table>\n",
...
@@ -537,466 +323,39 @@
...
@@ -537,466 +323,39 @@
"text/plain": [
"text/plain": [
" SECURITYID BDRTO CONVBDRTO_TO_BDRTO EQUITYINVERTO L1CODE \\\n",
" SECURITYID BDRTO CONVBDRTO_TO_BDRTO EQUITYINVERTO L1CODE \\\n",
"债券型(子类) \n",
"债券型(子类) \n",
"可投股票型债券基金 374 374 374 374 374 \n",
"中长期纯债型基金 663 663 648 657 663 \n",
"可投转债型债券基金 118 118 118 118 118 \n",
"可投股票型债券基金 403 403 403 403 403 \n",
"可投转债型债券基金 89 89 89 89 89 \n",
"可转债基金 52 52 52 52 52 \n",
"可转债基金 52 52 52 52 52 \n",
"短期纯债型基金 65 65 65 65 65 \n",
"被动指数型债券基金 17 17 17 17 17 \n",
"被动指数型债券基金 17 17 17 17 17 \n",
"\n",
"\n",
" L1NAME L2CODE L2NAME \n",
" L1NAME L2CODE L2NAME L3CODE L3NAME FDNAME SNAMECOMP FSYMBOL \\\n",
"债券型(子类) \n",
"债券型(子类) \n",
"可投股票型债券基金 374 374 374 \n",
"中长期纯债型基金 663 663 663 663 663 663 466 663 \n",
"可投转债型债券基金 118 118 118 \n",
"可投股票型债券基金 403 403 403 403 403 403 349 403 \n",
"可转债基金 52 52 52 \n",
"可投转债型债券基金 89 89 89 89 89 89 82 89 \n",
"被动指数型债券基金 17 17 17 "
"可转债基金 52 52 52 52 52 52 41 52 \n",
]
"短期纯债型基金 65 65 65 65 65 65 64 65 \n",
},
"被动指数型债券基金 17 17 17 17 17 17 11 17 \n",
"execution_count": 46,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"agg_port.groupby(\"债券型(子类)\").count()"
]
},
{
"cell_type": "code",
"execution_count": 47,
"id": "d6f28858-58fd-44f9-8a3c-edd1537d593e",
"metadata": {},
"outputs": [],
"source": [
"agg_port = pd.merge(agg_port, fd_basicinfo(agg_port.SECURITYID, current_date))"
]
},
{
"cell_type": "code",
"execution_count": 50,
"id": "704bf199-05da-4813-a37a-eb88c348df7d",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
"\n",
" .dataframe thead th {\n",
" FDNATURE INVESTSTYLE \n",
" text-align: right;\n",
"债券型(子类) \n",
" }\n",
"中长期纯债型基金 663 663 \n",
"</style>\n",
"可投股票型债券基金 403 403 \n",
"<table border=\"1\" class=\"dataframe\">\n",
"可投转债型债券基金 89 89 \n",
" <thead>\n",
"可转债基金 52 52 \n",
" <tr style=\"text-align: right;\">\n",
"短期纯债型基金 65 65 \n",
" <th></th>\n",
"被动指数型债券基金 17 17 "
" <th>SECURITYID</th>\n",
" <th>BDRTO</th>\n",
" <th>CONVBDRTO_TO_BDRTO</th>\n",
" <th>EQUITYINVERTO</th>\n",
" <th>L1CODE</th>\n",
" <th>L1NAME</th>\n",
" <th>L2CODE</th>\n",
" <th>L2NAME</th>\n",
" <th>债券型(子类)</th>\n",
" <th>FDNAME</th>\n",
" <th>SNAMECOMP</th>\n",
" <th>FSYMBOL</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>183</th>\n",
" <td>1030001112</td>\n",
" <td>94.67</td>\n",
" <td>0.000000e+00</td>\n",
" <td>0.000</td>\n",
" <td>3</td>\n",
" <td>债券基金</td>\n",
" <td>3.4</td>\n",
" <td>指数债券型基金</td>\n",
" <td>被动指数型债券基金</td>\n",
" <td>亚债中国债券指数基金</td>\n",
" <td>华夏亚债中国债券指数</td>\n",
" <td>001021</td>\n",
" </tr>\n",
" <tr>\n",
" <th>184</th>\n",
" <td>1030001113</td>\n",
" <td>94.67</td>\n",
" <td>0.000000e+00</td>\n",
" <td>0.000</td>\n",
" <td>3</td>\n",
" <td>债券基金</td>\n",
" <td>3.4</td>\n",
" <td>指数债券型基金</td>\n",
" <td>被动指数型债券基金</td>\n",
" <td>亚债中国债券指数基金</td>\n",
" <td>华夏亚债中国债券指数</td>\n",
" <td>001023</td>\n",
" </tr>\n",
" <tr>\n",
" <th>654</th>\n",
" <td>1030005384</td>\n",
" <td>103.71</td>\n",
" <td>0.000000e+00</td>\n",
" <td>0.000</td>\n",
" <td>3</td>\n",
" <td>债券基金</td>\n",
" <td>3.4</td>\n",
" <td>指数债券型基金</td>\n",
" <td>被动指数型债券基金</td>\n",
" <td>易方达中债3-5年期国债指数证券投资基金</td>\n",
" <td>None</td>\n",
" <td>001512</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1136</th>\n",
" <td>1030008768</td>\n",
" <td>121.80</td>\n",
" <td>0.000000e+00</td>\n",
" <td>0.000</td>\n",
" <td>3</td>\n",
" <td>债券基金</td>\n",
" <td>3.4</td>\n",
" <td>指数债券型基金</td>\n",
" <td>被动指数型债券基金</td>\n",
" <td>中融上海清算所银行间1-3年中高等级信用债指数发起式证券投资基金</td>\n",
" <td>中融银行间1-3年中高等级信用债指数</td>\n",
" <td>003081</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1137</th>\n",
" <td>1030008769</td>\n",
" <td>121.80</td>\n",
" <td>0.000000e+00</td>\n",
" <td>0.000</td>\n",
" <td>3</td>\n",
" <td>债券基金</td>\n",
" <td>3.4</td>\n",
" <td>指数债券型基金</td>\n",
" <td>被动指数型债券基金</td>\n",
" <td>中融上海清算所银行间1-3年中高等级信用债指数发起式证券投资基金</td>\n",
" <td>中融银行间1-3年中高等级信用债指数</td>\n",
" <td>003082</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1068</th>\n",
" <td>1030008391</td>\n",
" <td>84.71</td>\n",
" <td>0.000000e+00</td>\n",
" <td>0.000</td>\n",
" <td>3</td>\n",
" <td>债券基金</td>\n",
" <td>3.4</td>\n",
" <td>指数债券型基金</td>\n",
" <td>被动指数型债券基金</td>\n",
" <td>中融上海清算所银行间1-3年高等级信用债指数发起式证券投资基金</td>\n",
" <td>中融银行间1-3年高等级信用债指数</td>\n",
" <td>003083</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1069</th>\n",
" <td>1030008392</td>\n",
" <td>84.71</td>\n",
" <td>0.000000e+00</td>\n",
" <td>0.000</td>\n",
" <td>3</td>\n",
" <td>债券基金</td>\n",
" <td>3.4</td>\n",
" <td>指数债券型基金</td>\n",
" <td>被动指数型债券基金</td>\n",
" <td>中融上海清算所银行间1-3年高等级信用债指数发起式证券投资基金</td>\n",
" <td>中融银行间1-3年高等级信用债指数</td>\n",
" <td>003084</td>\n",
" </tr>\n",
" <tr>\n",
" <th>931</th>\n",
" <td>1030007676</td>\n",
" <td>106.49</td>\n",
" <td>0.000000e+00</td>\n",
" <td>0.000</td>\n",
" <td>3</td>\n",
" <td>债券基金</td>\n",
" <td>3.4</td>\n",
" <td>指数债券型基金</td>\n",
" <td>被动指数型债券基金</td>\n",
" <td>易方达中债7-10年期国开行债券指数证券投资基金</td>\n",
" <td>易方达中债7-10年期国开行债券指数</td>\n",
" <td>003358</td>\n",
" </tr>\n",
" <tr>\n",
" <th>929</th>\n",
" <td>1030007664</td>\n",
" <td>98.43</td>\n",
" <td>0.000000e+00</td>\n",
" <td>0.000</td>\n",
" <td>3</td>\n",
" <td>债券基金</td>\n",
" <td>3.4</td>\n",
" <td>指数债券型基金</td>\n",
" <td>被动指数型债券基金</td>\n",
" <td>广发中债7-10年期国开行债券指数证券投资基金</td>\n",
" <td>广发中债7-10年国开债指数</td>\n",
" <td>003376</td>\n",
" </tr>\n",
" <tr>\n",
" <th>930</th>\n",
" <td>1030007665</td>\n",
" <td>98.43</td>\n",
" <td>0.000000e+00</td>\n",
" <td>0.000</td>\n",
" <td>3</td>\n",
" <td>债券基金</td>\n",
" <td>3.4</td>\n",
" <td>指数债券型基金</td>\n",
" <td>被动指数型债券基金</td>\n",
" <td>广发中债7-10年期国开行债券指数证券投资基金</td>\n",
" <td>广发中债7-10年国开债指数</td>\n",
" <td>003377</td>\n",
" </tr>\n",
" <tr>\n",
" <th>956</th>\n",
" <td>1030007810</td>\n",
" <td>93.07</td>\n",
" <td>0.000000e+00</td>\n",
" <td>0.000</td>\n",
" <td>3</td>\n",
" <td>债券基金</td>\n",
" <td>3.4</td>\n",
" <td>指数债券型基金</td>\n",
" <td>被动指数型债券基金</td>\n",
" <td>中证兴业中高等级信用债指数证券投资基金</td>\n",
" <td>None</td>\n",
" <td>003429</td>\n",
" </tr>\n",
" <tr>\n",
" <th>461</th>\n",
" <td>1030002185</td>\n",
" <td>102.77</td>\n",
" <td>0.000000e+00</td>\n",
" <td>0.000</td>\n",
" <td>3</td>\n",
" <td>债券基金</td>\n",
" <td>3.4</td>\n",
" <td>指数债券型基金</td>\n",
" <td>被动指数型债券基金</td>\n",
" <td>嘉实中证金边中期国债交易型开放式指数证券投资基金</td>\n",
" <td>None</td>\n",
" <td>159926</td>\n",
" </tr>\n",
" <tr>\n",
" <th>322</th>\n",
" <td>1030001720</td>\n",
" <td>127.03</td>\n",
" <td>0.000000e+00</td>\n",
" <td>0.000</td>\n",
" <td>3</td>\n",
" <td>债券基金</td>\n",
" <td>3.4</td>\n",
" <td>指数债券型基金</td>\n",
" <td>被动指数型债券基金</td>\n",
" <td>易方达中债新综合债券指数发起式证券投资基金(LOF)</td>\n",
" <td>易方达中债新综指发起式(LOF)</td>\n",
" <td>161119</td>\n",
" </tr>\n",
" <tr>\n",
" <th>323</th>\n",
" <td>1030001721</td>\n",
" <td>127.03</td>\n",
" <td>0.000000e+00</td>\n",
" <td>0.000</td>\n",
" <td>3</td>\n",
" <td>债券基金</td>\n",
" <td>3.4</td>\n",
" <td>指数债券型基金</td>\n",
" <td>被动指数型债券基金</td>\n",
" <td>易方达中债新综合债券指数发起式证券投资基金(LOF)</td>\n",
" <td>易方达中债新综指发起式(LOF)</td>\n",
" <td>161120</td>\n",
" </tr>\n",
" <tr>\n",
" <th>46</th>\n",
" <td>1030000318</td>\n",
" <td>92.69</td>\n",
" <td>2.537940e+01</td>\n",
" <td>11.615</td>\n",
" <td>3</td>\n",
" <td>债券基金</td>\n",
" <td>3.4</td>\n",
" <td>指数债券型基金</td>\n",
" <td>被动指数型债券基金</td>\n",
" <td>长盛全债指数增强型债券投资基金</td>\n",
" <td>None</td>\n",
" <td>510080</td>\n",
" </tr>\n",
" <tr>\n",
" <th>414</th>\n",
" <td>1030002018</td>\n",
" <td>96.00</td>\n",
" <td>0.000000e+00</td>\n",
" <td>0.000</td>\n",
" <td>3</td>\n",
" <td>债券基金</td>\n",
" <td>3.4</td>\n",
" <td>指数债券型基金</td>\n",
" <td>被动指数型债券基金</td>\n",
" <td>上证5年期国债交易型开放式指数证券投资基金</td>\n",
" <td>None</td>\n",
" <td>511010</td>\n",
" </tr>\n",
" <tr>\n",
" <th>609</th>\n",
" <td>1030004134</td>\n",
" <td>102.19</td>\n",
" <td>8.881784e-16</td>\n",
" <td>0.000</td>\n",
" <td>3</td>\n",
" <td>债券基金</td>\n",
" <td>3.4</td>\n",
" <td>指数债券型基金</td>\n",
" <td>被动指数型债券基金</td>\n",
" <td>上证城投债交易型开放式指数证券投资基金</td>\n",
" <td>None</td>\n",
" <td>511220</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" SECURITYID BDRTO CONVBDRTO_TO_BDRTO EQUITYINVERTO L1CODE L1NAME \\\n",
"183 1030001112 94.67 0.000000e+00 0.000 3 债券基金 \n",
"184 1030001113 94.67 0.000000e+00 0.000 3 债券基金 \n",
"654 1030005384 103.71 0.000000e+00 0.000 3 债券基金 \n",
"1136 1030008768 121.80 0.000000e+00 0.000 3 债券基金 \n",
"1137 1030008769 121.80 0.000000e+00 0.000 3 债券基金 \n",
"1068 1030008391 84.71 0.000000e+00 0.000 3 债券基金 \n",
"1069 1030008392 84.71 0.000000e+00 0.000 3 债券基金 \n",
"931 1030007676 106.49 0.000000e+00 0.000 3 债券基金 \n",
"929 1030007664 98.43 0.000000e+00 0.000 3 债券基金 \n",
"930 1030007665 98.43 0.000000e+00 0.000 3 债券基金 \n",
"956 1030007810 93.07 0.000000e+00 0.000 3 债券基金 \n",
"461 1030002185 102.77 0.000000e+00 0.000 3 债券基金 \n",
"322 1030001720 127.03 0.000000e+00 0.000 3 债券基金 \n",
"323 1030001721 127.03 0.000000e+00 0.000 3 债券基金 \n",
"46 1030000318 92.69 2.537940e+01 11.615 3 债券基金 \n",
"414 1030002018 96.00 0.000000e+00 0.000 3 债券基金 \n",
"609 1030004134 102.19 8.881784e-16 0.000 3 债券基金 \n",
"\n",
" L2CODE L2NAME 债券型(子类) FDNAME \\\n",
"183 3.4 指数债券型基金 被动指数型债券基金 亚债中国债券指数基金 \n",
"184 3.4 指数债券型基金 被动指数型债券基金 亚债中国债券指数基金 \n",
"654 3.4 指数债券型基金 被动指数型债券基金 易方达中债3-5年期国债指数证券投资基金 \n",
"1136 3.4 指数债券型基金 被动指数型债券基金 中融上海清算所银行间1-3年中高等级信用债指数发起式证券投资基金 \n",
"1137 3.4 指数债券型基金 被动指数型债券基金 中融上海清算所银行间1-3年中高等级信用债指数发起式证券投资基金 \n",
"1068 3.4 指数债券型基金 被动指数型债券基金 中融上海清算所银行间1-3年高等级信用债指数发起式证券投资基金 \n",
"1069 3.4 指数债券型基金 被动指数型债券基金 中融上海清算所银行间1-3年高等级信用债指数发起式证券投资基金 \n",
"931 3.4 指数债券型基金 被动指数型债券基金 易方达中债7-10年期国开行债券指数证券投资基金 \n",
"929 3.4 指数债券型基金 被动指数型债券基金 广发中债7-10年期国开行债券指数证券投资基金 \n",
"930 3.4 指数债券型基金 被动指数型债券基金 广发中债7-10年期国开行债券指数证券投资基金 \n",
"956 3.4 指数债券型基金 被动指数型债券基金 中证兴业中高等级信用债指数证券投资基金 \n",
"461 3.4 指数债券型基金 被动指数型债券基金 嘉实中证金边中期国债交易型开放式指数证券投资基金 \n",
"322 3.4 指数债券型基金 被动指数型债券基金 易方达中债新综合债券指数发起式证券投资基金(LOF) \n",
"323 3.4 指数债券型基金 被动指数型债券基金 易方达中债新综合债券指数发起式证券投资基金(LOF) \n",
"46 3.4 指数债券型基金 被动指数型债券基金 长盛全债指数增强型债券投资基金 \n",
"414 3.4 指数债券型基金 被动指数型债券基金 上证5年期国债交易型开放式指数证券投资基金 \n",
"609 3.4 指数债券型基金 被动指数型债券基金 上证城投债交易型开放式指数证券投资基金 \n",
"\n",
" SNAMECOMP FSYMBOL \n",
"183 华夏亚债中国债券指数 001021 \n",
"184 华夏亚债中国债券指数 001023 \n",
"654 None 001512 \n",
"1136 中融银行间1-3年中高等级信用债指数 003081 \n",
"1137 中融银行间1-3年中高等级信用债指数 003082 \n",
"1068 中融银行间1-3年高等级信用债指数 003083 \n",
"1069 中融银行间1-3年高等级信用债指数 003084 \n",
"931 易方达中债7-10年期国开行债券指数 003358 \n",
"929 广发中债7-10年国开债指数 003376 \n",
"930 广发中债7-10年国开债指数 003377 \n",
"956 None 003429 \n",
"461 None 159926 \n",
"322 易方达中债新综指发起式(LOF) 161119 \n",
"323 易方达中债新综指发起式(LOF) 161120 \n",
"46 None 510080 \n",
"414 None 511010 \n",
"609 None 511220 "
]
]
},
},
"execution_count":
50
,
"execution_count":
26
,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
],
],
"source": [
"source": [
"agg_port[agg_port[\"债券型(子类)\"] == \"被动指数型债券基金\"].sort_values(\"FSYMBOL\")"
"agg_port.groupby(\"债券型(子类)\").count()"
]
},
{
"cell_type": "code",
"execution_count": 52,
"id": "e2379113-ddb0-45f2-a927-907407b3787b",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>SECURITYID</th>\n",
" <th>BDRTO</th>\n",
" <th>CONVBDRTO_TO_BDRTO</th>\n",
" <th>EQUITYINVERTO</th>\n",
" <th>L1CODE</th>\n",
" <th>L1NAME</th>\n",
" <th>L2CODE</th>\n",
" <th>L2NAME</th>\n",
" <th>债券型(子类)</th>\n",
" <th>FDNAME</th>\n",
" <th>SNAMECOMP</th>\n",
" <th>FSYMBOL</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
"Empty DataFrame\n",
"Columns: [SECURITYID, BDRTO, CONVBDRTO_TO_BDRTO, EQUITYINVERTO, L1CODE, L1NAME, L2CODE, L2NAME, 债券型(子类), FDNAME, SNAMECOMP, FSYMBOL]\n",
"Index: []"
]
},
"execution_count": 52,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"agg_port[agg_port[\"FSYMBOL\"] == \"002659\"]"
]
]
},
},
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment