FinancialDatasetsTools 提供了一个全面的 API,用于从多个提供商检索和分析各种金融数据集,包括股价、财务报表、公司信息、SEC 备案文件和加密货币数据。
该工具包需要一个 Financial Datasets API 密钥,可以通过在 financialdatasets.ai 注册账户获得。
将您的 API 密钥设置为环境变量:
Financial Datasets 工具包的基本用法:
更多示例,请参阅 Financial Datasets Examples。
Parameter | Type | Default | Description |
---|---|---|---|
api_key | Optional[str] | None | 可选的 API 密钥。如果未提供,则使用 FINANCIAL_DATASETS_API_KEY 环境变量 |
enable_financial_statements | bool | True | 启用与财务报表相关的函数(损益表、资产负债表等) |
enable_company_info | bool | True | 启用公司信息相关函数 |
enable_market_data | bool | True | 启用市场数据相关函数(股价、收益、指标) |
enable_ownership_data | bool | True | 启用所有权数据相关函数(内部交易、机构持股) |
enable_news | bool | True | 启用新闻相关函数 |
enable_sec_filings | bool | True | 启用 SEC 备案文件相关函数 |
enable_crypto | bool | True | 启用加密货币相关函数 |
enable_search | bool | True | 启用搜索相关函数 |
Function | Description |
---|---|
get_income_statements(ticker: str, period: str = "annual", limit: int = 10) | 获取公司损益表,可选择年度、季度或过去十二个月(ttm)期间 |
get_balance_sheets(ticker: str, period: str = "annual", limit: int = 10) | 获取公司资产负债表,可选择期间 |
get_cash_flow_statements(ticker: str, period: str = "annual", limit: int = 10) | 获取公司现金流量表 |
get_company_info(ticker: str) | 获取公司信息,包括业务描述、行业和细分行业 |
get_crypto_prices(symbol: str, interval: str = "1d", limit: int = 100) | 获取加密货币价格,可配置时间间隔 |
get_earnings(ticker: str, limit: int = 10) | 获取收益报告,包含每股收益(EPS)预估、实际值和收入数据 |
get_financial_metrics(ticker: str) | 获取公司的关键财务指标和比率 |
get_insider_trades(ticker: str, limit: int = 50) | 获取内部人士买卖活动数据 |
get_institutional_ownership(ticker: str) | 获取机构投资者及其持仓信息 |
get_news(ticker: Optional[str] = None, limit: int = 50) | 获取市场新闻,可选择按公司筛选 |
get_stock_prices(ticker: str, interval: str = "1d", limit: int = 100) | 获取历史股价,可配置时间间隔 |
search_tickers(query: str, limit: int = 10) | 根据查询字符串搜索股票代码 |
get_sec_filings(ticker: str, form_type: Optional[str] = None, limit: int = 50) | 获取 SEC 备案文件,可选择按文件类型过滤(10-K、10-Q 等) |
get_segmented_financials(ticker: str, period: str = "annual", limit: int = 10) | 获取按产品类别和地理区域划分的细分财务数据 |
Financial Datasets API 可能会根据您的订阅级别设置使用限制。请参阅其文档了解具体的速率限制信息。