AI ~20 min setup
ChatGPT / OpenAI Integration
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.
How It Works
1. User Asks
"Is EURUSD bullish?"
2. GPT Calls API
Fetches RSI, summary, screener via tools
3. GPT Analyzes
Combines data with reasoning for a grounded answer
Option 1: Custom GPT (No Code)
Create a Custom GPT in the ChatGPT interface that can query live market data:
- Go to Explore GPTs > Create a GPT
- Set the system prompt: "You are a forex analyst. Use your tools to fetch real-time data before answering."
- Under Actions, click Create new action
- Paste the OpenAPI schema below
- Under Authentication, select API Key with header
X-API-Key
json
{
"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": true, "schema": { "type": "string" } }
]
}
},
"/v1/summary": {
"get": {
"operationId": "getMarketSummary",
"summary": "Get AI market analysis with bias and confidence",
"parameters": [
{ "name": "symbol", "in": "query", "required": true, "schema": { "type": "string" } },
{ "name": "timeframe", "in": "query", "required": true, "schema": { "type": "string" } }
]
}
},
"/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": true, "schema": { "type": "string" } },
{ "name": "max", "in": "query", "schema": { "type": "number" } },
{ "name": "min", "in": "query", "schema": { "type": "number" } }
]
}
}
}
} Option 2: Function Calling (Python)
Define TickAtlas endpoints as OpenAI tools for programmatic use:
json
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": "AI market analysis with bias, confidence, and narrative 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"]
}
}
}
] Tool Call Handler
python
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()
return resp.json()
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"] = args["max"]
if "min" in args: params["min"] = 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)