Skip to content

Code examples

All examples read the API key from an environment variable. Never hard-code keys.

Terminal window
export TRADERZ_API_KEY="tzk_..."
curl -X POST https://api.traderz.dev/v1/signals \
-H "Authorization: Bearer $TRADERZ_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"source": "binance",
"type": "crypto",
"symbol": "ETH/USDT",
"side": "open",
"direction": "long",
"price": 3450.5,
"client_signal_id": "trade-8842-open"
}'
const res = await fetch("https://api.traderz.dev/v1/signals", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.TRADERZ_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
source: "binance",
type: "crypto",
symbol: "ETH/USDT",
side: "open",
direction: "long",
price: 3450.5,
client_signal_id: "trade-8842-open",
}),
});
if (!res.ok) throw new Error(`signal rejected: ${res.status}`);
const { id, deduped } = await res.json();
console.log(deduped ? `already sent as ${id}` : `stored ${id}`);
import os, requests
resp = requests.post(
"https://api.traderz.dev/v1/signals",
headers={"Authorization": f"Bearer {os.environ['TRADERZ_API_KEY']}"},
json={
"source": "binance",
"type": "crypto",
"symbol": "ETH/USDT",
"side": "open",
"direction": "long",
"price": 3450.5,
"client_signal_id": "trade-8842-open",
},
timeout=10,
)
resp.raise_for_status()
data = resp.json()
print("deduped" if data.get("deduped") else "stored", data["id"])