Skip to main content

FXMacroData for Google Cloud Pub/Sub

Publish FXMacroData public responses to a Pub/Sub topic with the official google-cloud-pubsub Python client. Fan macro announcements out to your own subscribers 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/pubsub-fxmacrodata

Authenticate the Pub/Sub client with Application Default Credentials or the service account your administrator provides. Then publish to a customer-owned topic:

from google.cloud import pubsub_v1
from fxmacrodata_platform_core import read
from fxmacrodata_pubsub import publish

client = pubsub_v1.PublisherClient(
    publisher_options=pubsub_v1.types.PublisherOptions(enable_message_ordering=True),
)
batch = read("indicator_history", {"currency": "usd", "indicator": "policy_rate"})
result = publish(batch, client, "projects/my-project/topics/fxmacrodata")
print(result.messages, "messages in", result.batches, "blocks")

The topic must already exist. The destination is the full topic path, projects/<project>/topics/<topic>; anything else, including URLs and subscription paths, is rejected before any publish.

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_pubsub import publish_operation

publish_operation("release_calendar", {"currency": "usd"}, client,
                  "projects/my-project/topics/fxmacrodata", api_key_env="FXMD_API_KEY")

Message format

Each envelope row becomes one message. 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 message with record_json equal to "null", so absence of data and the server's metadata remain inspectable. It is not an observation.

Message attributes carry operation, record_id, content_hash and source_url for subscription filters. The ordering key is operation:record_id:content_hash; the same source record with the same content always produces the same key, and changed data or metadata produces a different one. Pass ordered=False to publish without an ordering key when the client was created without enable_message_ordering.

Delivery guarantee

Delivery is at-least-once. Messages are published in blocks of batch_size rows (1 to 10,000, 1,000 by default) and every block's futures are awaited before the next block starts. A failed block raises PublishError without the service's own diagnostic text and is not retried; earlier blocks may already be delivered. Subscribers should deduplicate on the ordering key, or on the operation, record_id and content_hash attributes. After an ordering-key failure the official client pauses that key; call resume_publish on the client before publishing the key again.

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 client you pass in. The adapter neither saves nor prints credentials and never places one in a message or attribute.

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

Development

Tests run offline against an in-memory fake client:

python -m pytest tests -q

Official SDK reference: Pub/Sub publisher client.

Metadata

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

Built distribution (wheel)

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

Total release size: 16.0 kB

Release files / pubsub_fxmacrodata-0.1.0.tar.gz

Download URL pubsub_fxmacrodata-0.1.0.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
620a4fd9ad16a8cd30be1ea4609777d4a99f08633768e26596a957a184c94f2e
BLAKE2b-256 checksum
How to use checksums
3607928b47806b150b04cebef2f16da3d421bf1d02213dcca84da04c6ae32623
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via FXMacroData-PackagePublisher/1.0

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

Download URL pubsub_fxmacrodata-0.1.0-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
64b6aab287ec7330498cb8343f7e6a96d62a8dc6b7ea8d45b9a8fa53285f2657
BLAKE2b-256 checksum
How to use checksums
4af5cd57e0270eaba5aa8341d167c1958293e529e59cb420d23201070a890df0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via FXMacroData-PackagePublisher/1.0

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