ohmydata 0.2__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. ohmydata-0.2.0/.gitignore +57 -0
  2. ohmydata-0.2.0/CHANGELOG.md +211 -0
  3. ohmydata-0.2.0/PKG-INFO +549 -0
  4. ohmydata-0.2.0/README.md +523 -0
  5. ohmydata-0.2.0/pyproject.toml +73 -0
  6. ohmydata-0.2.0/src/ohmydata/__init__.py +5 -0
  7. ohmydata-0.2.0/src/ohmydata/adapters/__init__.py +5 -0
  8. ohmydata-0.2.0/src/ohmydata/adapters/polars.py +164 -0
  9. ohmydata-0.2.0/src/ohmydata/cli.py +33 -0
  10. ohmydata-0.2.0/src/ohmydata/core/__init__.py +79 -0
  11. ohmydata-0.2.0/src/ohmydata/core/_vintage_lock.py +32 -0
  12. ohmydata-0.2.0/src/ohmydata/core/availability.py +139 -0
  13. ohmydata-0.2.0/src/ohmydata/core/errors.py +74 -0
  14. ohmydata-0.2.0/src/ohmydata/core/facts.py +376 -0
  15. ohmydata-0.2.0/src/ohmydata/core/policy.py +101 -0
  16. ohmydata-0.2.0/src/ohmydata/core/provenance.py +93 -0
  17. ohmydata-0.2.0/src/ohmydata/core/rate_limit.py +53 -0
  18. ohmydata-0.2.0/src/ohmydata/core/snapshot.py +563 -0
  19. ohmydata-0.2.0/src/ohmydata/core/specs.py +100 -0
  20. ohmydata-0.2.0/src/ohmydata/core/vintage.py +476 -0
  21. ohmydata-0.2.0/src/ohmydata/providers/__init__.py +5 -0
  22. ohmydata-0.2.0/src/ohmydata/providers/sec/__init__.py +144 -0
  23. ohmydata-0.2.0/src/ohmydata/providers/sec/artifacts.py +358 -0
  24. ohmydata-0.2.0/src/ohmydata/providers/sec/batch.py +1633 -0
  25. ohmydata-0.2.0/src/ohmydata/providers/sec/cli.py +630 -0
  26. ohmydata-0.2.0/src/ohmydata/providers/sec/core_dataset.py +587 -0
  27. ohmydata-0.2.0/src/ohmydata/providers/sec/edgar.py +228 -0
  28. ohmydata-0.2.0/src/ohmydata/providers/sec/edgartools_adapter.py +324 -0
  29. ohmydata-0.2.0/src/ohmydata/providers/sec/endpoints.py +139 -0
  30. ohmydata-0.2.0/src/ohmydata/providers/sec/errors.py +29 -0
  31. ohmydata-0.2.0/src/ohmydata/providers/sec/financials.py +168 -0
  32. ohmydata-0.2.0/src/ohmydata/providers/sec/financials_dataset.py +203 -0
  33. ohmydata-0.2.0/src/ohmydata/providers/sec/http.py +274 -0
  34. ohmydata-0.2.0/src/ohmydata/providers/sec/nport.py +961 -0
  35. ohmydata-0.2.0/src/ohmydata/providers/sec/qualification.py +1273 -0
  36. ohmydata-0.2.0/src/ohmydata/providers/sec/qualification_dataset.py +483 -0
  37. ohmydata-0.2.0/src/ohmydata/providers/tushare/__init__.py +138 -0
  38. ohmydata-0.2.0/src/ohmydata/providers/tushare/client.py +552 -0
  39. ohmydata-0.2.0/src/ohmydata/providers/tushare/endpoints.py +1020 -0
  40. ohmydata-0.2.0/src/ohmydata/providers/tushare/errors.py +36 -0
  41. ohmydata-0.2.0/src/ohmydata/providers/tushare/observations/__init__.py +17 -0
  42. ohmydata-0.2.0/src/ohmydata/providers/tushare/observations/capture.py +194 -0
  43. ohmydata-0.2.0/src/ohmydata/providers/tushare/observations/serialization.py +171 -0
  44. ohmydata-0.2.0/src/ohmydata/providers/tushare/recipes/__init__.py +67 -0
  45. ohmydata-0.2.0/src/ohmydata/providers/tushare/recipes/etf_adjusted_bars.py +184 -0
  46. ohmydata-0.2.0/src/ohmydata/providers/tushare/recipes/etf_index_mapping.py +180 -0
  47. ohmydata-0.2.0/src/ohmydata/providers/tushare/recipes/etf_pcf_history.py +135 -0
  48. ohmydata-0.2.0/src/ohmydata/providers/tushare/recipes/index_weight_vintage.py +271 -0
  49. ohmydata-0.2.0/src/ohmydata/providers/tushare/recipes/lookthrough_bundle.py +359 -0
  50. ohmydata-0.2.0/src/ohmydata/providers/tushare/recipes/shared.py +20 -0
  51. ohmydata-0.2.0/src/ohmydata/providers/tushare/recipes/weighted_dividend_yield.py +232 -0
  52. ohmydata-0.2.0/src/ohmydata/providers/tushare/vintage_artifacts.py +373 -0
  53. ohmydata-0.2.0/src/ohmydata/providers/tushare/vintage_canonical.py +41 -0
  54. ohmydata-0.2.0/src/ohmydata/providers/tushare/vintage_gates.py +267 -0
  55. ohmydata-0.2.0/src/ohmydata/providers/tushare/vintage_plane.py +453 -0
  56. ohmydata-0.2.0/src/ohmydata/providers/tushare/vintage_producer.py +64 -0
  57. ohmydata-0.2.0/src/ohmydata/providers/yfinance/__init__.py +81 -0
  58. ohmydata-0.2.0/src/ohmydata/providers/yfinance/client.py +389 -0
  59. ohmydata-0.2.0/src/ohmydata/providers/yfinance/endpoints.py +290 -0
  60. ohmydata-0.2.0/src/ohmydata/providers/yfinance/errors.py +58 -0
  61. ohmydata-0.2.0/src/ohmydata/providers/yfinance/fundamentals.py +428 -0
  62. ohmydata-0.2.0/src/ohmydata/providers/yfinance/quality.py +244 -0
  63. ohmydata-0.2.0/uv.lock +1265 -0
  64. ohmydata-0.2/LICENSE +0 -19
  65. ohmydata-0.2/PKG-INFO +0 -14
  66. ohmydata-0.2/README.md +0 -1
  67. ohmydata-0.2/pyproject.toml +0 -21
  68. ohmydata-0.2/src/ohmydata/__init__.py +0 -0
  69. ohmydata-0.2/src/ohmydata/easydb.py +0 -95
