FXMacroData for Redis Streams
Append FXMacroData public responses to a Redis Stream with the official
redis Python client. Feed macro announcements to your own consumer groups
while retaining the source payload and revision metadata.
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/redis-streams-fxmacrodata
Configure REDIS_URL (a rediss:// URL with the credentials your
administrator provides) in your runtime secret store. Then append to a
customer-owned stream:
import os
import redis
from fxmacrodata_platform_core import read
from fxmacrodata_redis_streams import publish
client = redis.Redis.from_url(os.environ["REDIS_URL"])
try:
batch = read("indicator_history", {"currency": "usd", "indicator": "policy_rate"})
result = publish(batch, client, "fxmacrodata:usd", maxlen=100_000)
print(result.messages, "entries in", result.batches, "pipelines")
finally:
client.close()
The destination is the stream key (letters, digits, _, ., :, / and
-, up to 256 characters); XADD creates it on first use. URLs and other
values are rejected before any command runs.
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_redis_streams import publish_operation
publish_operation("release_calendar", {"currency": "usd"}, client, "fxmacrodata:calendar",
api_key_env="FXMD_API_KEY")
Entry format
Each envelope row becomes one stream entry whose fields are the envelope
columns as strings: 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). A null column is omitted from the entry; value is
written as a Python float repr, such as 4.25, and value_text keeps the
source's own text. 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 entry with
record_json equal to null, so absence of data and the server's metadata
remain inspectable. It is not an observation.
The key field 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. Redis assigns the entry ID itself; no
timestamp is derived from the data.
Delivery guarantee
Delivery is at-least-once. Entries are appended in blocks of batch_size
rows (1 to 10,000, 1,000 by default), one non-transactional pipeline per
block. A failed block raises PublishError without the server's own
diagnostic text and is not retried; earlier blocks may already be stored, and
a partially executed pipeline may have appended some of its entries.
Consumers should deduplicate on the key field. maxlen applies an
approximate length bound (MAXLEN ~) on every XADD so the stream does not
grow without limit; by default no bound is applied.
max_message_bytes (16 MiB by default) rejects an individual envelope larger
than the budget before anything is appended; 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 an entry.
The package licence covers this adapter code. FXMacroData data access and onward redistribution remain subject to your subscription and applicable licence. Appending data to a stream does not grant permission to publish or resell it.
Development
Tests run offline against an in-memory fake client and pipeline:
python -m pytest tests -q
Official SDK reference: redis-py XADD.
Metadata
Release files for redis-streams-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 |
|---|---|---|---|---|
| redis_streams_fxmacrodata-0.1.0.tar.gz | 9.3 kB | Without provenance | Details for redis_streams_fxmacrodata-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| redis_streams_fxmacrodata-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for redis_streams_fxmacrodata-0.1.0-py3-none-any.whl |
Total release size: 16.5 kB
Release files / redis_streams_fxmacrodata-0.1.0.tar.gz
| Download URL | redis_streams_fxmacrodata-0.1.0.tar.gz |
|---|---|
| Size | 9.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ea7ccb2c8a19b7ddda2779eb3f20249d5599a3cda0eb68bda6a98ade69be7277
|
|
BLAKE2b-256 checksum How to use checksums |
01ab9ce93eae482a60b6d8f152e2497b1dcfc54ca3a9c66ed21e2ab715610995
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
FXMacroData-PackagePublisher/1.0
|
Release files / redis_streams_fxmacrodata-0.1.0-py3-none-any.whl
| Download URL | redis_streams_fxmacrodata-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c2de0b766b311570cb04113d1d2a7d28f02cd720253f60aca1bbd3aec1d110c3
|
|
BLAKE2b-256 checksum How to use checksums |
f11caa90fc2377fb9979e73e95aa1471b70fe7acec4c2b98506d18835f8a87b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
FXMacroData-PackagePublisher/1.0
|
Security for redis-streams-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.