ספריות SDK רשמיות
ספריות לקוח רשמיות עבור Python, JavaScript, Go, ו-Rust. פשט את אינטגרציית ה-API עם לקוחות מוגדרים, לוגיקה של ניסיון חוזר אוטומטי ותמיכה ב-WebSocket.
Python SDK
חבילה: smartmoney-api
התקנה: pip install smartmoney-api
מאגר: github.com/smartmoneyapi/python-client
from smartmoney import SmartMoneyAPI
# Initialize client
client = SmartMoneyAPI(api_key="sk_live_abc123xyz789")
# Get whale positions
whales = client.whale_positions(symbol="BTCUSDT", limit=50)
for position in whales:
print(f"{position.wallet_address}: {position.position_size} BTC @ {position.entry_price}")
# Get funding rates
funding = client.funding_rates(symbol="BTCUSDT", interval="4h", limit=24)
# Stream live updates
with client.stream_whale_positions(["BTCUSDT", "ETHUSDT"]) as stream:
for update in stream:
print(f"Position update: {update}")
תכונות
- תמיכה ב-async/await (asyncio, aiohttp)
- ניסיון חוזר אוטומטי עם חזרה מעריכית
- זרמת WebSocket עם חיבור אוטומטי מחדש
- רמזי טיפוס והשלמה אוטומטית ב-IDE
- רישום בקשות וניפוי שגיאות
JavaScript SDK
חבילה: smartmoney-api
התקנה: npm install smartmoney-api
מאגר: github.com/smartmoneyapi/js-client
import { SmartMoneyAPI } from "smartmoney-api";
const client = new SmartMoneyAPI({
apiKey: "sk_live_abc123xyz789"
});
// Get whale positions
const whales = await client.whalePositions({
symbol: "BTCUSDT",
limit: 50
});
whales.positions.forEach(pos => {
console.log(`${pos.wallet_address}: ${pos.position_size} BTC`);
});
// Stream real-time updates
const stream = client.streamWhalePositions(["BTCUSDT", "ETHUSDT"]);
stream.on("data", (update) => {
console.log("Position update:", update);
});
stream.on("error", (err) => {
console.error("Stream error:", err);
});
Go SDK
מודול: github.com/smartmoneyapi/go-client
התקנה: go get github.com/smartmoneyapi/go-client
package main
import (
"fmt"
"github.com/smartmoneyapi/go-client"
)
func main() {
// Create client
client := smartmoney.NewClient("sk_live_abc123xyz789")
// Get whale positions
positions, err := client.WhalePositions(ctx, &smartmoney.WhalePositionsFilter{
Symbol: "BTCUSDT",
Limit: 50,
})
if err != nil {
panic(err)
}
for _, pos := range positions {
fmt.Printf("%s: %.2f BTC\n", pos.WalletAddress, pos.PositionSize)
}
}
Rust SDK
קרטה: smartmoney-api
התקנה: cargo add smartmoney-api
use smartmoney_api::Client;
#[tokio::main]
async fn main() -> Result<(), Box> {
let client = Client::new("sk_live_abc123xyz789");
// Get whale positions
let positions = client
.whale_positions()
.symbol("BTCUSDT")
.limit(50)
.send()
.await?;
for position in positions.iter() {
println!(
"{}: {} BTC @ {}",
position.wallet_address,
position.position_size,
position.entry_price
);
}
Ok(())
}
דפוסים נפוצים
טיפול בשגיאות
כל ה-SDKs מספקים סוגי שגיאות עשירים עם לוגיקה של ניסיון חוזר אוטומטי. שגיאות כוללות קוד סטטוס, קוד שגיאה והודעה קריאה לבני אדם.
פסקי זמן לבקשות
פסקי זמן לבקשות הניתנים להגדרה (ברירת מחדל 30 שניות). הגדר פסקי זמן מותאמים אישית לפעולות ארוכות טווח.
טיפול במגבלות קצב
חזרה מעריכית אוטומטית כאשר מגיעים למגבלות קצב. מכבד את כותרת Retry-After.
בחר את ה-SDK שלך
התחל עם השפה שבחרת. תיעוד מלא ודוגמאות כלולים.
צפה במדריך ה-API