Package: efinance
Introductionefinance是由个人打造的用于获取股票、基金、期货数据的免费开源 Python 库，你可以使用它很方便地获取数据以便更好地服务于个人的交易系统需求。Source CodeDocsChangelogInstallation通过pip安装pipinstallefinance通过pip更新pipinstallefinance--upgrade通过docker安装# 克隆代码gitclonehttps://github.com/Micro-sheep/efinance# 切换工作目录为该项目的根目录cdefinance# 构建镜像(-t 指定构建后生成的镜像名称 . 指定 build 的对象是当前工作目录下的 dockerfile)dockerbuild-tefinance.--no-cache# 以交互的方式运行镜像(运行之后自动删除容器,如不想删除 则可去掉 --rm)dockerrun--rm-itefinance源码安装（用于开发）gitclonehttps://github.com/Micro-sheep/efinancecdefinance
pipinstall-e.ExamplesStock获取股票历史日 K 线数据>>>importefinanceasef>>># 股票代码>>>stock_code='600519'>>>ef.stock.get_quote_history(stock_code)股票名称股票代码日期开盘收盘最高最低成交量成交额振幅涨跌幅涨跌额换手率0贵州茅台6005192001-08-27-89.74-89.53-89.08-90.07406318.01.410347e+09-1.100.920.8356.831贵州茅台6005192001-08-28-89.64-89.27-89.24-89.72129647.04.634630e+08-0.540.290.2618.132贵州茅台6005192001-08-29-89.24-89.36-89.24-89.4253252.01.946890e+08-0.20-0.10-0.097.453贵州茅台6005192001-08-30-89.38-89.22-89.14-89.4448013.01.775580e+08-0.340.160.146.724贵州茅台6005192001-08-31-89.21-89.24-89.12-89.2823231.08.623100e+07-0.18-0.02-0.023.25..........................................4756贵州茅台6005192021-07-231937.821900.001937.821895.0947585.09.057762e+092.20-2.06-40.010.384757贵州茅台6005192021-07-261879.001804.111879.001780.0098619.01.789436e+105.21-5.05-95.890.794758贵州茅台6005192021-07-271803.001712.891810.001703.0086577.01.523081e+105.93-5.06-91.220.694759贵州茅台6005192021-07-281703.001768.901788.201682.1285369.01.479247e+106.193.2756.010.684760贵州茅台6005192021-07-291810.011740.001823.001734.3451035.09.067345e+095.01-1.63-28.900.41[4761rowsx13columns]获取非 A 股的股票 K 线数据（支持输入股票名称以及代码）>>>importefinanceasef>>># 股票代码>>>stock_code='AAPL'>>>ef.stock.get_quote_history(stock_code)股票名称股票代码日期开盘收盘最高最低成交量成交额振幅涨跌幅涨跌额换手率0苹果AAPL1984-09-07-5.37-5.37-5.36-5.372981600.00.000000e+000.000.000.000.021苹果AAPL1984-09-10-5.37-5.37-5.36-5.372346400.00.000000e+00-0.190.000.000.012苹果AAPL1984-09-11-5.36-5.36-5.36-5.365444000.00.000000e+000.000.190.010.033苹果AAPL1984-09-12-5.36-5.37-5.36-5.374773600.00.000000e+00-0.19-0.19-0.010.034苹果AAPL1984-09-13-5.36-5.36-5.36-5.367429600.00.000000e+000.000.190.010.04..........................................8739苹果AAPL2021-07-22145.94146.80148.19145.8177338156.01.137623e+101.640.961.400.478740苹果AAPL2021-07-23147.55148.56148.72146.9271447416.01.058233e+101.231.201.760.438741苹果AAPL2021-07-26148.27148.99149.83147.7072434089.01.080774e+101.430.290.430.448742苹果AAPL2021-07-27149.12146.77149.21145.55104818578.01.540140e+102.46-1.49-2.220.638743苹果AAPL2021-07-28144.81144.98146.97142.54118931191.01.723188e+103.02-1.22-1.790.72[8744rowsx13columns]>>># 股票名称>>>stock_name='微软'>>>ef.stock.get_quote_history(stock_name)股票名称股票代码日期开盘收盘最高最低成交量成交额振幅涨跌幅涨跌额换手率0微软MSFT1986-03-13-20.74-20.73-20.73-20.741.031789e+090.000000e+000.000.000.0013.721微软MSFT1986-03-14-20.73-20.73-20.73-20.733.081600e+080.000000e+000.000.000.004.102微软MSFT1986-03-17-20.73-20.73-20.73-20.731.331712e+080.000000e+000.000.000.001.773微软MSFT1986-03-18-20.73-20.73-20.73-20.736.776640e+070.000000e+000.000.000.000.904微软MSFT1986-03-19-20.73-20.73-20.73-20.734.789440e+070.000000e+000.000.000.000.64..........................................8357微软MSFT2021-07-22283.84286.14286.42283.422.338406e+076.677062e+091.071.684.740.318358微软MSFT2021-07-23287.37289.67289.99286.502.276807e+076.578686e+091.221.233.530.308359微软MSFT2021-07-26289.00289.05289.69286.642.317607e+076.685868e+091.05-0.21-0.620.318360微软MSFT2021-07-27289.43286.54289.58282.953.360407e+079.599993e+092.29-0.87-2.510.458361微软MSFT2021-07-28288.99286.22290.15283.833.356685e+079.638499e+092.21-0.11-0.320.45[8362rowsx13columns]获取 ETF K 线数据>>>importefinanceasef>>># ETF 代码（以中概互联网 ETF 为例）>>>etf_code='513050'>>>ef.stock.get_quote_history(etf_code)股票名称股票代码日期开盘收盘最高最低成交量成交额振幅涨跌幅涨跌额换手率0中概互联网ETF5130502017-01-180.9890.9770.9890.969345605.03.381795e+070.000.000.0000.261中概互联网ETF5130502017-01-190.9780.9890.9900.978257716.02.542553e+071.231.230.0120.192中概互联网ETF5130502017-01-200.9890.9880.9900.98650980.05.043289e+060.40-0.10-0.0010.043中概互联网ETF5130502017-01-230.9880.9880.9890.98613739.01.356129e+060.300.000.0000.014中概互联网ETF5130502017-01-240.9890.9890.9920.98717937.01.774398e+060.510.100.0010.01..........................................1097中概互联网ETF5130502021-07-231.7891.7601.7891.7584427623.07.836530e+081.73-1.51-0.0273.321098中概互联网ETF5130502021-07-261.6791.6451.6981.64213035366.02.182816e+093.18-6.53-0.1159.781099中概互联网ETF5130502021-07-271.6001.5471.6201.54614269546.02.257610e+094.50-5.96-0.09810.701100中概互联网ETF5130502021-07-281.5451.5521.5781.50613141023.02.024106e+094.650.320.0059.851101中概互联网ETF5130502021-07-291.6151.6411.6511.60610658041.01.734404e+092.905.730.0897.99[1102rowsx13columns]获取单只股票 5 分钟 K 线数据>>>importefinanceasef>>># 股票代码>>>stock_code='600519'>>># 5 分钟>>>frequency=5>>>ef.stock.get_quote_history(stock_code,klt=frequency)股票名称股票代码日期开盘收盘最高最低成交量成交额振幅涨跌幅涨跌额换手率0贵州茅台6005192021-06-1609:352172.712159.712175.712150.741885.0411159309.01.15-0.64-14.000.021贵州茅台6005192021-06-1609:402156.692148.712160.482143.371238.0268790684.00.79-0.51-11.000.012贵州茅台6005192021-06-1609:452149.792159.712160.692149.79706.0153631002.00.510.5111.000.013贵州茅台6005192021-06-1609:502159.612148.872159.712148.87586.0127346502.00.50-0.50-10.840.004贵州茅台6005192021-06-1609:552148.872161.042163.712148.72788.0171491075.00.700.5712.170.01..........................................1521贵州茅台6005192021-07-2913:501746.511746.091748.951746.01738.0128889575.00.17-0.09-1.490.011522贵州茅台6005192021-07-2913:551746.081742.011746.091741.96831.0144968679.00.24-0.23-4.080.011523贵州茅台6005192021-07-2914:001742.001739.581742.001739.58864.0150446840.00.14-0.14-2.430.011524贵州茅台6005192021-07-2914:051741.871740.001745.001738.881083.0188427970.00.350.020.420.011525贵州茅台6005192021-07-2914:101740.001740.021740.101740.0059.010315488.00.010.000.020.00[1526rowsx13columns]沪深市场 A 股最新状况>>>importefinanceasef>>>ef.stock.get_realtime_quotes()股票代码股票名称涨跌幅最新价最高最低今开涨跌额换手率量比动态市盈率成交量成交额昨日收盘总市值流通市值行情ID市场类型0688787N海天277.59139.48172.39139.25171.66102.5485.62-78.93745191110318832.036.94596974400012139086671.688787沪A1301045N天禄149.3439.4248.9539.248.9523.6166.66-37.81163061683878656.015.8140663442409642370890.301045深A2300532今天国际20.0412.1612.1610.6910.692.038.853.02-22.72144795171535181.010.13332251058019893334400.300532深A3300600国瑞科技20.0213.1913.1911.1111.412.218.612.82218.75423779541164432.010.99391542142730036651170.300600深A4300985致远新能20.0147.0847.0836.839.47.8566.652.1758.37210697897370992.039.23627733647214883001160.300985深A.........................................................4598603186华正新材-10.043.2744.0943.2743.99-4.811.980.4825.2427697120486294.048.08614630065060635194721.603186沪A4599688185康希诺-U-10.11476.4534.94460.13530.0-53.66.022.74-2088.07402391960540832.0530.0117885131884318314792151.688185沪A4600688148芳源股份-10.5731.334.3931.333.9-3.726.070.56220.01188415620632512.035.01592356200022617060431.688148沪A4601300034钢研高纳-10.9643.1246.8142.8846.5-5.317.451.7759.493232261441101824.048.4320959281094187069118610.300034深A4602300712永福股份-13.7196.9110.9495.4109.0-15.46.961.26511.211267051265152928.0112.317645877600176458776000.300712深A[4603rowsx18columns]股票龙虎榜>>>importefinanceasef>>># 获取最新一个公开的龙虎榜数据(后面还有获取指定日期区间的示例代码)>>>ef.stock.get_daily_billboard()股票代码股票名称上榜日期解读收盘价涨跌幅换手率龙虎榜净买额龙虎榜买入额龙虎榜卖出额龙虎榜成交额市场总成交额净买额占总成交比成交额占总成交比流通市值上榜原因0000608阳光股份2021-08-27卖一主卖，成功率48.36%3.73-9.90343.8430-8.709942e+061.422786e+072.293780e+073.716565e+07110838793-7.85820833.5312682.796761e+09日跌幅偏离值达到7%的前5只证券1000751锌业股份2021-08-27主力做T，成功率18.84%5.32-2.919719.6505-1.079219e+085.638899e+071.643109e+082.206999e+081462953973-7.37698415.0859067.500502e+09日振幅值达到15%的前5只证券2000762西藏矿业2021-08-27北京资金买入，成功率39.42%63.991.074115.64632.938758e+074.675541e+084.381665e+089.057206e+0849599625980.59249618.2606333.332571e+10日振幅值达到15%的前5只证券3000833粤桂股份2021-08-27实力游资买入，成功率44.55%8.8710.04968.82634.993555e+071.292967e+087.936120e+072.086580e+088959104295.57372123.2900463.353614e+09连续三个交易日内，涨幅偏离值累计达到20%的证券4001208华菱线缆2021-08-271家机构买入，成功率40.43%19.724.338646.19854.055258e+071.537821e+081.132295e+082.670117e+0812039130483.36839822.1786512.634710e+09日换手率达到20%的前5只证券..................................................70688558国盛智科2021-08-27买一主买，成功率38.71%60.721.606434.01041.835494e+071.057779e+088.742293e+071.932008e+088025693002.28702324.0727892.321743e+09有价格涨跌幅限制的日换手率达到30%的前五只证券71688596正帆科技2021-08-271家机构买入，成功率57.67%26.723.16603.9065-1.371039e+078.409046e+079.780085e+071.818913e+08745137400-1.83998224.4104384.630550e+09有价格涨跌幅限制的连续3个交易日内收盘价格涨幅偏离值累计达到30%的证券72688663新风光2021-08-27卖一主卖，成功率37.18%28.17-17.631632.24091.036460e+075.416901e+074.380440e+079.797341e+072747327003.77261335.6613588.492507e+08有价格涨跌幅限制的日收盘价格跌幅达到15%的前五只证券73688663新风光2021-08-27卖一主卖，成功率37.18%28.17-17.631632.24091.036460e+075.416901e+074.380440e+079.797341e+072747327003.77261335.6613588.492507e+08有价格涨跌幅限制的日换手率达到30%的前五只证券74688667菱电电控2021-08-271家机构卖出，成功率49.69%123.37-18.899617.7701-2.079877e+064.611216e+074.819204e+079.430420e+07268503400-0.77461835.1221631.461225e+09有价格涨跌幅限制的日收盘价格跌幅达到15%的前五只证券[75rowsx16columns]>>># 获取指定日期区间的龙虎榜数据>>>start_date='2021-08-20'# 开始日期>>>end_date='2021-08-27'# 结束日期>>>ef.stock.get_daily_billboard(start_date=start_date,end_date=end_date)股票代码股票名称上榜日期解读收盘价涨跌幅换手率龙虎榜净买额龙虎榜买入额龙虎榜卖出额龙虎榜成交额市场总成交额净买额占总成交比成交额占总成交比流通市值上榜原因0000608阳光股份2021-08-27卖一主卖，成功率48.36%3.73-9.90343.8430-8.709942e+061.422786e+072.293780e+073.716565e+07110838793-7.85820833.5312682.796761e+09日跌幅偏离值达到7%的前5只证券1000751锌业股份2021-08-27主力做T，成功率18.84%5.32-2.919719.6505-1.079219e+085.638899e+071.643109e+082.206999e+081462953973-7.37698415.0859067.500502e+09日振幅值达到15%的前5只证券2000762西藏矿业2021-08-27北京资金买入，成功率39.42%63.991.074115.64632.938758e+074.675541e+084.381665e+089.057206e+0849599625980.59249618.2606333.332571e+10日振幅值达到15%的前5只证券3000833粤桂股份2021-08-27实力游资买入，成功率44.55%8.8710.04968.82634.993555e+071.292967e+087.936120e+072.086580e+088959104295.57372123.2900463.353614e+09连续三个交易日内，涨幅偏离值累计达到20%的证券4001208华菱线缆2021-08-271家机构买入，成功率40.43%19.724.338646.19854.055258e+071.537821e+081.132295e+082.670117e+0812039130483.36839822.1786512.634710e+09日换手率达到20%的前5只证券..................................................414605580恒盛能源2021-08-20买一主买，成功率33.33%13.2810.02490.40862.413149e+062.713051e+062.999022e+053.012953e+06271305188.945937111.0540546.640000e+08有价格涨跌幅限制的日收盘价格涨幅偏离值达到7%的前三只证券415688029南微医学2021-08-204家机构卖出，成功率55.82%204.61-18.53408.1809-1.412053e+081.883342e+083.295394e+085.178736e+08762045800-18.52976067.9583269.001510e+09有价格涨跌幅限制的日收盘价格跌幅达到15%的前五只证券416688408中信博2021-08-204家机构卖出，成功率47.86%179.98-0.066615.3723-4.336304e+073.750919e+084.184550e+087.935469e+08846547400-5.12234093.7392215.695886e+09有价格涨跌幅限制的日价格振幅达到30%的前五只证券417688556高测股份2021-08-20上海资金买入，成功率60.21%51.9717.049510.6452-3.940045e+071.642095e+082.036099e+083.678194e+08575411600-6.84735163.9228315.739089e+09有价格涨跌幅限制的日收盘价格涨幅达到15%的前五只证券418688636智明达2021-08-202家机构买入，成功率47.37%161.9015.833211.95782.922406e+076.598126e+073.675721e+071.027385e+0818833010015.51746454.5523361.647410e+09有价格涨跌幅限制的日收盘价格涨幅达到15%的前五只证券[418rowsx16columns]沪深 A 股股票季度表现>>>importefinanceasef>>>ef.stock.get_all_company_performance()# 默认为最新季度，亦可指定季度股票代码股票简称公告日期营业收入营业收入同比增长营业收入季度环比净利润净利润同比增长净利润季度环比每股收益每股净资产净资产收益率销售毛利率每股经营现金流量0688981中芯国际2021-08-2800:00:001.609039e+1022.25345320.65935.241321e+09278.100000307.80420.660011.9495255.2026.6656421.1825561688819天能股份2021-08-2800:00:001.625468e+109.34327923.90926.719446e+08-14.890000-36.87790.710011.9029126.1517.323263-1.5621872688789宏华数科2021-08-2800:00:004.555604e+0856.4184416.55051.076986e+0849.360000-7.30131.890014.92676113.5143.0112431.4212723688681科汇股份2021-08-2800:00:001.503343e+0817.706987121.94071.664509e+07-13.100000383.33310.21005.2325174.8447.455511-0.2323954688670金迪克2021-08-2800:00:003.209423e+07-63.282413-93.1788-2.330505e+07-242.275001-240.1554-0.35003.332254-10.1085.3085311.050348.............................................3720600131国网信通2021-07-1600:00:002.880378e+096.78708769.57942.171389e+0829.570000296.20510.18004.0632604.5719.137437-0.7986893721600644乐山电力2021-07-1500:00:001.257030e+0918.0796485.73008.379727e+07-14.30000025.00070.15563.1124135.1323.6451370.2009063722002261拓维信息2021-07-1500:00:008.901777e+0847.50528224.07326.071063e+0768.32000030.05960.05502.3515982.3737.047968-0.1318733723601952苏垦农发2021-07-1300:00:004.544138e+0911.75457047.87583.288132e+081.46000083.14860.24003.8880466.0515.491684-0.1737723724601568北元集团2021-07-0900:00:006.031506e+0932.54330330.63521.167989e+0961.05000040.81650.32003.5415339.0127.8792430.389860[3725rowsx14columns]股票历史单子流入数据(日级)>>>importefinanceasef>>>ef.stock.get_history_bill('300750')股票名称股票代码日期主力净流入小单净流入中单净流入大单净流入超大单净流入主力净流入占比小单流入净占比中单流入净占比大单流入净占比超大单流入净占比收盘价涨跌幅0宁德时代3007502021-03-184.453786e+0751241536.0-9.577939e+07-26680704.071218560.01.161.33-2.49-0.691.85335.560.841宁德时代3007502021-03-19-6.129661e+08423235296.01.897308e+08-244136864.0-368829200.0-10.136.993.14-4.03-6.09316.26-5.752宁德时代3007502021-03-22-5.674665e+08473253808.09.421272e+07-255868192.0-311598336.0-7.956.631.32-3.58-4.37307.56-2.753宁德时代3007502021-03-23-3.168412e+08131142880.01.856984e+08-349417168.032575936.0-6.882.854.03-7.590.71303.67-1.264宁德时代3007502021-03-24-5.999049e+08371268928.02.286360e+08-6849616.0-593055328.0-8.185.063.12-0.09-8.09288.55-4.98...............................................97宁德时代3007502021-08-09-1.152779e+09-596512.01.153376e+09-370189552.0-782589456.0-12.09-0.0112.10-3.88-8.21516.00-5.1398宁德时代3007502021-08-10-1.009431e+09-358999.01.009790e+09-392670720.0-616759952.0-11.03-0.0011.03-4.29-6.74510.50-1.0799宁德时代3007502021-08-111.305631e+08-475792.0-1.300873e+08-204097776.0334660864.02.25-0.01-2.25-3.525.78517.251.32100宁德时代3007502021-08-12-1.425337e+09-488240.01.425825e+09-454688192.0-970648896.0-16.58-0.0116.58-5.29-11.29502.00-2.95101宁德时代3007502021-08-13-3.111439e+08-895641.03.120392e+08-145200128.0-165943808.0-2.21-0.012.22-1.03-1.18502.050.01[102rowsx15columns]股票最新一个交易日单子流入数据(分钟级)>>>importefinanceasef>>>ef.stock.get_today_bill('300750')股票名称股票代码时间主力净流入小单净流入中单净流入大单净流入超大单净流入0宁德时代3007502021-08-1309:31-58855676.0-171274.059026945.022025460.0-80881136.01宁德时代3007502021-08-1309:32-50671227.0-190312.050861534.08927176.0-59598403.02宁德时代3007502021-08-1309:33-67833979.0-190312.068024288.034170593.0-102004572.03宁德时代3007502021-08-1309:34-28890553.0-220312.029110861.016373829.0-45264382.04宁德时代3007502021-08-1309:35-14955904.0-482660.015438561.014601153.0-29557057.0..........................235宁德时代3007502021-08-1314:56-311695708.0-895633.0312591337.0-144447542.0-167248166.0236宁德时代3007502021-08-1314:57-310641455.0-895633.0311537085.0-144697852.0-165943603.0237宁德时代3007502021-08-1314:58-311143584.0-895633.0312039214.0-145199981.0-165943603.0238宁德时代3007502021-08-1314:59-311143584.0-895633.0312039214.0-145199981.0-165943603.0239宁德时代3007502021-08-1315:00-311143584.0-895633.0312039214.0-145199981.0-165943603.0[240rowsx8columns]Fund获取基金历史净值信息>>>importefinanceasef>>>ef.fund.get_quote_history('161725')日期单位净值累计净值涨跌幅02021-07-291.27262.9037-1.5212021-07-281.29222.92330.8522021-07-271.28132.9124-3.632021-07-261.32922.9603-7.2442021-07-231.43293.0640-2.29...............15022015-06-081.03801.03802.569215032015-06-051.01201.01201.504515042015-06-040.99700.9970--15052015-05-290.99500.9950--15062015-05-271.00001.0000--[1507rowsx4columns]获取基金公开持仓信息>>>importefinanceasef>>># 获取最新公开的持仓数据>>>ef.fund.get_invest_position('161725')基金代码股票代码股票简称持仓占比较上期变化公开日期0161725600519贵州茅台16.781.362022-03-311161725600809山西汾酒15.200.522022-03-312161725000568泸州老窖14.57-0.892022-03-313161725000858五粮液12.83-1.262022-03-314161725002304洋河股份11.580.912022-03-315161725603369今世缘3.75-0.042022-03-316161725000799酒鬼酒3.40-0.912022-03-317161725000596古井贡酒3.27-0.242022-03-318161725600779水井坊2.59-0.262022-03-319161725603589口子窖2.30-0.382022-03-31多只基金信息>>>importefinanceasef>>># 获取多只基金基本信息>>>ef.fund.get_base_info(['161725','005827'])0161725招商中证白酒指数(LOF)A2015-05-27-6.031.1959招商基金2021-07-30产品特色：布局白酒领域的指数基金，历史业绩优秀，外资偏爱白酒板块。1005827易方达蓝筹精选混合2018-09-05-2.982.4967易方达基金2021-07-30明星消费基金经理另一力作，A+H股同步布局，价值投资典范，适合长期持有。Bond可转债整体行情>>>importefinanceasef>>>ef.bond.get_realtime_quotes()债券代码债券名称涨跌幅最新价最高最低涨跌额换手率动态市盈率成交量成交额昨日收盘总市值流通市值行情ID市场类型0123015蓝盾转债13.49198.613205.0175.523.613315.36-316062613480512.0175.01990567011990567010.123015深A1123077汉得转债9.59115.51122.971105.40110.1132.59-305380358093216.0105.4108233239610823323960.123077深A2123066赛意转债8.08232.377245.8225.017.377470.3-4542041081363632.0215.02244236652244236650.123066深A3128093百川转债7.69360.751367.9335.525.751343.84-5588741984944768.0335.05863643155863643150.128093深A4128082华锋转债7.41158.507163.769147.08910.935103.16-226444355827984.0147.5723479319003479319000.128082深A..................................................383123087明电转债-4.34151.75169.0150.302-6.879117.66-520370817884784.0158.6296711477606711477600.123087深A384123070鹏辉转债-4.63175.001179.799174.471-8.49918.46-144998257005833.0183.5137473068113747306810.123070深A385123027蓝晓转债-4.67338.413352.825338.015-16.58644.23-47356162870853.0354.9993623005583623005580.123027深A386113621彤程转债-5.03215.61222.5214.41-11.4111.46-91710200327611.0227.02172526809817252680981.113621沪A387123047久吾转债-5.7305.5319.52305.382-18.47122.41-193587600277600.0323.974831195334831195330.123047深A[388rowsx16columns]全部可转债信息>>>importefinanceasef>>>ef.bond.get_all_base_info()债券代码债券名称正股代码正股名称债券评级申购日期发行规模(亿)网上发行中签率(%)上市日期到期日期期限(年)利率说明0123120隆华转债300263隆华科技AA-2021-07-3000:00:007.989283NaNNone2027-07-3000:00:006第一年为0.40%、第二年为0.70%、第三年为1.00%、第四年为1.60%、第五年为2....1110081闻泰转债600745闻泰科技AA+2021-07-2800:00:0086.0000000.044030None2027-07-2800:00:006第一年0.10%、第二年0.20%、第三年0.30%、第四年1.50%、第五年1.80%、第...2118001金博转债688598金博股份A+2021-07-2300:00:005.9990100.001771None2027-07-2300:00:006第一年0.50%、第二年0.70%、第三年1.20%、第四年1.80%、第五年2.40%、第...3123119康泰转2300601康泰生物AA2021-07-1500:00:0020.0000000.014182None2027-07-1500:00:006第一年为0.30%、第二年为0.50%、第三年为1.00%、第四年为1.50%、第五年为1....4113627太平转债603877太平鸟AA2021-07-1500:00:008.0000000.000542None2027-07-1500:00:006第一年0.30%、第二年0.50%、第三年1.00%、第四年1.50%、第五年1.80%、第.........................................80110227赤化转债600227圣济堂AAA2007-10-1000:00:004.5000000.1588542007-10-2300:00:002009-05-2500:00:001.6192票面利率和付息日期:本次发行的可转债票面利率第一年为1.5%、第二年为1.8%、第三年为2....8112600607深高债600548深高速AAA2007-10-0900:00:0015.0000000.2903042007-10-3000:00:002013-10-0900:00:006None82110971恒源转债600971恒源煤电AAA2007-09-2400:00:004.0000005.3117742007-10-1200:00:002009-12-2100:00:002.2484票面利率为:第一年年利率1.5%,第二年年利率1.8%,第三年年利率2.1%,第四年年利率2...83110567山鹰转债600567山鹰国际AA2007-09-0500:00:004.7000000.4963912007-09-1700:00:002010-02-0100:00:002.4055票面利率和付息日期:本次发行的可转债票面利率第一年为1.4%,第二年为1.7%,第三年为2....84110026中海转债600026中远海能AAA2007-07-0200:00:0020.0000001.3334532007-07-1200:00:002008-03-2700:00:000.737票面利率:第一年为1.84%,第二年为2.05%,第三年为2.26%,第四年为2.47%,第...[585rowsx12columns]指定可转债 K 线数据>>>importefinanceasef>>># 可转债代码（以 东财转3 为例）>>>bond_code='123111'>>>ef.bond.get_quote_history(bond_code)债券名称债券代码日期开盘收盘最高最低成交量成交额振幅涨跌幅涨跌额换手率0东财转31231112021-04-23130.000130.000130.000130.00018364272.387355e+090.0030.0030.00011.621东财转31231112021-04-26130.353130.010133.880125.11086109441.126033e+106.750.010.01054.502东财转31231112021-04-27129.000129.600130.846128.40018207662.357472e+091.88-0.32-0.41011.523东财转31231112021-04-28129.100130.770131.663128.90314677271.921641e+092.130.901.1709.294东财转31231112021-04-29130.690131.208133.150130.56011569341.525974e+091.980.330.4387.32.........................................72东财转31231112021-08-09159.600159.300162.990158.6905961249.585751e+082.69-0.34-0.5503.7773东财转31231112021-08-10159.190160.950161.450157.0005172378.234596e+082.791.041.6503.2774东财转31231112021-08-11161.110159.850162.300159.4002989064.800711e+081.80-0.68-1.1001.8975东财转31231112021-08-12159.110158.290160.368158.0102706414.298100e+081.48-0.98-1.5601.7176东财转31231112021-08-13158.000158.358160.290157.8502500593.975513e+081.540.040.0681.58[77rowsx13columns]Futures获取交易所期货基本信息>>>importefinanceasef>>>ef.futures.get_futures_base_info()期货代码期货名称行情ID市场类型0ZCM动力煤主力115.ZCM郑商所1ZC201动力煤201115.ZC201郑商所2jm焦炭主力114.jm大商所3j2201焦炭2201114.j2201大商所4jmm焦煤主力114.jmm大商所..............846jm2109焦煤2109114.jm2109大商所847071108IH21088.071108中金所848070131IH次主力合约8.070131中金所849070120IH当月连续8.07012中金所850lu2109低硫燃油2109142.lu2109上海能源期货交易所[851rowsx4columns]获取期货历史行情>>>importefinanceasef>>># 获取全部期货行情ID列表>>>quote_ids=ef.futures.get_realtime_quotes()['行情ID']>>># 指定单个期货的行情ID(以上面获得到的行情ID列表为例)>>>quote_id=quote_ids[0]>>># 查看第一个行情ID>>>quote_ids[0]'115.ZCM'>>># 获取第行情ID为第一个的期货日 K 线数据>>>ef.futures.get_quote_history(quote_id)期货名称期货代码日期开盘收盘最高最低成交量成交额振幅涨跌幅涨跌额换手率0动力煤主力ZCM2015-05-18440.0437.6440.2437.6642.806300e+060.000.000.00.01动力煤主力ZCM2015-05-19436.0437.0437.6436.062.621000e+050.36-0.32-1.40.02动力煤主力ZCM2015-05-20436.8435.8437.0434.883.487500e+050.50-0.23-1.00.03动力煤主力ZCM2015-05-21438.0443.2446.8437.8371.631850e+062.061.657.20.04动力煤主力ZCM2015-05-22439.2441.4443.8439.2341.502500e+061.040.090.40.0..........................................1524动力煤主力ZCM2021-08-17755.0770.8776.0750.6823736.288355e+093.25-1.26-9.80.01525动力煤主力ZCM2021-08-18770.8776.8785.8766.0773926.016454e+092.591.7613.40.01526动力煤主力ZCM2021-08-19776.8777.6798.0764.6972297.597474e+094.300.030.20.01527动力煤主力ZCM2021-08-20778.0793.0795.0775.2705495.553617e+092.531.4811.60.01528动力煤主力ZCM2021-08-23796.8836.6843.8796.8829546.850341e+095.976.2849.40.0[1529rowsx13columns]>>># 指定多个期货的 行情ID>>>quote_ids=['115.ZCM','115.ZC109']>>>futures_df=ef.futures.get_quote_history(quote_ids)>>>type(futures_df)<class'dict'>>>>futures_df['115.ZCM']期货名称期货代码日期开盘收盘最高最低成交量成交额振幅涨跌幅涨跌额换手率0动力煤主力ZCM2015-05-18440.0437.6440.2437.6642.806300e+060.000.000.00.01动力煤主力ZCM2015-05-19436.0437.0437.6436.062.621000e+050.36-0.32-1.40.02动力煤主力ZCM2015-05-20436.8435.8437.0434.883.487500e+050.50-0.23-1.00.03动力煤主力ZCM2015-05-21438.0443.2446.8437.8371.631850e+062.061.657.20.04动力煤主力ZCM2015-05-22439.2441.4443.8439.2341.502500e+061.040.090.40.0..........................................1524动力煤主力ZCM2021-08-17755.0770.8776.0750.6823736.288355e+093.25-1.26-9.80.01525动力煤主力ZCM2021-08-18770.8776.8785.8766.0773926.016454e+092.591.7613.40.01526动力煤主力ZCM2021-08-19776.8777.6798.0764.6972297.597474e+094.300.030.20.01527动力煤主力ZCM2021-08-20778.0793.0795.0775.2705495.553617e+092.531.4811.60.01528动力煤主力ZCM2021-08-23796.8836.6843.8796.8829546.850341e+095.976.2849.40.0[1529rowsx13columns]Docs在线 API 文档 =>Docs如果需要本地使用，则可以使用sphinx来构建efinance的文档步骤如下克隆本仓库到本地gitclonehttps://github.com/Micro-sheep/efinance生成文档cdefinance/docs
pipinstall-rrequirements.txt--upgrade
sphinx-build../build-bhtml以上默认构建英文文档，如需构建中文文档，则最后一行代码改为sphinx-build../build-bhtml-Dlanguage=zh经过以上步骤，你将会在docs/build下看的生成的html文档同时，你也可以使用pdoc来构建efinance的文档步骤如下安装必要依赖pipinstallpdoc
gitclonehttps://github.com/Micro-sheep/efinance生成文档cdefinance
pdoc.-dnumpy进行以上步骤之后，你将可以在弹出的浏览器界面看到efinance的文档。Contact