Skip to content
Getting started

SDKs and client libraries

Official FXMacroData clients for 7 languages connect research notebooks, statistical workflows and production applications to the financial-data API. Each one installs from its public package registry or source repository, with a first call you can run as written.

Published client libraries
Language Package Install Source
Python fxmacrodata on PyPI pip install fxmacrodata GitHub
R fxmacrodata/fxmacrodata-r, installed from GitHub install.packages("remotes") remotes::install_github("fxmacrodata/fxmacrodata-r") GitHub
Julia fxmacrodata/FXMacroData.jl, installed from GitHub using Pkg Pkg.add(url="https://github.com/fxmacrodata/FXMacroData.jl") GitHub
JavaScript / TypeScript @fxmacrodata/client on npm npm install @fxmacrodata/client npm
Go Go module github.com/fxmacrodata/fxmacrodata-go go get github.com/fxmacrodata/fxmacrodata-go GitHub
OCaml fxmacrodata on opam opam install fxmacrodata GitHub
PHP fxmacrodata/fxmacrodata-php, installed from GitHub composer config repositories.fxmacrodata vcs https://github.com/fxmacrodata/fxmacrodata-php composer require fxmacrodata/fxmacrodata-php:^0.1.0 GitHub
MCP (local, stdio) mcp-server-fxmacrodata on PyPI uvx mcp-server-fxmacrodata GitHub

All clients read the key from a constructor argument or the FXMACRODATA_API_KEY environment variable and send it in the X-API-Key header. Without a key they return USD data on the free terms described under free access. Get a key on the account page.

Data science & research

Python

PyPI v1.2.2

Typed synchronous and asynchronous clients for macro releases, FX history, calendars, positioning and commodities. Python 3.9 or newer.

Install
pip install fxmacrodata
Quickstart
from fxmacrodata import Client

client = Client(api_key="YOUR_API_KEY")

# Macro releases: AUD cash rate decisions in a window
data = client.get_indicator("aud", "policy_rate", start_date="2023-01-01", end_date="2023-11-01")

# FX history, optionally with indicators computed server-side
fx = client.get_fx_price("eur", "usd", indicators="sma_20,rsi_14,macd")

# Release calendar
calendar = client.get_calendar("usd")

R

GitHub v0.1.0

Data-frame outputs, parsed dates and response metadata for statistical analysis and research notebooks.

Install
install.packages("remotes")
remotes::install_github("fxmacrodata/fxmacrodata-r")
Quickstart
# Quickstart: latest US policy rate, release calendar and catalogue.
# USD works without a key; set FXMACRODATA_API_KEY for other currencies.
library(fxmacrodata)

rates <- fxmd_announcements("USD", "policy_rate")
latest <- rates[1, ]
cat(sprintf("USD policy rate: %s on %s\n", latest$val, latest$date))
cat(sprintf("Source: %s\n", fxmd_meta(rates)$source))

calendar <- fxmd_calendar("USD")
cat(sprintf("USD calendar: %d releases\n", nrow(calendar)))

catalogue <- fxmd_data_catalogue("USD")
cat(sprintf("USD catalogue: %d indicators\n", length(catalogue)))

Julia

GitHub

Announcements, revision history and release calendars for release-aware quantitative research.

Install
using Pkg
Pkg.add(url="https://github.com/fxmacrodata/FXMacroData.jl")
Quickstart
using Dates
using FXMacroData

client = Client()  # reads FXMACRODATA_API_KEY from the environment
inflation = announcements(
    client,
    "USD",
    "inflation";
    start_date=Date(2025, 1, 1),
    end_date=Date(2025, 12, 31),
    revisions="all",
)
calendar = release_calendar(client, "USD")

Application languages

JavaScript / TypeScript

npm v0.1.0

Typed Promise-based calls for announcements, calendars, catalogues, positioning and commodities, with MCP connection helpers. Node.js 18 or newer.

Install
npm install @fxmacrodata/client
Quickstart
import { FXMacroDataClient } from "@fxmacrodata/client";

const client = new FXMacroDataClient({ apiKey: process.env.FXMACRODATA_API_KEY });
const result = await client.announcements("aud", "policy_rate");

// Helpers for MCP hosts that need a URL or headers
import { createMcpHeaders, createMcpUrl } from "@fxmacrodata/client";
const headers = createMcpHeaders({ apiKey: process.env.FXMACRODATA_API_KEY });

Go

Go module v0.1.0

OpenAPI-generated requests and response models with context-based cancellation for financial-data applications.

Install
go get github.com/fxmacrodata/fxmacrodata-go
Quickstart
// Quickstart: latest US policy rate, release calendar and catalogue.
// USD works without a key; set FXMACRODATA_API_KEY for other currencies.
package main

import (
	"context"
	"fmt"
	"os"

	fxmacrodata "github.com/fxmacrodata/fxmacrodata-go"
)

