Repository navigation
Help with MultiFinancials - historical 5 year data #296
Replies: 1 comment
|
ticker = "OXY" # 修改为目标公司代码 =====================================获取桌面路径=====================================desktop_path = os.path.join( =====================================获取10-K文件=====================================company = Company(ticker) filings = ( print("正在获取年度报告...") =====================================创建XBRLS对象=====================================xbrls = XBRLS.from_filings(filings) =====================================数据整理函数=====================================def clean_statement(statement): =====================================提取三大报表=====================================print("正在提取损益表...") income_statement = xbrls.statements.income_statement( income_df = clean_statement( print("正在提取资产负债表...") balance_sheet = xbrls.statements.balance_sheet( balance_df = clean_statement( print("正在提取现金流量表...") cash_flow = xbrls.statements.cash_flow_statement( cashflow_df = clean_statement( =====================================导出Excel=====================================income_file = os.path.join( balance_file = os.path.join( cashflow_file = os.path.join( income_df.to_excel( balance_df.to_excel( cashflow_df.to_excel( =====================================完成提示=====================================print("\n==============================") print( print( print( |
Uh oh!
There was an error while loading. Please reload this page.
Hello,
I'm having difficulty getting historical data (e.g. last 5 years) using MultiFinancials
Can somebody help with what the right code should be?
Using the following code which I saw recommended, I get the error " 'function' object has no attribute 'to_dataframe' "
company = Company(ticker)
filings = company.latest("10-K", 5)
from edgar import MultiFinancials
financials = MultiFinancials(filings)
is_df = financials.income_statement.to_dataframe()
This next set of code executes but gives the wrong data (wrong row order and missing many rows vs. 'financials = company.get_financials()' request)
company = Company(ticker)
filings = company.latest("10-K",5)
from edgar import MultiFinancials
financials = MultiFinancials.extract(filings)
is_df = financials.income_statement().to_dataframe()
Much appreciated,
MT
All reactions