1. User Asks
"Is EURUSD bullish?"
Give GPT-4o access to real-time market data. Build Custom GPTs with live indicators, or use function calling in your own applications to combine AI reasoning with fresh financial data.
"Is EURUSD bullish?"
Fetches RSI, summary, screener via tools
Combines data with reasoning for a grounded answer
Create a Custom GPT in the ChatGPT interface that can query live market data:
X-API-Key{
"openapi": "3.1.0",
"info": {
"title": "TickAtlas Market Data",
"version": "1.0.0"
},
"servers": [
{ "url": "https://tickatlas.com" }
],
"paths": {
"/v1/indicator": {
"get": {
"operationId": "getIndicator",
"summary": "Get a technical indicator value",
"parameters": [
{ "name": "symbol", "in": "query", "required": true, "schema": { "type": "string" } },
{ "name": "indicator", "in": "query", "required": true, "schema": { "type": "string" } },
{ "name": "timeframe", "in": "query", "required": false, "schema": { "type": "string", "default": "H1" } }
]
}
},
"/v1/summary": {
"get": {
"operationId": "getMarketSummary",
"summary": "Get rule-based market analysis with bias and confidence",
"parameters": [
{ "name": "symbol", "in": "query", "required": true, "schema": { "type": "string" } },
{ "name": "timeframe", "in": "query", "required": false, "schema": { "type": "string", "default": "H1" } }
]
}
},
"/v1/screener": {
"get": {
"operationId": "screenMarket",
"summary": "Scan symbols by indicator criteria",
"parameters": [
{ "name": "indicator", "in": "query", "required": true, "schema": { "type": "string" } },
{ "name": "timeframe", "in": "query", "required": false, "schema": { "type": "string", "default": "H1" } },
{ "name": "max_val", "in": "query", "schema": { "type": "number" } },
{ "name": "min_val", "in": "query", "schema": { "type": "number" } }
]
}
}
}
} Define TickAtlas endpoints as OpenAI tools for programmatic use:
tools = [
{
"type": "function",
"function": {
"name": "get_indicator",
"description": "Get a technical indicator value for a forex/crypto symbol",
"parameters": {
"type": "object",
"properties": {
"symbol": {"type": "string", "description": "Trading symbol, e.g. EURUSD"},
"indicator": {"type": "string", "description": "e.g. RSI_14, MACD_hist"},
"timeframe": {"type": "string", "enum": ["M1","M5","M15","M30","H1","H4","D1"]}
},
"required": ["symbol", "indicator", "timeframe"]
}
}
},
{
"type": "function",
"function": {
"name": "get_market_summary",
"description": "Rule-based market analysis: bias, confidence, and a plain-text summary for a symbol",
"parameters": {
"type": "object",
"properties": {
"symbol": {"type": "string"},
"timeframe": {"type": "string", "enum": ["M1","M5","M15","M30","H1","H4","D1"]}
},
"required": ["symbol", "timeframe"]
}
}
},
{
"type": "function",
"function": {
"name": "screen_market",
"description": "Scan all symbols to find those matching indicator criteria (e.g. RSI below 30 = oversold)",
"parameters": {
"type": "object",
"properties": {
"indicator": {"type": "string"},
"timeframe": {"type": "string", "enum": ["M1","M5","M15","M30","H1","H4","D1"]},
"max": {"type": "number"},
"min": {"type": "number"}
},
"required": ["indicator", "timeframe"]
}
}
}
] import os
import json
import requests
from openai import OpenAI
CLAW_API_KEY = os.environ["CLAW_API_KEY"]
CLAW_BASE = "https://tickatlas.com/v1"
def call_tickatlas(endpoint: str, params: dict) -> dict:
resp = requests.get(
f"{CLAW_BASE}/{endpoint}",
headers={"X-API-Key": CLAW_API_KEY},
params=params,
timeout=10,
)
resp.raise_for_status()
# Every success response is {"success": true, "data": {...}}
return resp.json()["data"]
def handle_tool_call(tool_call) -> str:
name = tool_call.function.name
args = json.loads(tool_call.function.arguments)
if name == "get_indicator":
result = call_tickatlas("indicator", {
"symbol": args["symbol"],
"indicator": args["indicator"],
"timeframe": args["timeframe"],
})
elif name == "get_market_summary":
result = call_tickatlas("summary", {
"symbol": args["symbol"],
"timeframe": args["timeframe"],
})
elif name == "screen_market":
params = {"indicator": args["indicator"], "timeframe": args["timeframe"]}
if "max" in args: params["max_val"] = args["max"]
if "min" in args: params["min_val"] = args["min"]
result = call_tickatlas("screener", params)
else:
result = {"error": f"Unknown tool: {name}"}
return json.dumps(result)
client = OpenAI()
messages = [
{"role": "system", "content": (
"You are a forex market analyst with access to real-time indicator data via the TickAtlas API. "
"When users ask about market conditions, use the tools to fetch current data before answering. "
"Always cite the actual values in your response."
)},
{"role": "user", "content": "Is EURUSD bullish right now? What does the RSI say?"},
]
response = client.chat.completions.create(model="gpt-4o", messages=messages, tools=tools)
while response.choices[0].message.tool_calls:
assistant_msg = response.choices[0].message
messages.append(assistant_msg)
for tool_call in assistant_msg.tool_calls:
result = handle_tool_call(tool_call)
messages.append({
"role": "tool",
"tool_call_id": tool_call.id,
"content": result,
})
response = client.chat.completions.create(model="gpt-4o", messages=messages, tools=tools)
print(response.choices[0].message.content)