中文
luckfu的潦草笔记

最初的梦想绝对会到达!


  • 首页

  • 归档

  • 关于我

  • 公益404

  • 搜索

python使用yahoo_financials_stmt包获取雅虎财经的股票财务数据

时间: 2022-05-21   |   分类: python   finance   | 字数: 949 字 | 阅读: 2分钟 | 阅读次数:

    外围市场免费的股票财务数据接口难找,从雅虎财经提取财务数据可能是免费方案中最简单的方法,自从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 资产负债表

字段意义解释
intangibleAssets无形资产
capitalSurplus资本溢价
totalLiab负债总额https://www.investopedia.com/terms/t/total-liabilities.asp
totalStockholderEquity总股东权益股东权益=总资产-负债总额
deferredLongTermLiab递延长期负债https://www.investopedia.com/terms/d/
otherCurrentLiab其他当前负债https://www.investopedia.com/terms/o/othercurrentliabilities.
totalAssets总资产
commonStock普通股https://www.investopedia.com/terms/c/commonstock.asp
otherCurrentAssets其他流动资产https://www.investopedia.com/terms/o/othercurrentassets.asp
retainedEarnings留存收益https://www.investopedia.com/terms/r/retainedearnings.asp
otherLiab其他流动负债https://www.investopedia.com/terms/o/othercurrentliabilities.asp
goodWill商誉https://www.investopedia.com/terms/g/goodwill.asp
treasuryStock库存股https://www.investopedia.com/ask/answers/what-is-treasury-stock
otherAssets其他资产https://www.accountingtools.com/articles/other-assets
cash现金现金及现金等价物
totalCurrentLiabilities流动负债总额“流动负债总额”是应付账款、应计负债和税金的总和。
otherStockholderEquity其它股东权益
propertyPlantEquipment固定资产(PPE)又称Fixed Assets(固定资产)
totalCurrentAssets流动资产总额
netTangibleAssets有形资产净值总资产-无形资产-负债
shortTermInvestments短期投资https://www.investopedia.com/terms/s/shorterminvestments.asp
netReceivables应收帐款净额
maxAge周期
longTermDebt长期债务指偿还期在一年或一个营业周期以上的债务,主要有长期借款、应付债券、长期应付款等
accountsPayable应付账款

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
#python# #股票# #财务数据#

声明:python使用yahoo_financials_stmt包获取雅虎财经的股票财务数据

链接:http://www.luckfu.com/post/2022-05-21_yahoo_financials_stmt/

作者:luckfu

声明: 本博客文章除特别声明外,均采用 CC BY-NC-SA 3.0许可协议,转载请注明出处!

创作实属不易,如有帮助,那就打赏博主些许茶钱吧 ^_^
WeChat Pay

微信打赏

Alipay

支付宝打赏

paypal Pay

PayPal打赏

中老年之友 Copilot
终于开通 github Codespace
  • 文章目录
  • 站点概览
luckfu

luckfu

一瞬间,过去的一切都离你而去,剩下的只有回忆!

31 日志
29 分类
41 标签
GitHub
标签云
  • 生活
  • Python
  • Oracle cloud
  • Free vps
  • Gpt
  • K8s
  • Vm.standard.a1.flex
  • Chatgpt
  • Github
  • Langchain
  • 安装 yahoo_financials_stmt
  • 获取财务数据
  • 查看数据
  • balance 资产负债表年报
  • 字段说明
    • balance Sheet 资产负债表
    • earnings 收益
    • income Statement 损益表
    • cashflow Statement 现金流量表
© 2010 - 2025 luckfu的潦草笔记
Powered by - Hugo v0.127.0 / Theme by - NexT
0%