marketwatch
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMarketWatch — 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 beautifulsoup4bash
pip install requests beautifulsoup4Scripts
脚本
| Script | Descripción |
|---|---|
| fetch_marketwatch.py | Script principal: todos los endpoints |
| 脚本 | 描述 |
|---|---|
| fetch_marketwatch.py | 主脚本:包含所有端点 |
Uso rápido
快速使用
bash
undefinedbash
undefinedQuote + 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
可用端点
| Flag | Data | Frecuencia | Períodos |
|---|---|---|---|
| Precio, cambio, performance (5d, 1m, YTD) | Tiempo real | 1 snapshot |
| Ratios clave, sector, industria, empleados | Actual | 1 snapshot |
| Income Statement | Anual / Trimestral | ~5 años |
| Balance Sheet | Anual / Trimestral | ~5 años |
| Cash Flow Statement | Anual / Trimestral | ~5 años |
| Income + Balance + Cash Flow (atajo) | Según | ~5 años |
| SEC filings (10-K, 10-Q, 8-K) | Histórico | ~20+ entradas |
| Estimaciones, target price, recomendaciones | Trimestral/anual | ~15+ campos |
| Options chain (calls/puts por strike) | Fechas de expiración | Todas disponibles |
| OHLCV histórico diario | Diario | ~1-3 meses |
| Todos los anteriores | Según | - |
| 参数 | 数据 | 更新频率 | 时间范围 |
|---|---|---|---|
| 价格、涨跌幅、表现(5日、1月、年初至今) | 实时 | 单次快照 |
| 关键比率、行业、板块、员工数 | 最新 | 单次快照 |
| 利润表 | 年度/季度 | 约5年 |
| 资产负债表 | 年度/季度 | 约5年 |
| 现金流量表 | 年度/季度 | 约5年 |
| 利润表+资产负债表+现金流量表(快捷参数) | 依 | 约5年 |
| SEC备案文件(10-K、10-Q、8-K) | 历史 | 约20+条记录 |
| 分析师预测、目标价、评级建议 | 季度/年度 | 约15+字段 |
| 期权链(按行权价划分的认购/认沽期权) | 随到期日更新 | 所有可用到期日 |
| 每日历史OHLCV数据 | 每日 | 约1-3个月 |
| 获取以上所有数据 | 依 | - |
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ón | Síntoma | Solución |
|---|---|---|
| Muchos requests seguidos | 401 Unauthorized | Aumentar |
| IP bloqueada temporalmente | 401 incluso con delay | Esperar 5-10 minutos |
| Headers incorrectos | 401 inmediato | Usar headers de navegador (ya incluidos) |
| Sin session cookies | 401 | El scraper maneja cookies automáticamente |
Recomendación: No más de 4-5 endpoints por ticker por ejecución.
MarketWatch采用Datadome防护自动化抓取行为。
| 情况 | 症状 | 解决方案 |
|---|---|---|
| 连续发送大量请求 | 401 未授权 | 增加 |
| IP被临时封禁 | 即使设置间隔仍返回401 | 等待5-10分钟 |
| 请求头不正确 | 立即返回401 | 使用浏览器请求头(已内置) |
| 无会话Cookie | 401 | 本工具自动处理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。