---
title: "Cron Price History Snapshot"
method: POST
path: "/cron/price-history-snapshot"
tags: ["cron"]
---

# Cron Price History Snapshot

`POST /cron/price-history-snapshot`

## Request

- Base URL: `https://api.equity-rank.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.equity-rank.com/cron/price-history-snapshot`
- Auth: none declared

Daily keep-fresh job for the price_history table — upserts the latest daily
OHLCV bars for the full active universe (screener_cache.ticker) via yfinance.

Schedule: daily ~22:30 UTC (after the US market close). Fetches a short trailing
window (default 5 calendar days) and upserts ON CONFLICT (symbol, date), so a
missed run / weekend / holiday self-heals on the next run with no duplicate rows.

Isolated infrastructure: yfinance ONLY (does NOT touch AlphaVantage / AV quota)
and does NOT trigger the screener batch.

Query params:
  lookback_days: optional override of the trailing fetch window (default 5).
    NOTE (PF-01 swap guard): a long manual window overlaps far more stored
    history. A symbol is withheld (logged ERROR "WITHHELD", nothing written
    for it) when EVERY overlapping stored close differs from the fetched
    series by >25% and not by one uniform split ratio -- e.g. a window that
    spans two splits while the stored bars reflect only one of them, so
    every overlapping date is off by 1/2 or 1/4. Repair such names with a
    targeted backfill (scripts/backfill_price_history_deep.py), not this
    override.

## Query parameters

- `lookback_days` integer, nullable

## Headers

- `x-cron-secret` string, nullable

## Response `202`

Successful Response

- object

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/equity-rank/apis/equity-rank-api.md) · [All operations](https://skmtc.dev/equity-rank/apis/equity-rank-api/llms.txt) · [OpenAPI document](https://skmtc.dev/equity-rank/apis/equity-rank-api/revisions/c2f2463fee33?raw)