func main() {
	client := fxmacrodata.NewAPIClient(fxmacrodata.NewConfiguration())
	ctx := context.Background()
	if key := os.Getenv("FXMACRODATA_API_KEY"); key != "" {
		ctx = context.WithValue(ctx, fxmacrodata.ContextAPIKeys, map[string]fxmacrodata.APIKey{
			"APIKeyHeader": {Key: key},
		})
	}

	rates, _, err := client.FXMacroDataAPI.GetAnnouncements(ctx, "USD", "policy_rate").Execute()
	if err != nil {
		fmt.Fprintln(os.Stderr, "announcements:", err)
		os.Exit(1)
	}
	if len(rates.Data) == 0 {
		fmt.Fprintln(os.Stderr, "announcements: no observations returned")
		os.Exit(1)
	}
	latest := rates.Data[0]
	fmt.Printf("USD policy rate: %.2f on %s\n", latest.GetVal(), latest.Date)

	if _, _, err := client.FXMacroDataAPI.GetCalendar(ctx, "USD").Execute(); err != nil {
		fmt.Fprintln(os.Stderr, "calendar:", err)
		os.Exit(1)
	}

	catalogue, _, err := client.FXMacroDataAPI.GetDataCatalogue(ctx, "USD").Execute()
	if err != nil {
		fmt.Fprintln(os.Stderr, "catalogue:", err)
		os.Exit(1)
	}
	fmt.Printf("USD catalogue: %d indicators\n", len(*catalogue))
}

OCaml

opam

Typed wrappers with asynchronous Lwt results for macro indicators, calendars, FX, positioning and commodities.

Install
opam install fxmacrodata
Quickstart
let () =
  let client = Fxmacrodata.create () in
  match
    Lwt_main.run
      (Fxmacrodata.macro_indicator client ~currency:"usd"
         ~indicator:"inflation" ~start_date:"2026-01-01" ())
  with
  | Ok rows -> Printf.printf "Fetched %d rows\n" (List.length rows)
  | Error e -> prerr_endline (Fxmacrodata.Error.to_string e)

PHP

GitHub v0.1.0

Typed requests and response models for every public endpoint, generated from the OpenAPI schema.

Install
composer config repositories.fxmacrodata vcs https://github.com/fxmacrodata/fxmacrodata-php
composer require fxmacrodata/fxmacrodata-php:^0.1.0
Quickstart
<?php
// Quickstart: latest US policy rate, release calendar and catalogue.
// USD works without a key; set FXMACRODATA_API_KEY for other currencies.
require_once __DIR__ . '/vendor/autoload.php';

$config = FXMacroData\Configuration::getDefaultConfiguration();
$key = getenv('FXMACRODATA_API_KEY');
if ($key) {
    $config->setApiKey('X-API-Key', $key);
}

$api = new FXMacroData\Api\FXMacroDataApi(new GuzzleHttp\Client(), $config);

$rates = $api->getAnnouncements('USD', 'policy_rate');
$latest = $rates->getData()[0] ?? null;
if ($latest === null) {
    fwrite(STDERR, "no observations returned\n");
    exit(1);
}
printf("USD policy rate: %s on %s\n", $latest->getVal(), $latest->getDate());

$api->getCalendar('USD');

$catalogue = $api->getDataCatalogue('USD');
printf("USD catalogue: %d indicators\n", count($catalogue));

MCP server, run locally

For AI clients the hosted server at https://mcp.fxmacrodata.com needs nothing installed. The local package is for stdio-only hosts; it exposes the core data tools and reads your key from FXMACRODATA_API_KEY.

uvx mcp-server-fxmacrodata
{
  "mcpServers": {
    "FXMacroData": {
      "command": "uvx",
      "args": ["mcp-server-fxmacrodata"],
      "env": { "FXMACRODATA_API_KEY": "YOUR_API_KEY" }
    }
  }
}

Full setup for Claude, ChatGPT, Cursor, VS Code and other hosts is on the MCP server page.

Any other language

The API is plain HTTPS and JSON, documented by an OpenAPI 3.1 schema.

  • Generate a client from https://api.fxmacrodata.com/openapi.json with any OpenAPI generator.
  • Or call it directly: curl -H "X-API-Key: YOUR_API_KEY" https://api.fxmacrodata.com/v1/announcements/eur/policy_rate?limit=1
  • Officially listed integrations for DuckDB, Apache Airflow, Singer / Meltano and Hermes are available under open source integrations.

AI Answer-Ready

Key Facts

Page
Sdks
Section
Documentation
Canonical URL
https://fxmacrodata.com/documentation/sdks
Source
FXMacroData editorial and official publisher references
Last Updated
See page metadata

Provenance And Trust

Cite the canonical URL and source field above. Where available, this page maps to official publisher releases and timestamped updates.

Quick Q&A

What is this page about? This page explains Sdks with directly usable context for trading, research, and API workflows.

What source should be cited? Use the canonical URL and the listed source field; cite official publisher references when available.

How fresh is this content? The last updated value above reflects the page metadata or latest available data timestamp.

Can this be used in AI assistants? Yes. This section is intentionally structured for retrieval and citation in chat assistants.

Prompt Packs

Use these in ChatGPT, Claude, Gemini, Mistral, Perplexity, or Grok for consistent source-aware outputs.