Skip to main content

yfinance-bigquery

Idempotent Yahoo Finance OHLCV → BigQuery ingestion across 5 intervals, with first-class documentation for SQL/LLM agents and internal-consistency verification.

Install

pip install yfinance-bigquery

Quickstart

gcloud auth application-default login

# 1. Seed your symbol universe from the S&P 500 Wikipedia page
yfinance-bigquery universe init \
    --dim-symbols myproject.mydataset.dim_symbols \
    --create-if-missing

# 2. Sync the last week of daily bars for every active ticker
yfinance-bigquery sync \
    --interval 1d \
    --dataset myproject.mydataset.yfinance_v2_analytics \
    --dim-symbols myproject.mydataset.dim_symbols

# 3. Spot-check internal consistency for the current year
yfinance-bigquery verify \
    --source internal \
    --interval 1d \
    --aggregation symbol-season \
    --metric all \
    --season 2026 \
    --table myproject.mydataset.ohlcv_1d

Backfill

Backfill all 5 intervals in resumable yearly chunks:

yfinance-bigquery sync \
    --interval all \
    --start 2020-01-01 --end 2026-05-11 \
    --chunk-by year --resume \
    --dataset myproject.mydataset.yfinance_v2_analytics \
    --dim-symbols myproject.mydataset.dim_symbols

--resume skips chunks already recorded as success in <dataset>._yfinance_ingest_runs. Override with --runs-table if you want the run log in a sidecar dataset. Re-running with the same --chunk-by is safe; switching --chunk-by year → month between runs will re-process (chunks must match exactly to skip).

Universe management

# Initialize dim_symbols (first run)
yfinance-bigquery universe init \
    --dim-symbols myproject.mydataset.dim_symbols \
    --create-if-missing

# Refresh constituents (tracks additions and marks removals with date_removed)
yfinance-bigquery universe refresh \
    --dim-symbols myproject.mydataset.dim_symbols

# List all active tickers
yfinance-bigquery universe list \
    --dim-symbols myproject.mydataset.dim_symbols

Documentation

yfinance-bigquery docs --format llm > LLM_CONTEXT.md

Five formats are supported: bq-apply (push column descriptions to BigQuery), llm (a single Markdown file suitable for stuffing into an LLM context window), dictionary (JSON rows for a data dictionary table), markdown (human-readable column reference), and dbt (a dbt YAML schema stub).

Verification

Internal-consistency checks run entirely inside BigQuery — no external data source required. All 5 metrics use zero-tolerance: any violation fraction > 0 is a FAIL.

# Check all metrics across all intervals for 2026
yfinance-bigquery verify \
    --source internal \
    --interval all \
    --aggregation symbol-season \
    --metric all \
    --season 2026 \
    --table-prefix myproject.mydataset.ohlcv

The 5 metrics are:

  • ohlc_monotonic — high >= open/close >= low for every bar
  • volume_non_negative — volume is NULL or >= 0
  • no_future_bars — no bar has a trading_date after today
  • trading_day_alignment — no weekend bars (1d) or out-of-hours bars (intraday)
  • no_duplicate_bars — no two bars share the same (symbol, bar_start_utc)

Seed your data dictionary

If you maintain a data_dictionary table (one row per column with business definitions, tags, and lineage), you can seed it directly:

yfinance-bigquery docs --format dictionary --apply \
    --dataset mydataset \
    --table myproject.mydataset.ohlcv_1d \
    --dictionary-table myproject.shared_ops.data_dictionary

Atomically replaces rows for (dataset, table) only; other entries in the dictionary table are untouched. Required target schema:

dataset, table, column, dtype, description, business_definition,
owner, tags ARRAY<STRING>, source_system, upstream_lineage_json,
created_at TIMESTAMP, updated_at TIMESTAMP

MIT licensed. This software does not include or distribute Yahoo Finance data.

Metadata

Release files for yfinance-bigquery 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yfinance-bigquery 0.2.0
File Size Uploaded Provenance
yfinance_bigquery-0.2.0.tar.gz 149.6 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for yfinance-bigquery 0.2.0
File Interpreter ABI Platform
yfinance_bigquery-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 199.2 kB

Release files / yfinance_bigquery-0.2.0.tar.gz

Download URL yfinance_bigquery-0.2.0.tar.gz
Size 149.6 kB
Tags Source
SHA-256 checksum
How to use checksums
15a80673779ecc5d24063c400e8f51ea4098715e73354d4ac80a6681224dc319
BLAKE2b-256 checksum
How to use checksums
ee7cf4cfc81fdda841ce491dd781fbafdf56f061d32c19b4a4e86f770a1db804
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 5, 2026.

Transparency log

Release files / yfinance_bigquery-0.2.0-py3-none-any.whl

Download URL yfinance_bigquery-0.2.0-py3-none-any.whl
Size 49.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b1967e297242bd07cc25e4bd53542e539232a710119f40aec7ee49fef52478f6
BLAKE2b-256 checksum
How to use checksums
24a5385b54e2c1ec10ebe2c1a0f6b4fd03cc22eefd0dd71ba1af7ee862f6a235
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 5, 2026.

Transparency log

Security for yfinance-bigquery 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for yfinance_bigquery-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 5, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page