marketwatch

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

MarketWatch — Financial Data Scraper

MarketWatch — 金融数据抓取工具

Scraper de MarketWatch que extrae quotes en tiempo real, financial statements (income, balance sheet, cash flow), SEC filings, analyst estimates, options chain y historical prices para acciones US y ADRs globales.
No requiere API key. Los datos se extraen del HTML de las páginas públicas.

这是一款针对MarketWatch的数据抓取工具,可提取美国股票及全球ADR的实时报价财务报表(利润表、资产负债表、现金流量表)、SEC备案文件分析师预测期权链历史价格
无需API密钥,数据从公开页面的HTML中提取。

⚠️ Aviso Legal

⚠️ 法律声明

  • MarketWatch no tiene API pública oficial. Este scraper accede a datos públicamente disponibles en la web.
  • MarketWatch usa Datadome para protección anti-bot. El scraper utiliza headers de navegador completo para bypass.
  • Respetá los términos de servicio de MarketWatch.
  • Implementá rate limiting (mín 3 segundos entre requests, recomendado 5s).
  • El sitio puede cambiar su estructura HTML, rompiendo el scraper.

  • MarketWatch 无官方公开API,本工具仅访问网页上公开可用的数据。
  • MarketWatch采用Datadome反机器人防护,本工具通过完整的浏览器请求头绕过防护。
  • 请遵守MarketWatch的服务条款
  • 请设置请求频率限制(请求间隔至少3秒,推荐5秒)。
  • 网站可能会更改HTML结构,导致本工具失效。

Instalación

安装

bash
pip install requests beautifulsoup4

bash
pip install requests beautifulsoup4

Scripts

脚本

ScriptDescripción
fetch_marketwatch.pyScript principal: todos los endpoints

脚本描述
fetch_marketwatch.py主脚本:包含所有端点

Uso rápido

快速使用

bash
undefined
bash
undefined

Quote + perfil de compañía

报价 + 公司概况

python scripts/fetch_marketwatch.py --ticker AAPL --quote --profile
python scripts/fetch_marketwatch.py --ticker AAPL --quote --profile

Income statement anual (por defecto)

年度利润表(默认)

python scripts/fetch_marketwatch.py --ticker MSFT --income
python scripts/fetch_marketwatch.py --ticker MSFT --income

Income statement trimestral

季度利润表

python scripts/fetch_marketwatch.py --ticker AAPL --income --quarterly
python scripts/fetch_marketwatch.py --ticker AAPL --income --quarterly

Balance sheet + cash flow trimestral

季度资产负债表 + 现金流量表

python scripts/fetch_marketwatch.py --ticker NVDA --balance --cashflow --quarterly
python scripts/fetch_marketwatch.py --ticker NVDA --balance --cashflow --quarterly

Todos los financials (income + balance + cashflow)

全部财务报表(利润表 + 资产负债表 + 现金流量表)

python scripts/fetch_marketwatch.py --ticker AAPL --financials
python scripts/fetch_marketwatch.py --ticker AAPL --financials

SEC filings (10-K, 10-Q, 8-K)

SEC备案文件(10-K、10-Q、8-K)

python scripts/fetch_marketwatch.py --ticker AAPL --sec-filings
python scripts/fetch_marketwatch.py --ticker AAPL --sec-filings

Analyst estimates + target price

分析师预测 + 目标价

python scripts/fetch_marketwatch.py --ticker AAPL --analyst
python scripts/fetch_marketwatch.py --ticker AAPL --analyst

Options chain

期权链

python scripts/fetch_marketwatch.py --ticker AAPL --options
python scripts/fetch_marketwatch.py --ticker AAPL --options

Historical OHLCV

历史OHLCV数据

python scripts/fetch_marketwatch.py --ticker AAPL --historical
python scripts/fetch_marketwatch.py --ticker AAPL --historical

Todo lo disponible

获取所有可用数据

python scripts/fetch_marketwatch.py --ticker GGAL --all
python scripts/fetch_marketwatch.py --ticker GGAL --all

A JSON

导出为JSON

python scripts/fetch_marketwatch.py --ticker AAPL --all --output aapl.json
python scripts/fetch_marketwatch.py --ticker AAPL --all --output aapl.json

Control de rate limiting

设置请求间隔

python scripts/fetch_marketwatch.py --ticker AAPL --quote --delay 5

---
python scripts/fetch_marketwatch.py --ticker AAPL --quote --delay 5

---

Endpoints disponibles

可用端点

FlagDataFrecuenciaPeríodos
--quote
Precio, cambio, performance (5d, 1m, YTD)Tiempo real1 snapshot
--profile
Ratios clave, sector, industria, empleadosActual1 snapshot
--income
Income StatementAnual / Trimestral~5 años
--balance
Balance SheetAnual / Trimestral~5 años
--cashflow
Cash Flow StatementAnual / Trimestral~5 años
--financials
Income + Balance + Cash Flow (atajo)Según
--quarterly
~5 años
--sec-filings
SEC filings (10-K, 10-Q, 8-K)Histórico~20+ entradas
--analyst
Estimaciones, target price, recomendacionesTrimestral/anual~15+ campos
--options
Options chain (calls/puts por strike)Fechas de expiraciónTodas disponibles
--historical
OHLCV histórico diarioDiario~1-3 meses
--all
Todos los anterioresSegún
--quarterly
-

