Skip to main content

FXMacroData tools for LangChain

langchain-fxmacrodata is a standalone package that gives a LangChain agent the public FXMacroData API.

USD catalogue, USD macro history and the USD release calendar work with no API key and no account. For other data, set FXMACRODATA_API_KEY in the environment. The package sends that value as the X-API-Key header. A key is not a tool argument and is not written into the URL.

from langchain_fxmacrodata import fxmacrodata_tools

tools = fxmacrodata_tools()
catalogue = next(tool for tool in tools if tool.name == "fxmacrodata_data_catalogue_currency")
print(catalogue.invoke({"currency": "USD"}))

LangGraph

The same tools work in a LangGraph agent. Install the extra with pip install "langchain-fxmacrodata[langgraph]", then pass the tools to a ToolNode and bind them to any chat model that supports tool calling:

from langgraph.graph import START, MessagesState, StateGraph
from langgraph.prebuilt import ToolNode, tools_condition

from langchain_fxmacrodata import fxmacrodata_tools

tools = fxmacrodata_tools()
model = chat_model.bind_tools(tools)  # your LangChain chat model


def agent(state: MessagesState):
    return {"messages": [model.invoke(state["messages"])]}


graph = StateGraph(MessagesState)
graph.add_node("agent", agent)
graph.add_node("tools", ToolNode(tools))
graph.add_edge(START, "agent")
graph.add_conditional_edges("agent", tools_condition)
graph.add_edge("tools", "agent")
app = graph.compile()

app.invoke({"messages": [("user", "What USD indicators does FXMacroData cover?")]})

To keep a model's tool list short, pass only the tools you need, for example [tool for tool in tools if tool.name.startswith("fxmacrodata_calendar")].

Behaviour

Each tool calls one public GET route and returns the response body. A non-200 response comes back as JSON with status and body. This package does not call POST /v1/research/panel. The event tool can send Last-Event-ID and returns one response.

Requests go only to https://api.fxmacrodata.com.

Documentation: https://fxmacrodata.com/docs?utm_source=langchain&utm_medium=integration&utm_campaign=langchain-fxmacrodata&utm_content=readme-docs

Metadata

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

Built distribution (wheel)

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

Total release size: 15.2 kB

Release files / langchain_fxmacrodata-0.1.0.tar.gz

Download URL langchain_fxmacrodata-0.1.0.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
67eb85b6429a9525f4a162bb03b7f3a74a7b03000a911b6b56e1fdc6cf50c173
BLAKE2b-256 checksum
How to use checksums
23ce8ddb6d217d94f56f288b6e10c2b5d4418dec9d5ea0c689c090d947a41c63
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.14

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

Download URL langchain_fxmacrodata-0.1.0-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8332a51510772d46a865468dd2b23fd96795e99ec918bdbee94a4494d893cf6b
BLAKE2b-256 checksum
How to use checksums
7e9f36e4fce32f2ceb2a45c9fcc46004fb0da35160b4f9022f47553f22aef286
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.14

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