GraphQL 端點
使用 GraphQL 查詢智能資金數據。通過靈活的查詢獲取您所需的字段,而不是固定的 REST 回應。
概覽
GraphQL 端點提供了 REST API 的替代方案。查詢您所需的內容 — 避免獲取未使用的字段和需要多次請求的不足。適用於 Pro 和 Enterprise 方案。
端點
URL: https://api.smartmoneyapi.com/graphql
方法: POST
內容類型: application/json
身份驗證
在 Authorization 標頭中包含您的 API 密鑰:
HTTP
POST /graphql HTTP/1.1
Host: api.smartmoneyapi.com
Authorization: Bearer sk_live_abc123xyz789
Content-Type: application/json
查詢範例
查詢:鯨魚持倉
GraphQL
query {
whalePositions(filter: {
symbol: "BTCUSDT"
exchange: "bybit"
direction: "long"
}, limit: 20) {
id
walletAddress
symbol
positionSize
entryPrice
currentPrice
pnl
pnlPercent
leverage
liquidationPrice
fundingRate
lastUpdated
}
}
查詢:跨交易所資金費率
GraphQL
query {
fundingRates(symbol: "BTCUSDT") {
timestamp
symbol
exchanges {
name
rate
nextRate
}
aggregated {
mean
median
spread
}
}
}
查詢:多個交易對
GraphQL
query GetMultipleSymbols($symbols: [String!]!) {
whalePositions(symbols: $symbols, limit: 10) {
symbol
totalPositions
totalLongSize
totalShortSize
averageEntryPrice
}
fundingRates(symbols: $symbols) {
symbol
bybit { rate }
binance { rate }
hyperliquid { rate }
}
}
查詢變數範例
JSON
{
"symbols": ["BTCUSDT", "ETHUSDT", "SOLUSDT"]
}
變更操作
創建 Webhook
GraphQL
mutation {
createWebhook(input: {
url: "https://yourapp.com/webhook"
events: ["whale.position.opened", "liquidation.large"]
active: true
}) {
id
url
events
active
createdAt
}
}
GraphQL 探索器
主要優勢
獲取您所需的內容: 無需過度獲取。僅請求您使用的字段。
單一請求獲取複雜數據: 無需分開調用即可獲取鯨魚持倉和資金費率。
強類型: 架構定義了所有類型和可用字段,並提供完整文檔。
更好的性能: 更小的回應負載,客戶端解析更快。
完整的自省: 直接在 GraphQL 工具中瀏覽可用的查詢和類型。