Skip to main content

FXMacroData for OpenSearch

Load FXMacroData public responses into OpenSearch with the official opensearch-py Python client. Search and filter macro announcements while retaining the source payload and revision metadata.

FXMacroData documentation

Install and connect

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

python -m pip install /path/to/fxmacrodata-public-client /path/to/fxmacrodata-platform-core /path/to/opensearch-fxmacrodata

Configure FXMD_API_KEY, OPENSEARCH_HOST, OPENSEARCH_USER and OPENSEARCH_PASSWORD in your runtime secret store. Then load into a customer-owned cluster:

import os
from opensearchpy import OpenSearch
from fxmacrodata_platform_core import read
from fxmacrodata_opensearch import load

client = OpenSearch(
    hosts=[os.environ["OPENSEARCH_HOST"]],
    http_auth=(os.environ["OPENSEARCH_USER"], os.environ["OPENSEARCH_PASSWORD"]),
    use_ssl=True,
)
try:
    batch = read("indicator_history", {"currency": "usd", "indicator": "policy_rate"})
    result = load(batch, client, "fxmacrodata", batch_size=1000)
finally:
    client.close()

USD operations work without a key. For other currencies pass api_key_env="FXMD_API_KEY" to read or load_operation.

By default the loader creates the index with the envelope mapping when it does not exist. Set create_index=False to use an index provisioned by your administrator; index_mapping() returns the required body. Index names are one simple lowercase identifier such as fxmacrodata; dotted names, uppercase, leading underscores and URL-like names are rejected.

Every operation exposed by fxmacrodata_platform_core.operations() is available, including REST and MCP operations. The loader adds a document envelope without changing the original public response. record_json retains the original record; response_json retains the complete response, including pagination and metadata. An empty response produces one envelope with record_json = 'null', so absence of data and the server's metadata remain inspectable. It is not an observation.

Fields are operation, source_url, record_id, currency, indicator, date, announcement_datetime, value, value_text, record_json, response_json, and the loader's content_hash. The mapping is strict: value is a double; record_json and response_json are stored text fields with index: false (retrievable, not searchable); every other field is a keyword for exact filtering and aggregation. Dates and announcement times remain source strings rather than mapped dates, so no publication time is inferred and no missing value is filled. value_text and JSON preserve source numbers supplied as strings. JSON numeric tokens follow the public Python client parser, so original lexical precision is not guaranteed.

Select operations with the shared catalogue rather than constructing URLs:

from fxmacrodata_platform_core import operations, schemas

available = operations()
input_schemas = schemas()

load_operation accepts api_key_env, complete_history, max_pages, and client_factory for the public source reader. max_pages bounds history pagination; an incomplete read raises an error before a destination load starts. batch_size bounds destination blocks to 1���10,000 documents per bulk request. max_batch_bytes also bounds each block using a conservative JSON byte estimate (16 MiB by default, 128 MiB maximum). An oversized individual envelope is rejected before destination changes; narrow the source date range to reduce the response size. The source response is materialized before loading; choose a source date range suitable for memory. Read the installed operation's schema for required arguments and date filters.

Supply source credentials through your runtime secret store, exposing only the environment variable name to the adapter. Destination authentication belongs to the OpenSearch client you construct. The adapter neither saves nor prints credentials and never constructs connection settings for you.

The package licence covers this adapter code. FXMacroData data access and onward redistribution remain subject to your subscription and applicable licence. Loading data into a cluster does not grant permission to publish or resell it.

Retries and querying

Each envelope is one document created under the _id operation:record_id:content_hash using the bulk create operation. Retrying the same source batch is idempotent: an existing document answers with a 409 conflict, which the loader treats as already stored. Changed record data or response metadata produces a distinct content hash and is retained alongside the earlier version. Any other per-document rejection raises LoadError. document_id(row) returns the key.

{
  "query": {
    "bool": {
      "filter": [
        {"term": {"indicator": "policy_rate"}},
        {"term": {"currency": "USD"}}
      ],
      "must_not": [{"term": {"record_json": "null"}}]
    }
  },
  "sort": [{"date": "desc"}]
}

Delivery is at-least-once with an idempotent key. Blocks are not retried automatically. On a failure, earlier blocks and part of the failing block may be stored; retrying the same source batch is safe. LoadResult.rows counts envelopes submitted, rather than newly created documents.

See event_study.py for an announcement/price join. The example expects your own licensed market-price index and uses source announcement timestamps only. Timestamp presence alone is not evidence that a release had already been published; use source publication metadata when building a point-in-time backtest.

Development

Tests are offline and replace the bulk helper and client with fakes:

python -m pytest tests -q

Official client reference: opensearch-py helpers.

Metadata

Release files for opensearch-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)

Source distribution for opensearch-fxmacrodata 0.1.0
File Size Uploaded Provenance Actions
opensearch_fxmacrodata-0.1.0.tar.gz 12.9 kB Without provenance Details for opensearch_fxmacrodata-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for opensearch-fxmacrodata 0.1.0
File Interpreter ABI Platform Actions
opensearch_fxmacrodata-0.1.0-py3-none-any.whl Python 3 none any Details for opensearch_fxmacrodata-0.1.0-py3-none-any.whl

Total release size: 20.6 kB

Release files / opensearch_fxmacrodata-0.1.0.tar.gz

Download URL opensearch_fxmacrodata-0.1.0.tar.gz
Size 12.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a7bb65740d6b170b34f744569a0d70c29f21f92ee8f438f0b0927517bfd2adaf
BLAKE2b-256 checksum
How to use checksums
cf66f6cdd6d5361bd56aa15f6d831bd2a5ff559ebd976d46fc034b34bdb6ba61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via FXMacroData-PackagePublisher/1.0

Release files / opensearch_fxmacrodata-0.1.0-py3-none-any.whl

Download URL opensearch_fxmacrodata-0.1.0-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0d21c0261ddc6cd812c90068ab4c8577aac93f4eda09ea01f2dcfa839c459e9b
BLAKE2b-256 checksum
How to use checksums
7a45a575692b8d9122fc9e119362d2772115632ed2b0ded91f35a23ca3b513ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via FXMacroData-PackagePublisher/1.0

Security for opensearch-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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page