Metadata-Version: 2.5
Name: finance-etl
Version: 0.2.0
Summary: Standard financial ETL workflows
Project-URL: Repository, https://github.com/PrettyGoodCapital/finance-etl
Project-URL: Homepage, https://github.com/PrettyGoodCapital/finance-etl
Author-email: PrettyGoodCapital <prettygoodcapital@gmail.com>
License: Apache-2.0
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Python: >=3.11
Requires-Dist: ccflow-etl[polars]>=0.4.3
Requires-Dist: ccflow-http>=0.4.0
Requires-Dist: ccflow>=0.9.3
Requires-Dist: finance-dates
Provides-Extra: develop
Requires-Dist: build; extra == 'develop'
Requires-Dist: bump-my-version; extra == 'develop'
Requires-Dist: check-dist; extra == 'develop'
Requires-Dist: codespell; extra == 'develop'
Requires-Dist: hatchling; extra == 'develop'
Requires-Dist: mdformat; extra == 'develop'
Requires-Dist: mdformat-myst; extra == 'develop'
Requires-Dist: mdformat-tables>=1; extra == 'develop'
Requires-Dist: pytest; extra == 'develop'
Requires-Dist: pytest-cov; extra == 'develop'
Requires-Dist: ruff; extra == 'develop'
Requires-Dist: twine; extra == 'develop'
Requires-Dist: ty; extra == 'develop'
Requires-Dist: uv; extra == 'develop'
Requires-Dist: wheel; extra == 'develop'
Description-Content-Type: text/markdown

# finance etl

Standard financial ETL workflows

[![Build Status](https://github.com/PrettyGoodCapital/finance-etl/actions/workflows/build.yaml/badge.svg?branch=main&event=push)](https://github.com/PrettyGoodCapital/finance-etl/actions/workflows/build.yaml)
[![codecov](https://codecov.io/gh/PrettyGoodCapital/finance-etl/branch/main/graph/badge.svg)](https://codecov.io/gh/PrettyGoodCapital/finance-etl)
[![License](https://img.shields.io/github/license/PrettyGoodCapital/finance-etl)](https://github.com/PrettyGoodCapital/finance-etl)
[![PyPI](https://img.shields.io/pypi/v/finance-etl.svg)](https://pypi.python.org/pypi/finance-etl)

## Overview

`finance-etl` provides reusable finance-specific ETL adapters on top of `ccflow` and the generic `ccflow-*` connector packages. It owns public finance data access concerns such as trading calendars, market sessions, provider request planning, credential config shapes, and finance-aware backfill helpers.

Applications compose these adapters into workflows and decide where data is stored. Provider credentials, private paths, and deployment-specific output stores stay outside this package.

## Quick Start

Compose the packaged calendar registry with `ccflow-etl`, then point a context at an explicit calendar path:

```yaml
defaults:
    - /backfills: default
    - /finance_calendars: default
    - _self_

hydra:
    searchpath:
        - pkg://ccflow_etl.config
        - pkg://finance_etl.config

context:
    start_datetime: 2024-07-01
    end_datetime: 2024-07-05
    calendar: /calendars/exchange/XNYS
```

Calendar paths are namespaced by code, for example `/calendars/exchange/XNYS`, `/calendars/exchange/XTKS/session/starts`, `/calendars/country/JP`, and `/calendars/region/us`.

Python callers use the same code-parameterized objects, such as `ExchangeCalendar["XNYS"]`, `RegionCalendar["US"]`, and `CountryCalendar["JP"]`.

Provider credentials are composed through Hydra groups. For Massive REST access:

```yaml
defaults:
    - /credentials: massive
    - _self_
```

The packaged credential config reads secrets from environment variables; it does not store secrets in public package config.

Massive stock REST wrappers also cover ticker overview (`/v3/reference/tickers/{ticker}`), grouped daily market summary (`/v2/aggs/grouped/locale/us/market/stocks/{date}`), and daily ticker open/close (`/v1/open-close/{ticker}/{date}`). `MassiveTickerOverviewBundleExtractModel` resolves a dated symbol universe, makes bounded concurrent single-ticker overview requests, resumes local JSONL staging, and publishes one compressed object per date.

Extract models write through a required `dataset` (`ccflow_etl.DatasetDefinition`), which supplies the partition key, stores, format, media type and first date; explain results include the dataset's plan record (`key`, `uri`).

`MassiveTickerOverviewBundleExtractModel` writes one compressed JSONL bundle per date and declares its symbol universe as a graph dependency when it will fetch. `ArtifactSymbolUniverseModel` reads symbols from a stored artifact and accepts an optional `source_model` that produces that artifact; the source model is declared as a dependency and called before the read. A bundle's overview model can set `accepted_status_codes: [404]` so tickers that no longer resolve are recorded as `not_found` without raising.

## Documentation

- [Calendars](docs/src/calendars.md)
- [Providers](docs/src/providers.md)
- [API](docs/src/api.md)
- [Development](docs/src/development.md)

## Dependency Contract

- May depend on `ccflow`, `ccflow-etl`, `ccflow-http`, `ccflow-s3`, `finance-dates`, and `finance-flow`.
- Should keep provider credentials and deployment-specific storage outputs out of package code.
- Must not depend on application-specific packages.

## Test Convention

Default tests should use synthetic market calendars and recorded or generated provider-shaped responses. They should not require live provider credentials, live S3, or live databases.