@@ -0,0 +1,57 @@
1
+ # Credentials and local configuration
2
+ .env
3
+ .env.*
4
+ !.env.example
5
+ *.pem
6
+ *.key
7
+ *.p12
8
+ *.pfx
9
+ credentials.json
10
+ secrets.json
11
+ token.json
12
+ *.local.*
13
+ config.yaml
14
+ config.yml
15
+ config.json
16
+ *sync*.yaml
17
+ *sync*.yml
18
+ *sync*.json
19
+
20
+ # Provider responses and local data
21
+ data/
22
+ downloads/
23
+ snapshots/
24
+ raw/
25
+ artifacts/
26
+ *.parquet
27
+ *.feather
28
+ *.arrow
29
+ *.duckdb
30
+ *.db
31
+
32
+ # Python environments and caches
33
+ .venv/
34
+ venv/
35
+ __pycache__/
36
+ *.py[cod]
37
+ .pytest_cache/
38
+ .ruff_cache/
39
+ .mypy_cache/
40
+ .pyright/
41
+ .coverage
42
+ htmlcov/
43
+
44
+ # Build and packaging output
45
+ build/
46
+ dist/
47
+ *.egg-info/
48
+
49
+ # Local tooling and OS files
50
+ .agents/
51
+ .codex/
52
+ .DS_Store
53
+ .idea/
54
+ .vscode/
55
+ *.log
56
+ tmp/
57
+ temp/
@@ -0,0 +1,211 @@
1
+ # Changelog
2
+
3
+ ## 0.2.0 — 2026-09-04
4
+
5
+ - Added official `yfinance` market data provider locked against `yfinance==1.5.1` baseline (`ohmydata[yfinance]`):
6
+ - Daily bars ingestion (`YFinanceDailyBarsRequest`, `YFinanceDailyBarsResult`) supporting US equities (`AAPL`), share classes (`BRK-B`), index tickers (`^VIX`, `^GSPC`), HK stocks (`0700.HK`), and FX pairs (`GBPUSD=X`).
7
+ - Shape normalization supporting MultiIndex column ordering variations and flat column single-symbol downloads into standard lowercase columns (`symbol`, `date`, `open`, `high`, `low`, `close`, `adj_close`, `volume`).
8
+ - Bounded per-symbol repair policy (`YFinanceRepairPolicy.PER_SYMBOL`) with auditable `YFinanceRepairReceipt` tracking to rescue dropped symbols from batch downloads.
9
+ - Quality and coverage validation (`validate_yfinance_daily_bar_coverage`) checking calendar sessions, missing symbols, and non-positive prices.
10
+ - Valuation snapshot and fundamentals ingestion (`YFinanceFundamentalsRequest`, `YFinanceFundamentalsResult`):
11
+ - Valuation metrics: trailing PE, forward PE, PEG, price-to-sales, market capitalization, shares outstanding.
12
+ - Quarterly financials: latest quarter vs prior-year same-quarter comparisons for revenue, operating income, net income, operating cash flow, capex, and free cash flow.
13
+ - Analyst consensus estimates across 4 horizons (`0q`, `+1q`, `0y`, `+1y`).
14
+ - Safety invariants: epoch-0 (`1970-01-01`) invalid report date rejection, `quoteType` equity qualification (flags non-equities such as ETFs/indexes/mutual funds), and strict null preservation (never synthesizing `0.0` for missing fields).
15
+ - High-level offline-testable `YFinanceClient` with dependency injection for unit tests without external network dependencies.
16
+
17
+ ## 0.1.7 — 2026-09-03
18
+
19
+ - Corrected SEC N-PORT Structural Qualification pipeline with source-based independent replay
20
+ and atomic staging publication:
21
+ - Fact tables are staged in private sibling directories (`.tmp-qualify-{uuid}`) before publication.
22
+ - Independent replay independently reconstructs all 4 fact tables from validated source partitions
23
+ and compares schemas, row counts, row values, logical hashes, and file SHA-256 digests against
24
+ staged candidate tables, catching coherent writer defects in tables and descriptors.
25
+ - Qualification receipts written to disk now record exact measured replay counters
26
+ (`replay_rows_read`, `replay_table_scans`), resolving zero counters on disk.
27
+ - Replay-dependent gates (`ARTIFACTS_REOPENED`, `SOURCE_VALIDATED`, and reconstruction gates)
28
+ are only set to True in the persisted receipt after independent validation succeeds.
29
+ - Directory publication is atomic (`stage_dir.replace(output)`), and any error, cancellation,
30
+ or deadline expiry leaves no published output directory and removes staging.
31
+ - `expected_receipt` in `reconstruct_and_verify_qualification` participates fully in verification
32
+ contracts.
33
+
34
+ ## 0.1.6 — 2026-09-03
35
+
36
+ - Added SEC N-PORT Structural Qualification V1 subsystem (`omd sec nport qualify`
37
+ and public Python API `qualify_sec_nport`).
38
+ - Implemented offline-only local artifact closure and catalog validation prerequisite
39
+ to ensure qualification never proceeds on partial or tampered local states.
40
+ - Implemented exact partition resolution per quarter with strict ambiguity rejection
41
+ (`AmbiguousPartitionError`) and canonical partition set resolution.
42
+ - Added comprehensive fact extractors:
43
+ - Quarter & fund coverage facts (`quarter_fund_coverage.parquet`)
44
+ - Vintage quality & exact decimal weight facts (`vintage_quality.parquet`)
45
+ - Amendment & revision family relations (`amendment_facts.parquet`)
46
+ - Identifier presence, multiplicity, duplicates, and conflict facts (`identifier_quality.parquet`)
47
+ - Tamper-evident qualification receipt (`qualification_receipt.json`)
48
+ - Added post-persist independent replay validator ensuring byte, logical hash, schema,
49
+ and row count integrity without trusting receipt gates.
50
+ - Added new core error types: `AmbiguousPartitionError` and `ResourceLimitError`.
51
+
52
+ ## 0.1.5 — 2026-09-03
53
+
54
+ - Added SEC EDGAR company financials ingestion and Point-in-Time (PIT) dataset
55
+ generator with isolated optional dependency `sec-financials` (`edgartools` + `pyarrow`).
56
+ - Implemented `SecFinancialsClient`, `SecFinancialsRequest`, `SecStatementRow`,
57
+ and `SecCompanyFinancialVintage` for extracting three core financial statements
58
+ (Balance Sheet, Income Statement, Cash Flow Statement) with standardized and native
59
+ XBRL concepts, exact Decimal precision, and official EDGAR acceptance timestamps.
60
+ - Added `omd sec financials {sync,inspect,validate}` CLI subcommands with `--config`
61
+ file support, `--latest` and `--limit` single/multi-filing filters, and SHA-256
62
+ signed Parquet lake partitions.
63
+ - Migrated codebase static type checker from Pyright to Astral's `ty`.
64
+ - Updated `us-data-update` skill to support company financial statements and latest
65
+ quarter reports.
66
+
67
+ ## 0.1.4 — 2026-09-03
68
+
69
+ - Added offline SEC N-PORT request, transport, artifact, parsing, and EDGAR
70
+ metadata primitives for caller-selected equity ETF series. Tests remain
71
+ offline; network access is explicit and caller-injected.
72
+ - Added the resumable `omd sec nport` batch CLI and immutable
73
+ `fund_vintages`/`holdings`/`identifiers` Parquet core dataset, with exact
74
+ receipt lineage, `--config` file support (JSON, YAML, TOML), `--quarters full`
75
+ and single-quarter shorthands, real-time stderr progress reporting and
76
+ `--quiet` suppression, offline validation/inspection, explicit availability
77
+ policy, and Git-safe output-root enforcement.
78
+ - Optimized core batch extraction performance with TSV predicate pushdown,
79
+ in-memory collision verification, and cached vintage payload hash properties,
80
+ achieving a >10x extraction speedup across multi-million row quarterly N-PORT
81
+ archives.
82
+ - Added support for SEC EDGAR historical submissions files with raw column
83
+ dictionaries and resilient single-series CIK matching across UIT Series ID
84
+ registrations.
85
+
86
+ ## 0.1.3 — 2026-08-09
87
+
88
+ - Added provider-neutral append-only source-fact registry and bounded offline ETF benchmark/constituent vintage artifacts. Tushare observations remain current-only where source availability is undocumented; completeness is fail-closed.
89
+
90
+ ## 0.1.2 — 2026-08-04
91
+
92
+ - Added deterministic observed-result capture
93
+ (`capture_tushare_result`, `TushareObservedResult`) that serializes
94
+ validated provider-native frames into append-only snapshots with explicit
95
+ `observed_at`, replay and round-trip verification, and no provider or
96
+ credential access.
97
+
98
+ - Added typed `stock_basic` and `index_member_all` endpoints with strict
99
+ selector/scope/date validation, explicit all-market and complete-history
100
+ opt-ins, duplicate and conflicting-membership fail-closed semantics,
101
+ provider-native value preservation, and documented row-cap ambiguity
102
+ detection (6000 / 2000).
103
+
104
+ - Added pure look-through evidence recipes: observed ETF→index mapping
105
+ versions (`build_etf_index_mapping_observations`), index-weight vintage
106
+ audits (`audit_index_weight_vintage`) with separate retrieval, weight-total,
107
+ expected-count, and economic-completeness statuses, and immutable
108
+ manifest-only source bundles (`build_lookthrough_source_bundle`). No
109
+ historical interval, `first_usable_session`, classification, or exposure is
110
+ inferred. Bundles fail closed on missing mapped-index vintages and missing
111
+ per-component industry observations.
112
+
113
+ - Added `docs/v0.1.2-lookthrough-migration.md` documenting the field-by-field
114
+ consumer boundary and the explicit statement that the historical funmoney
115
+ B6 look-through audit remains blocked.
116
+
117
+ ## 0.1.1 — 2026-08-03
118
+
119
+ - Added typed Shanghai/Shenzhen ETF PCF constituent endpoints and deterministic
120
+ fail-closed windowed history retrieval around the provider 3000-row limit.
121
+
122
+ ## 0.1.0 — 2026-08-02
123
+
124
+ - Documented the v0.1.0 public-contract changes, fail-closed upgrade behavior,
125
+ and funmoney/stock_notify consumer ownership boundaries.
126
+
127
+ - Added offline PIT fail-closed characterization fixtures covering revisions,
128
+ date-only availability, consumer cutoff boundaries, exact snapshot replay,
129
+ `fund_adj` pagination, and historical-vintage evidence.
130
+
131
+ - Hardened Tushare `fund_nav` and `fund_share` request/response semantics with
132
+ real-calendar validation, scope checks, stable ordering, revision
133
+ preservation, provider-native values, and explicit `fund_share` cap handling.
134
+
135
+ - Added immutable provider-native `RawFactEnvelope` metadata with conservative
136
+ availability quality flags and explicit same-key row revision evidence.
137
+
138
+ - Hardened Tushare `daily_basic` selectors and response validation with real
139
+ calendar dates, explicit symbol/date scope checks, stable identity ordering,
140
+ and ambiguous-cap detection while preserving provider-native values.
141
+
142
+ - Hardened Tushare `index_weight` selectors and response validation: exact or
143
+ complete single-month requests, requested-index/date scope checks, stable
144
+ identity ordering, and provider-native weight preservation.
145
+
146
+ - Added the typed, injected-client Tushare stock `dividend` endpoint with
147
+ provider-native revision preservation, explicit selectors, fields, and
148
+ empty-result policy.
149
+
150
+ - Added provider-independent `AvailabilityEvidence` with explicit source,
151
+ observation, UTC normalization, and conservative point-in-time semantics.
152
+
153
+ - Added immutable provider-independent snapshot observation receipts,
154
+ exact-payload fact versions, and first-observed timestamp semantics while
155
+ preserving legacy snapshot manifests and replay APIs.
156
+
157
+ - Added typed, injected-client Tushare stock `daily` and `adj_factor` endpoint
158
+ requests with explicit selectors, ordered fields, stable key validation,
159
+ empty-result policy, provenance, and ambiguous-cap detection.
160
+
161
+ ## 0.0.6 — 2026-08-02
162
+
163
+ - Added an explicit `empty_object_policy` to the Pandas→Polars adapter. The
164
+ default remains fail-closed; callers may opt into nullable Polars `String`
165
+ columns for empty or all-null Pandas `object` columns.
166
+
167
+ ## 0.0.5 — 2026-08-02
168
+
169
+ - Added the optional, representation-only Pandas↔Polars adapter with eager
170
+ conversions, narrow dtype support, and fail-closed schema validation.
171
+ - Added the typed Tushare `etf_basic` endpoint with explicit filters, stable
172
+ key validation and ordering, empty policy, provenance, and cap detection.
173
+
174
+ ## 0.0.4 — 2026-08-01
175
+
176
+ - Added the explicit `NORMALIZE_SUPPORTED` weighted-dividend-yield coverage
177
+ policy. It normalizes only over finite supported weight, preserves the
178
+ original coverage metadata, reports a distinct formula identifier, and
179
+ leaves minimum-coverage acceptance to the caller.
180
+
181
+ ## 0.0.3 — 2026-07-31
182
+
183
+ - Added offline weighted portfolio and index dividend-yield recipes with
184
+ explicit finite-coverage policies, provider-native units, and deterministic
185
+ formula metadata.
186
+
187
+ ## Unreleased — 0.0.2
188
+
189
+ - Fixed adjusted ETF bars to tolerate Tushare factor-date supersets for the
190
+ requested symbol without creating extra output rows. Foreign symbols still
191
+ fail, and strict coverage still requires every daily bar to have a finite
192
+ adjustment factor.
193
+
194
+ ## Unreleased — 0.0.1
195
+
196
+ - Added the offline-composable adjusted ETF bars recipe with explicit factor
197
+ coverage policy, raw-value preservation, provenance, and validation.
198
+
199
+ - Added an injected-client Tushare adapter for trade calendar and fund endpoint
200
+ requests with explicit validation, retry, provenance, pagination, and empty
201
+ result policies. Tushare/Pandas remain optional.
202
+
203
+ - Added the offline-only `ohmydata` package scaffold and Python 3.11/3.12 CI.
204
+ - Added synthetic adjusted-ETF bar characterization tests and fixtures.
205
+ - Added the initial consumers' Tushare behavioral inventory and conflict log.
206
+
207
+ - Added provider-independent request identity, stable errors, classified retry,
208
+ rate limiting, provenance, and atomic snapshot/replay primitives.
209
+ - Added typed Tushare Phase 2b endpoints for fund dividends, fund portfolios,
210
+ daily basics, and index weights with bounded selectors, explicit fields,
211
+ provenance, duplicate/cap validation, and provider-native units.