FXMacroData for InfluxDB 3
Load FXMacroData public responses into InfluxDB 3 with the official
influxdb3-python client. Keep macro announcements next to your time-series
market data 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/influxdb3-fxmacrodata
Configure FXMD_API_KEY, INFLUX_HOST, INFLUX_TOKEN and INFLUX_DATABASE
in your runtime secret store. Then load into a customer-owned database:
import os
from influxdb_client_3 import InfluxDBClient3
from fxmacrodata_platform_core import read
from fxmacrodata_influxdb3 import load
client = InfluxDBClient3(
host=os.environ["INFLUX_HOST"],
token=os.environ["INFLUX_TOKEN"],
database=os.environ["INFLUX_DATABASE"],
)
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.
Pass the measurement name; InfluxDB creates the table on first write.
Measurement names are one simple identifier such as fxmacrodata; dotted
names, SQL fragments 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 tabular 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.
Columns are operation, source_url, record_id, currency, indicator,
date, announcement_datetime, value, value_text, record_json,
response_json, and the loader's content_hash. operation, currency,
indicator and record_id are tags; the rest are fields. Only value is
numeric (a float field, present only when the source has a numeric value);
everything else is a string field. Null values are omitted from the point.
record_id is a tag so that distinct envelopes written in one batch never
share a series and timestamp, which would otherwise overwrite one another.
Points carry no client-side time. InfluxDB assigns the ingestion timestamp
when a point arrives, so time records when you loaded the data, never when a
release was published. date and announcement_datetime remain source strings
in their own fields; 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 points per write call.
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. write_precision (ns by default; us, ms or s) is passed
through to the client. 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 InfluxDBClient3 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 database does not grant permission to publish or resell it.
Retries and querying
Delivery is at-least-once. InfluxDB has no unique key beyond series and time,
and because the server assigns the time, a retried batch appends points again
with a later timestamp. Every point carries content_hash (a digest of the ten
source columns), so duplicates are exact and easy to collapse:
SELECT currency, indicator, date, value, record_json
FROM (
SELECT *, row_number() OVER (PARTITION BY content_hash ORDER BY time DESC) AS n
FROM fxmacrodata
WHERE record_json <> 'null'
)
WHERE n = 1;
Changed record data or response metadata produces a distinct content hash and is
retained alongside the earlier version. Blocks are not retried automatically.
On a failure, earlier blocks may already be stored; retrying the same source
batch is safe when you deduplicate on content_hash as above.
LoadResult.rows counts envelopes submitted.
See event_study.sql for an announcement/price join. The example expects your own licensed market-price table 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, fake the client and use the real Point class:
python -m pytest tests -q
Official client reference: influxdb3-python.
Metadata
Release files for influxdb3-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 |
|---|---|---|---|---|
| influxdb3_fxmacrodata-0.1.0.tar.gz | 9.8 kB | Without provenance | Details for influxdb3_fxmacrodata-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| influxdb3_fxmacrodata-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for influxdb3_fxmacrodata-0.1.0-py3-none-any.whl |
Total release size: 17.2 kB
Release files / influxdb3_fxmacrodata-0.1.0.tar.gz
| Download URL | influxdb3_fxmacrodata-0.1.0.tar.gz |
|---|---|
| Size | 9.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ff9645e4954547c8d1b91ecb8308f2143b17d0af644f661dfb676683110d2472
|
|
BLAKE2b-256 checksum How to use checksums |
9d7841e3955ec02cccd5ef324ff62066d065fbc7af3ce288eb0cec9cd18c4e0e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
FXMacroData-PackagePublisher/1.0
|
Release files / influxdb3_fxmacrodata-0.1.0-py3-none-any.whl
| Download URL | influxdb3_fxmacrodata-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0491abe6a0a0bfe05f3a99e89030e442fb57076a9045826379372b9647211710
|
|
BLAKE2b-256 checksum How to use checksums |
a66e9b849bd40e59e994b2e362edfec707f960a5ce5eba7e0d4a76781b7e93fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
FXMacroData-PackagePublisher/1.0
|
Security for influxdb3-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.