Skip to main content

FXMacroData for Azure Event Hubs

Publish FXMacroData public responses to an Event Hub with the official azure-eventhub Python client. Stream macro announcements into your own consumers 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/eventhubs-fxmacrodata

Configure EVENTHUB_NAMESPACE in your runtime and authenticate the producer with azure-identity or the credential your administrator provides. Then publish to a customer-owned event hub:

import os
from azure.eventhub import EventHubProducerClient
from azure.identity import DefaultAzureCredential
from fxmacrodata_platform_core import read
from fxmacrodata_eventhubs import publish

client = EventHubProducerClient(
    fully_qualified_namespace=os.environ["EVENTHUB_NAMESPACE"],
    eventhub_name="fxmacrodata",
    credential=DefaultAzureCredential(),
)
with client:
    batch = read("indicator_history", {"currency": "usd", "indicator": "policy_rate"})
    result = publish(batch, client, "fxmacrodata")
print(result.messages, "events in", result.batches, "batches")

The event hub must already exist. The destination is the event hub name and must match the name the producer was created for; connection strings and URLs are rejected before any send.

Every operation exposed by fxmacrodata_platform_core.operations() is available, including REST and MCP operations. publish_operation reads one operation and publishes it in a single call:

from fxmacrodata_eventhubs import publish_operation

with client:
    publish_operation("release_calendar", {"currency": "usd"}, client, "fxmacrodata",
                      api_key_env="FXMD_API_KEY")

Event format

Each envelope row becomes one EventData. The body is canonical UTF-8 JSON with the keys operation, source_url, record_id, currency, indicator, date, announcement_datetime, value, value_text, record_json, response_json and the publisher's content_hash (SHA-256 of the ten source columns). Only value is numeric. Dates and announcement times remain source strings. No publication time is inferred, and no missing value is filled. record_json retains the original record; response_json retains the complete response, including pagination and metadata. An empty response produces one event with record_json equal to "null", so absence of data and the server's metadata remain inspectable. It is not an observation.

message_id is operation:record_id:content_hash; the same source record with the same content always produces the same id, and changed data or metadata produces a different one. The application properties operation, record_id, content_hash and source_url are set on every event, and content_type is application/json. No event timestamp is derived from the data.

Delivery guarantee

Delivery is at-least-once. Events are packed into EventDataBatch objects of at most batch_size events (1 to 10,000, 1,000 by default) and never larger than the hub's size limit; the whole response is packed before the first send_batch, so an event that cannot fit any batch fails before anything is delivered. A failed batch raises PublishError without the service's own diagnostic text and is not retried; earlier batches may already be delivered. Consumers should deduplicate on message_id, or on the operation, record_id and content_hash properties.

partition_key optionally routes every batch of a publish to one partition, for example the currency; by default the service assigns partitions. max_message_bytes (16 MiB by default) rejects an individual envelope larger than the budget before anything is published; narrow the source date range to reduce the response size. The source response is materialized before publishing; choose a source date range suitable for memory.

publish_operation accepts api_key_env, complete_history, max_pages and client_factory for the public source reader. Supply source credentials through your runtime secret store, exposing only the environment variable name; omit api_key_env for anonymous USD access. Destination authentication belongs to the official producer client you pass in. The adapter neither saves nor prints credentials and never places one in an event or property.

The package licence covers this adapter code. FXMacroData data access and onward redistribution remain subject to your subscription and applicable licence. Publishing data to an event hub does not grant permission to publish or resell it.

Development

Tests run offline against an in-memory fake producer:

python -m pytest tests -q

Official SDK reference: EventHubProducerClient.

Metadata

Release files for eventhubs-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 eventhubs-fxmacrodata 0.1.0
File Size Uploaded Provenance Actions
eventhubs_fxmacrodata-0.1.0.tar.gz 9.3 kB Without provenance Details for eventhubs_fxmacrodata-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 16.6 kB

Release files / eventhubs_fxmacrodata-0.1.0.tar.gz

Download URL eventhubs_fxmacrodata-0.1.0.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
20bf500931757ee422395b9e54af30d85da1f5cdab003a28d2ab969e4c55cd24
BLAKE2b-256 checksum
How to use checksums
8151e47f0a060e89c61c766776017a91fd5fc86df24239107ebd611d9be85ffa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via FXMacroData-PackagePublisher/1.0

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

Download URL eventhubs_fxmacrodata-0.1.0-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
92f5cb6bb07bd60fba92a808c823572a726586470df48f99dfba35d8a7dac1d8
BLAKE2b-256 checksum
How to use checksums
287573f995c11d42dd2eae9a1a013e5e0e9d027ed593b9323b657c1e1e94451f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via FXMacroData-PackagePublisher/1.0

Security for eventhubs-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