Metadata-Version: 2.4
Name: dask-fxmacrodata
Version: 0.1.0
Summary: Lazy Dask DataFrame source for public FXMacroData responses
License-Expression: MIT
Project-URL: Documentation, https://fxmacrodata.com/documentation/reference?utm_source=pypi&utm_medium=referral&utm_campaign=dask-fxmacrodata&utm_content=package
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: fxmacrodata-platform-core==0.1.0
Requires-Dist: dask[dataframe]<2027,>=2026.8.0
Requires-Dist: pandas<4,>=2
Provides-Extra: test
Requires-Dist: pytest<9,>=8; extra == "test"
Dynamic: license-file

# FXMacroData for Dask

Read FXMacroData public responses as a lazy Dask DataFrame. Join
macroeconomic releases, central-bank decisions, FX, commodities and positioning
data with your own partitioned datasets using ordinary Dask operations.

[FXMacroData documentation](https://fxmacrodata.com/documentation/reference?utm_source=github&utm_medium=referral&utm_campaign=dask-fxmacrodata&utm_content=readme)

## Install

Requires Python 3.10 or later and Dask 2026.8 or later. Install this package
and its adjacent public client dependencies from the distribution supplied to
you:

```sh
python -m pip install /path/to/fxmacrodata-public-client /path/to/fxmacrodata-platform-core /path/to/dask-fxmacrodata
```

## Example

USD data is available without a key:

```python
import dask.dataframe as dd
from fxmacrodata_dask import read_fxmacrodata

history = read_fxmacrodata("indicator_history", {"currency": "usd", "indicator": "policy_rate"})
observed = history[history["value"].notnull()][["date", "value", "record_json"]]
print(observed.compute())
```

`read_fxmacrodata` builds the graph without a request. `compute`, `persist`,
`to_parquet` or any other executing operation performs the read. The frame
has one partition because every operation returns one complete, bounded
response; repartition after the read if downstream work needs more.
Computing the same frame again performs a fresh read.

## Credentials

Set `FXMD_API_KEY` in your environment or secret manager and pass its name:

```python
calendar = read_fxmacrodata("release_calendar", {"currency": "eur"}, api_key_env="FXMD_API_KEY")
```

Only the variable name is stored in the task graph; the value is resolved by
the worker that executes the read. Omit `api_key_env` for anonymous access.
API keys, URLs and endpoint overrides are rejected as operation arguments.

## Data semantics

Columns are `operation`, `source_url`, `record_id`, `currency`, `indicator`,
`date`, `announcement_datetime`, `value`, `value_text`, `record_json` and
`response_json`. `value` is nullable `float64`; every other column is a
nullable `string[pyarrow]`. `record_json` retains the original record and
`response_json` retains the complete response, including pagination and
revision metadata. An empty response produces one envelope row with
`record_json = "null"`; it is not an observation. Dates and announcement
times remain source strings, no publication time is inferred and no missing
value is filled. `record_id` is a stable hash of the operation and record, so
repeated reads of unchanged data produce the same identifiers.

Historical operations follow all pages by default; `complete_history=False`
requests the supplied page only. `max_pages` (default 10,000) raises on an
incomplete history instead of truncating it. Every operation listed by
`fxmacrodata_platform_core.operations()` is available, including MCP tools
with an `mcp_` prefix. Access requirements remain those of the selected
operation.

## Development

Run the offline tests with `python -m pytest tests -q`. They monkeypatch the
public reader with fixture responses and never call the live service.
