数据采集之债券(三):国债收益

#国债收益
jbxx=DataAPI.BondGet(secID=u””,ticker=u””,typeID=u”02020101″,exchangeCD=u””,partyID=u””,listStatusCD=u”L”,delistDate=””,field=u”secShortName,exchangeCD,couponTypeCD,cpnFreqCD,ticker,firstAccrDate,coupon,maturityDate”,pandas=”1″)
jbxx=jbxx[jbxx.couponTypeCD==’FIXED’][jbxx.exchangeCD!=’OTC’][jbxx.exchangeCD!=’XIBE’]
rhq=DataAPI.MktBonddGet(secID=u””,ticker=u””,tradeDate=u”20181225″,beginDate=u””,endDate=u””,field=u”ticker,closePrice,accrInterest”,pandas=”1″)
table=jbxx.merge(rhq)
#table=table.sort_values(by=[‘YTM’], ascending=[False])
tablesh=table[table.exchangeCD==’XSHG’]
tablesz=table[table.exchangeCD==’XSHE’]
tablesh[‘payment’]=(tablesh.closePrice+tablesh.accrInterest)*1.0002
tablesz[‘payment’]=(tablesz.closePrice+tablesz.accrInterest)*1.001
table1=tablesh.merge(tablesz,how=’outer’)
tablebn=table1[table1.cpnFreqCD==’2PY’]
tableyn=table1[table1.cpnFreqCD!=’2PY’]
tableyn[‘fee’]=(tableyn.coupon+100-tableyn.payment)*100/tableyn.payment
tablebn[‘fee’]=(tablebn.coupon/2+100-tablebn.payment)*100/tablebn.payment
table2=tableyn.merge(tablebn,how=’outer’)
table2=table2.sort_values(by=[‘maturityDate’], ascending=[True])
#table2=table2.sort_values(by=[‘fee’], ascending=[False])
table2.head(50)
#exchangeCD(XSHG上海XSHE深圳),couponTypeCD(FIXED固定利率),cpnFreqCD(1PY一年付息一次2PY一年两次MAT到期一次还本付息)

