FXMacroData for Polars
Query FXMacroData as a native Polars lazy IO source. Combine macroeconomic releases, FX, commodities, positioning and research data with your own datasets using the same expressions, joins and sinks as other Polars scans.
Install
Install the polars-fxmacrodata wheel together with its
fxmacrodata-platform-core and fxmacrodata-public-client dependencies. The Polars IO
plugin API is unstable, so this package pins the supported Polars release.
From the supplied packages directory:
python -m pip install ./fxmacrodata-public-client ./fxmacrodata-platform-core ./polars-fxmacrodata
import polars as pl
from polars_fxmacrodata import operation_catalog, scan_fxmacrodata
# Local discovery includes operation arguments and requires no remote request.
print(operation_catalog().select("name", "description"))
print(operation_catalog().filter(pl.col("name") == "indicator_history"))
history = scan_fxmacrodata(
"indicator_history",
{"currency": "USD", "indicator": "policy_rate"},
api_key_env="FXMD_API_KEY",
)
result = (
history.filter(pl.col("value").is_not_null())
.select("date", "value", "record_json")
.collect()
)
Set FXMD_API_KEY using your environment or secret manager. Pass its name through
api_key_env; the source resolves its value when executing the query. Omitting
api_key_env explicitly selects anonymous access. Credentials do not belong in
arguments, notebooks, saved query plans or source control.
scan_fxmacrodata builds a plan without making a request. collect, a sink, or
another executing operation performs the read. Historical operations follow all
pages by default; complete_history=False requests the supplied page only.
max_pages defaults to 10,000 and raises on an incomplete history instead of
silently truncating it. Normal API access and licence terms apply.
Add release context to portfolio positions
Suppose positions.parquet contains currency and position_usd columns:
calendar = scan_fxmacrodata(
"release_calendar", {"currency": "USD"}, api_key_env="FXMD_API_KEY"
)
positions = pl.scan_parquet("positions.parquet")
exposure_by_event = (
calendar.filter(pl.col("announcement_datetime").is_not_null())
.select("currency", "indicator", "announcement_datetime", "record_json")
.join(positions, on="currency", how="inner")
.collect()
)
Calendar times retain the API's original strings. Unknown publication times stay null. An observation's period date is not substituted for its release time.
Data and query semantics
The fixed schema contains operation, source_url, record_id, currency,
indicator, date, announcement_datetime, value, value_text, record_json
and response_json. value is nullable Float64; other columns are nullable
String. record_json preserves the original record and response_json preserves
the complete response envelope, including metadata and revision information.
Empty results retain an envelope row with a null record. Inspect source_schema()
without fetching data.
The scanner applies pushed predicates before column projection and honours the
engine's row limit and batch-size hint. Predicates run in Polars and are not
translated into different API filters. Supply documented operation arguments to
reduce the remote dataset. The complete response is fetched before it is emitted
in dataframe batches; a final head() limits the result, not the remote history
request. Collecting the same plan again performs a fresh read.
All public REST operations and packaged MCP tools are exposed through the
operation catalog. MCP tool names have an mcp_ prefix. Authentication and
endpoint-specific access requirements remain those of the selected operation.
Development
Run the offline source tests with python -m pytest tests. They exercise native
Polars collection with fixture responses and never call the live service.
Metadata
Release files for polars-fxmacrodata 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| polars_fxmacrodata-0.1.0.tar.gz | 7.9 kB | Without provenance | Details for polars_fxmacrodata-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| polars_fxmacrodata-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for polars_fxmacrodata-0.1.0-py3-none-any.whl |
Total release size: 14.9 kB
Release files / polars_fxmacrodata-0.1.0.tar.gz
| Download URL | polars_fxmacrodata-0.1.0.tar.gz |
|---|---|
| Size | 7.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2a7bea32b477be225e800915ed560c819571401b95c663a3c9bf5c15425c6d38
|
|
BLAKE2b-256 checksum How to use checksums |
a3c20bfa622b96de07f3cf74a201672a7ad30939f6c393fdf2df1063419f1d96
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
FXMacroData-PackagePublisher/1.0
|
Release files / polars_fxmacrodata-0.1.0-py3-none-any.whl
| Download URL | polars_fxmacrodata-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
24a470d6caf2b33d7b5e65da22965dff415d84b209f698f785432ab10d03eba7
|
|
BLAKE2b-256 checksum How to use checksums |
3ee8033105f9aef3122a14d966547c8f1a8cf49bb664453612036724f5320ec6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
FXMacroData-PackagePublisher/1.0
|
Security for polars-fxmacrodata 0.1.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.