参数数据更新频率时间范围
--quote
价格、涨跌幅、表现(5日、1月、年初至今)实时单次快照
--profile
关键比率、行业、板块、员工数最新单次快照
--income
利润表年度/季度约5年
--balance
资产负债表年度/季度约5年
--cashflow
现金流量表年度/季度约5年
--financials
利润表+资产负债表+现金流量表(快捷参数)
--quarterly
参数而定
约5年
--sec-filings
SEC备案文件(10-K、10-Q、8-K)历史约20+条记录
--analyst
分析师预测、目标价、评级建议季度/年度约15+字段
--options
期权链(按行权价划分的认购/认沽期权)随到期日更新所有可用到期日
--historical
每日历史OHLCV数据每日约1-3个月
--all
获取以上所有数据
--quarterly
参数而定
-

Datos disponibles por endpoint

各端点可用数据

Quote

报价

Precio actual, cambio ($), cambio (%), Close anterior, y tabla de performance (5 Day, 1 Month, 3 Month, YTD, 1 Year).
当前价格、美元涨跌幅、百分比涨跌幅、昨日收盘价,以及表现表格(5日、1月、3月、年初至今、1年)。

Company Profile

公司概况

Hasta 29 ratios financieros incluyendo: P/E Current, P/E Ratio, EPS, Market Cap, Shares Outstanding, Revenue/Employee, Employees, Dividend Yield, Beta, etc.
最多包含29项财务比率,包括:动态市盈率、市盈率、每股收益、市值、流通股数、人均营收、员工数、股息率、贝塔系数等。

Financial Statements

财务报表

Cada statement contiene ~40-60 items (Revenue, COGS, Gross Profit, Operating Income, Net Income, EBITDA, EPS, etc. para income; Cash, Receivables, Total Assets, Debt, Equity, etc. para balance sheet; Operating Cash Flow, Free Cash Flow, Capex, etc. para cash flow).
每份报表包含约40-60项数据(利润表包含营收、销货成本、毛利润、营业利润、净利润、EBITDA、每股收益等;资产负债表包含现金、应收账款、总资产、负债、股东权益等;现金流量表包含经营现金流、自由现金流、资本支出等)。

SEC Filings

SEC备案文件

Listado de filings con: Filing Date, Document Date, Type (10-K, 10-Q, 8-K), Category.
备案文件列表包含:提交日期、文档日期、类型(10-K、10-Q、8-K)、类别。

Analyst Estimates

分析师预测

Average Recommendation, Average Target Price, Number of Ratings, High/Median/Low target, Current/Next Year Estimates, y tabla de cambios de rating por firma.
平均评级建议、平均目标价、评级数量、最高/中位/最低目标价、当前/下一年度预测,以及各机构评级变动表格。

Options

期权链

Options chain organizada por fecha de expiración con calls y puts, strikes, precios, volumen, open interest.
按到期日分类的期权链,包含认购/认沽期权、行权价、价格、成交量、持仓量。

Historical

历史数据

OHLCV diario con Date, Open, High, Low, Close, Volume (últimos ~60 días).

每日OHLCV数据,包含日期、开盘价、最高价、最低价、收盘价、成交量(最近约60天)。

Protección anti-bot (Datadome)

反机器人防护(Datadome)

MarketWatch usa Datadome para protegerse de scraping automatizado.
SituaciónSíntomaSolución
Muchos requests seguidos401 UnauthorizedAumentar
--delay
(mín 3s, ideal 5s)
IP bloqueada temporalmente401 incluso con delayEsperar 5-10 minutos
Headers incorrectos401 inmediatoUsar headers de navegador (ya incluidos)
Sin session cookies401El scraper maneja cookies automáticamente
Recomendación: No más de 4-5 endpoints por ticker por ejecución.

MarketWatch采用Datadome防护自动化抓取行为。
情况症状解决方案
连续发送大量请求401 未授权增加
--delay
参数值(至少3秒,建议5秒)
IP被临时封禁即使设置间隔仍返回401等待5-10分钟
请求头不正确立即返回401使用浏览器请求头(已内置)
无会话Cookie401本工具自动处理Cookie
建议: 每次执行针对单个股票最多请求4-5个端点。

Estructura del skill

工具结构

skills/marketwatch/
├── SKILL.md                              # Este archivo
├── references/
│   └── REFERENCE.md                      # Documentación completa de todos los endpoints
└── scripts/
    └── fetch_marketwatch.py              # Script principal

📖 Referencia completa: Para entender en detalle cada endpoint, columnas de options, campos de financials, estructura de historical data, etc., consultá references/REFERENCE.md.
skills/marketwatch/
├── SKILL.md                              # 本文档
├── references/
│   └── REFERENCE.md                      # 所有端点的完整文档
└── scripts/
    └── fetch_marketwatch.py              # 主脚本

📖 完整参考文档: 如需详细了解每个端点、期权链列、财务字段、历史数据结构等内容,请查看references/REFERENCE.md