secShortName exchangeCD couponTypeCD cpnFreqCD ticker firstAccrDate coupon maturityDate closePrice accrInterest payment fee
7 14国债01 XSHG FIXED 1PY 019401 2014-01-07 4.47 2019-01-07 100.62 4.323041 104.964030 -0.470666
74 国债1401 XSHE FIXED 1PY 101401 2014-01-07 4.47 2019-01-07 100.00 4.323041 104.427364 0.040828
89 国债1603 XSHE FIXED 1PY 101603 2016-01-28 2.55 2019-01-28 100.00 2.319452 102.421771 0.125197
22 16国债03 XSHG FIXED 1PY 019531 2016-01-28 2.55 2019-01-28 99.91 2.319452 102.249898 0.293499
50 18国债03 XSHG FIXED MAT 019585 2018-02-01 3.38 2019-02-01 100.08 3.037370 103.137993 0.234643
117 国债1803 XSHE FIXED MAT 101803 2018-02-01 3.38 2019-02-01 100.00 3.037370 103.140407 0.232298
0 12国债05 XSHG FIXED 1PY 019205 2012-03-08 3.41 2019-03-08 100.40 2.737343 103.157970 0.244314
67 国债1205 XSHE FIXED 1PY 101205 2012-03-08 3.41 2019-03-08 100.00 2.737343 102.840080 0.554180
263 国债0903 XSHE FIXED 2PY 100903 2009-03-12 3.05 2019-03-12 100.00 0.877397 100.978274 0.541429
239 09国债03 XSHG FIXED 2PY 019903 2009-03-12 3.05 2019-03-12 101.26 0.877397 102.157824 -0.619458
10 14国债08 XSHG FIXED 1PY 019408 2014-04-24 4.04 2019-04-24 103.11 2.722849 105.854016 -1.713696
77 国债1408 XSHE FIXED 1PY 101408 2014-04-24 4.04 2019-04-24 100.00 2.722849 102.825572 1.181057
92 国债1609 XSHE FIXED 1PY 101609 2016-04-28 2.55 2019-04-28 100.00 1.690685 101.792376 0.744284
25 16国债09 XSHG FIXED 1PY 019537 2016-04-28 2.55 2019-04-28 99.95 1.690685 101.661013 0.874462
241 09国债07 XSHG FIXED 2PY 019907 2009-05-07 3.02 2019-05-07 100.00 0.405425 100.425506 1.079899
265 国债0907 XSHE FIXED 2PY 100907 2009-05-07 3.02 2019-05-07 98.00 0.405425 98.503830 3.051830
122 国债1810 XSHE FIXED MAT 101810 2018-05-17 3.02 2019-05-17 100.00 1.845096 101.946941 1.052566
55 18国债10 XSHG FIXED MAT 019592 2018-05-17 3.02 2019-05-17 100.23 1.845096 102.095511 0.905514
68 国债1210 XSHE FIXED 1PY 101210 2012-06-07 3.14 2019-06-07 100.00 1.737753 101.839491 1.277019
1 12国债10 XSHG FIXED 1PY 019210 2012-06-07 3.14 2019-06-07 101.68 1.737753 103.438437 -0.288516
38 17国债12 XSHG FIXED 1PY 019566 2017-06-15 3.62 2019-06-15 100.50 1.924055 102.444540 1.147411
105 国债1712 XSHE FIXED 1PY 101712 2017-06-15 3.62 2019-06-15 100.00 1.924055 102.025979 1.562368
243 09国债12 XSHG FIXED 2PY 019912 2009-06-18 3.09 2019-06-18 100.00 0.067726 100.087740 1.455983
267 国债0912 XSHE FIXED 2PY 100912 2009-06-18 3.09 2019-06-18 100.00 0.067726 100.167794 1.374899
268 国债0916 XSHE FIXED 2PY 100916 2009-07-23 3.48 2019-07-23 100.00 1.487343 101.588830 0.148805
244 09国债16 XSHG FIXED 2PY 019916 2009-07-23 3.48 2019-07-23 100.00 1.487343 101.507640 0.228908
28 16国债16 XSHG FIXED 1PY 019544 2016-07-28 2.43 2019-07-28 99.90 1.005288 100.925469 1.490735
95 国债1616 XSHE FIXED 1PY 101616 2016-07-28 2.43 2019-07-28 100.00 1.005288 101.106293 1.309223
127 国债1818 XSHE FIXED MAT 101818 2018-08-16 2.79 2019-08-16 100.00 1.008986 101.109995 1.661562
60 18国债18 XSHG FIXED MAT 019600 2018-08-16 2.79 2019-08-16 100.21 1.008986 101.239230 1.531788
2 12国债16 XSHG FIXED 1PY 019216 2012-09-06 3.25 2019-09-06 100.20 0.988356 101.208594 2.017029
69 国债1216 XSHE FIXED 1PY 101216 2012-09-06 3.25 2019-09-06 100.00 0.988356 101.089344 2.137372
109 国债1719 XSHE FIXED 1PY 101719 2017-09-14 3.50 2019-09-14 100.00 0.987671 101.088659 2.385373
42 17国债19 XSHG FIXED 1PY 019573 2017-09-14 3.50 2019-09-14 100.30 0.987671 101.307929 2.163771
270 国债0923 XSHE FIXED 2PY 100923 2009-09-17 3.44 2019-09-17 100.00 0.942466 101.043408 0.669605
246 09国债23 XSHG FIXED 2PY 019923 2009-09-17 3.44 2019-09-17 100.00 0.942466 100.962654 0.750124
98 国债1622 XSHE FIXED 1PY 101622 2016-10-27 2.29 2019-10-27 100.00 0.376438 100.476814 1.804581
31 16国债22 XSHG FIXED 1PY 019550 2016-10-27 2.29 2019-10-27 100.00 0.376438 100.396513 1.886008
80 国债1426 XSHE FIXED 1PY 101426 2014-10-30 3.53 2019-10-30 100.00 0.551260 100.651811 2.859550
13 14国债26 XSHG FIXED 1PY 019426 2014-10-30 3.53 2019-10-30 100.31 0.551260 100.881432 2.625426
248 09国债27 XSHG FIXED 2PY 019927 2009-11-05 3.68 2019-11-05 100.00 0.514192 100.534295 1.298766
272 国债0927 XSHE FIXED 2PY 100927 2009-11-05 3.68 2019-11-05 100.00 0.514192 100.614706 1.217808
65 18国债26 XSHG FIXED MAT 019608 2018-11-22 2.41 2019-11-22 100.00 0.224493 100.244538 2.160180
132 国债1826 XSHE FIXED MAT 101826 2018-11-22 2.41 2019-11-22 100.00 0.224493 100.324717 2.078533
101 国债1702 XSHE FIXED 1PY 101702 2017-01-19 2.77 2020-01-19 100.00 2.587863 102.690451 0.077465
34 17国债02 XSHG FIXED 1PY 019556 2017-01-19 2.77 2020-01-19 99.65 2.587863 102.258311 0.500389
70 国债1303 XSHE FIXED 1PY 101303 2013-01-24 3.42 2020-01-24 100.83 3.148274 104.082252 -0.636278
3 13国债03 XSHG FIXED 1PY 019303 2013-01-24 3.42 2020-01-24 100.70 3.148274 103.869044 -0.432317
274 国债1002 XSHE FIXED 2PY 101002 2010-02-04 3.43 2020-02-04 102.68 1.353206 104.137239 -2.326007
142 10国债02 XSHG FIXED 2PY 019002 2010-02-04 3.43 2020-02-04 102.24 1.353206 103.613925 -1.832693

数据采集自网络

Leave a Reply

邮箱地址不会被公开。 必填项已用*标注