外围市场免费的股票财务数据接口难找,从雅虎财经提取财务数据可能是免费方案中最简单的方法,自从yahoo财经取消API支持后,只能自己爬取或使用第三方库,但是yahoo偶尔的页面变更和地区限制也给爬取数据造成很大困扰。
本文介绍我最近提交的yahoo_financials_stmt包获取股票财务数据 项目地址:https://github.com/luckfu/yahoo_financials_stmt
因为yahoo限制中国大陆地区使用,所以如果你在大陆地区,需要自行代理
使用说明:
安装 yahoo_financials_stmt
pip install git+https://github.com/luckfu/yahoo_financials_stmt.git
获取财务数据
import datetime
from yahoo_financials_stmt import YahooFinancialsStmt
yfs = YahooFinancialsStmt()
finances=yfs.get_financials('box')
查看数据
import datetime
from yahoo_financials_stmt import YahooFinancialsStmt
yfs = YahooFinancialsStmt()
finances.keys()
返回:
dict_keys(['balance_annual', 'balance_quarterly', 'earnings_annual', 'earnings_quarterly', 'income_annual', 'income_quarterly', 'cashflow_annual', 'cashflow_quarterly'])
balance 资产负债表年报
finances['balance_annual']
字段说明
balance Sheet 资产负债表
earnings 收益
https://www.investopedia.com/ask/answers/070715/what-difference-between-earnings-and-revenue.asp
字段 | 意义 | 解释 |
---|---|---|
revenue | 收入 | |
earnings | 收益 | 净收入 |
income Statement 损益表
字段 | 意义 | 解释 |
---|---|---|
researchDevelopment | 研发成本 | |
effectOfAccountingCharges | 会计费用的影响? | |
incomeBeforeTax | 税前收入 | |
minorityInterest | 少数股东权益 | https://www.investopedia.com/terms/m/minorityinterest.asp |
netIncome | 净收入 | |
sellingGeneralAdministrative | 销售及行政开支 | https://www.investopedia.com/terms/s/sga.asp |
grossProfit | 毛利润 | |
ebit | 息税前利润 | 不扣除利息也不扣除所得税的利润,也可以称为息前税前利润 |
operatingIncome | 营业收入 | |
otherOperatingExpenses | 其他业务支出 | |
interestExpense | 支付利息 | |
extraordinaryItems | 非经常项目 | 非经常、不常见收益或损失 2015 年 1 月,财务会计准则委员会 (FASB) 取消 |
nonRecurring | 非经常性费用 | | |
otherItems | ||
incomeTaxExpense | 所得税费用 | |
totalRevenue | 总收入 | | |
totalOperatingExpenses | 营业费用总额 | | |
costOfRevenue | 营收成本 | | |
totalOtherIncomeExpenseNet | 其它收入和费用总计 | |
maxAge | 周期 | |
discontinuedOperations | 终止经营 | https://www.investopedia.com/terms/d/discontinued-operations.asp |
netIncomeFromContinuingOps | 净持续经营收入 | |
netIncomeApplicableToCommonShares | 适用于普通股的净收入 | 扣除税收、非控股权益和优先股股息后可以给予股东的收入 |
cashflow Statement 现金流量表
字段 | 意义 | 解释 |
---|---|---|
investments | ||
changeToLiabilities | ||
totalCashflowsFromInvestingActivities | 投资活动产生的现金流量总量 | https://www.investopedia.com/articles/financial-theory/11/cash-flow-from-investing.asp |
netBorrowings | 净借款 | https://bizfluent.com/info-8618146-net-borrowings-statement-cash-flow.html |
totalCashFromFinancingActivities | 融资活动的现金流量 | https://www.investopedia.com/terms/c/cashflowfromfinancing.asp |
changeToOperatingActivities | 经营活动 | |
issuanceOfStock | 股票发行 | |
netIncome | 净收入 | |
changeInCash | 現金淨值變化 | |
effectOfExchangeRate | ||
totalCashFromOperatingActivities | 營運現金流量 | |
depreciation | 折旧和摊销 | |
changeToAccountReceivables | ||
otherCashflowsFromFinancingActivities | 其他融资活动 | |
maxAge | ||
changeToNetincome | ||
capitalExpenditures | 物业、厂房及设备投资 資本支出 | https://www.investopedia.com/terms/c/capitalexpenditure.asp |
repurchaseOfStock | 股票回购 | https://www.investopedia.com/terms/s/sharerepurchase.asp |