通过优矿API python获取财报
来源:互联网 发布:下载软件 英文 编辑:程序博客网 时间:2024/06/08 04:41
使用优矿平台的API:
import pandas as pd
universe = set_universe('A')
whole_set = pd.DataFrame()
for stock in universe:
try:
data = DataAPI.FdmtBSGet(ticker=u"",secID=stock,reportType=u"",endDate=u"20150930",beginDate=u"20150830",publishDateEnd=u"",publishDateBegin=u"",endDateRep="",beginDateRep="",beginYear="",endYear="",fiscalPeriod="",field=u"ticker,secShortName,endDate,reportType,tradingFA,htmInvest,availForSaleFa,LTEquityInvest,purResaleFa,investRealEstate",pandas="1")
whole_set = whole_set.append(data, ignore_index=True)
except Exception:
# print stock
pass
whole_set = whole_set.set_index(['ticker'], inplace=False).fillna(0)
whole_set.columns = ['名称', '期末日期', '类型', '交易性金融资产', '持有至到期投资', '可供出售金融资产', '长期股权投资', '买入返售金融资产', '投资性房地产']
for stock in universe:
try:
data = DataAPI.FdmtBSGet(ticker=u"",secID=stock,reportType=u"",endDate=u"20150930",beginDate=u"20150830",publishDateEnd=u"",publishDateBegin=u"",endDateRep="",beginDateRep="",beginYear="",endYear="",fiscalPeriod="",field=u"ticker,secShortName,endDate,reportType,tradingFA,htmInvest,availForSaleFa,LTEquityInvest,purResaleFa,investRealEstate",pandas="1")
whole_set = whole_set.append(data, ignore_index=True)
except Exception:
# print stock
pass
whole_set = whole_set.set_index(['ticker'], inplace=False).fillna(0)
whole_set.columns = ['名称', '期末日期', '类型', '交易性金融资产', '持有至到期投资', '可供出售金融资产', '长期股权投资', '买入返售金融资产', '投资性房地产']
whole_set.to_csv('invest_asset.csv', encoding='GB18030')
whole_set.sort('交易性金融资产', ascending=False).head(20)
ata = DataAPI.FdmtBSAllLatestGet(ticker=u"601398",secID=u"",reportType=u"",endDate=u"",beginDate=u"",field=u"ticker,secShortName,endDate,reportType,tradingFA,htmInvest,availForSaleFa,LTEquityInvest,purResaleFa,investRealEstate",pandas="1")
data = data.set_index('endDate', inplace=False).sort_index()
data = data.set_index('endDate', inplace=False).sort_index()
data['tradingFA'].plot(figsize=(15,8))
whole_set.sort('持有至到期投资', ascending=False).head(20)
whole_set.sort('持有至到期投资', ascending=False)[20:30]
data = DataAPI.FdmtBSAllLatestGet(ticker=u"600291",secID=u"",reportType=u"",endDate=u"",beginDate=u"",field=u"ticker,secShortName,endDate,reportType,tradingFA,htmInvest,availForSaleFa,LTEquityInvest,purResaleFa,investRealEstate",pandas="1")
data = data.set_index('endDate', inplace=False).sort_index()
data = data.set_index('endDate', inplace=False).sort_index()
data['htmInvest'].plot(figsize=(15,8))
whole_set.sort('可供出售金融资产', ascending=False).head(20)
whole_set.sort('可供出售金融资产', ascending=False)[20:30]
ata = DataAPI.FdmtBSAllLatestGet(ticker=u"600104",secID=u"",reportType=u"",endDate=u"",beginDate=u"",field=u"ticker,secShortName,endDate,reportType,tradingFA,htmInvest,availForSaleFa,LTEquityInvest,purResaleFa,investRealEstate",pandas="1")
data = data.set_index('endDate', inplace=False).sort_index()
data = data.set_index('endDate', inplace=False).sort_index()
data['availForSaleFa'].plot(figsize=(15,8))
whole_set.sort('长期股权投资', ascending=False).head(20)
data = DataAPI.FdmtBSAllLatestGet(ticker=u"601857",secID=u"",reportType=u"",endDate=u"",beginDate=u"",field=u"ticker,secShortName,endDate,reportType,tradingFA,htmInvest,availForSaleFa,LTEquityInvest,purResaleFa,investRealEstate",pandas="1")
data = data.set_index('endDate', inplace=False).sort_index()
data = data.set_index('endDate', inplace=False).sort_index()
data['LTEquityInvest'].plot(figsize=(15,8))
whole_set.sort('买入返售金融资产', ascending=False).head(20)
whole_set.sort('投资性房地产', ascending=False).head(20)
data = DataAPI.FdmtBSAllLatestGet(ticker=u"000926",secID=u"",reportType=u"",endDate=u"",beginDate=u"",field=u"ticker,secShortName,endDate,reportType,tradingFA,htmInvest,availForSaleFa,LTEquityInvest,purResaleFa,investRealEstate",pandas="1")
data = data.set_index('endDate', inplace=False).sort_index()
data = data.set_index('endDate', inplace=False).sort_index()
data['investRealEstate'].plot(figsize=(15,8))
阅读全文
2 0
- 通过优矿API python获取财报
- Python小工具——通过API获取天气预报
- 使用python通过聚币API获取价格数据
- 通过API获取天气
- .通过百度API获取经纬度
- 通过百度API获取经纬度
- python通过API查阅热点新闻
- python 通过zabbix api来获取当前trigger(告警)并打印出信息
- Python 获取Twitter话题 (API)
- python api获取与分析
- 通过python获取微秒时间
- 通过python获取美女图片
- 通过api获取句柄控制其他窗体
- 通过api获取句柄控制其他窗体
- 通过经纬度获取yahoo天气 API
- 通过Yahoo Finance API获取股票数据
- 通过Yahoo API 获取实时货币汇率
- 通过调用文摘列表API获取文摘
- EasyRecyclerAdapter
- 理解STL之Vector容器
- ArcSde的两种连接方式、区别
- nginx 13: Permission denied 错误
- Fresco简单的使用—SimpleDraweeView
- 通过优矿API python获取财报
- A Neural Probabilistic Language Model
- Eclipse里项目名有红叉,但是底下的每一个文件都没有红叉
- 算法之路-鸡兔同笼
- page,request,session,application四个域对象的使用及区别
- easyui + django 进度条
- android studio 找不到 Share Project(Subversion)
- sklearn库的体验-鸢尾花训练集
- 技术博客一:Android中的多线程