Endpoint
GET https://altinapi.com/api/prices/ATA_YENI
cURL
bash
curl -H "x-api-key: hapi_xxxx" \
https://altinapi.com/api/prices/ATA_YENI
JSON Yanıt
JSON
{
"symbol": "ATA_YENI",
"category": "SARRAFIYE",
"bid": 23480.00, // alış fiyatı (TL/adet)
"ask": 23650.00, // satış fiyatı (TL/adet)
"timestamp": 1741784400000 // Unix ms
}
Python
Python
import requests API_KEY = "hapi_xxxx" url = "https://altinapi.com/api/prices/ATA_YENI" resp = requests.get(url, headers={"x-api-key": API_KEY}, timeout=5) data = resp.json() print(f"Ata Altın alış: {data['bid']} TL/adet") print(f"Ata Altın satış: {data['ask']} TL/adet")
JavaScript
JavaScript (fetch)
const resp = await fetch("https://altinapi.com/api/prices/ATA_YENI", { headers: { "x-api-key": "hapi_xxxx" }, }); const data = await resp.json(); console.log(`Ata Altın alış: ${data.bid} TL/adet`); console.log(`Ata Altın satış: ${data.ask} TL/adet`);
WebSocket Aboneliği
Fiyat her değiştiğinde anlık almak için WebSocket kullanın:
JavaScript (socket.io-client)
import { io } from "socket.io-client"; const socket = io("https://altinapi.com", { auth: { apiKey: "hapi_xxxx" }, }); socket.on("connect", () => { socket.emit("subscribe", ["ATA_YENI"]); }); socket.on("prices:update", ({ data }) => { const ata = data.find(p => p.symbol === "ATA_YENI"); if (ata) console.log(ata.bid, ata.ask); });
Tüm Fiyatlarla Birlikte
Tek istekte tüm kategorileri çekmek için /api/prices kullanın:
GET https://altinapi.com/api/prices
Yanıtta category: "SARRAFIYE" olanları filtreleyin — ATA_YENI bu grupta yer alır.