Officiële SDK-bibliotheken
Officiële clientbibliotheken voor Python, JavaScript, Go en Rust. Vereenvoudig API-integratie met getypeerde clients, automatische herlogica en WebSocket-ondersteuning.
Python SDK
Pakket: smartmoney-api
Installatie: pip install smartmoney-api
Repo: 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}")
Functies
- Async/await-ondersteuning (asyncio, aiohttp)
- Automatische herhaling met exponentiële backoff
- WebSocket-streaming met automatisch opnieuw verbinden
- Type hints en IDE-autocomplete
- Request logging en debugging
JavaScript SDK
Pakket: smartmoney-api
Installatie: npm install smartmoney-api
Repo: 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
Module: github.com/smartmoneyapi/go-client
Installatie: 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
", pos.WalletAddress, pos.PositionSize)
}
}
Rust SDK
Crate: smartmoney-api
Installatie: 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(())
}
Veelvoorkomende patronen
Foutafhandeling
Alle SDK's bieden uitgebreide fouttypes met automatische herlogica. Fouten omvatten statuscode, foutcode en een menselijk leesbaar bericht.
Request timeouts
Configureerbare request timeouts (standaard 30s). Stel aangepaste timeouts in voor langlopende operaties.
Rate Limit Handling
Automatische exponentiële backoff bij het bereiken van rate limits. Respecteert Retry-After header.
Kies je SDK
Begin met je taal van keuze. Volledige documentatie en voorbeelden zijn inbegrepen.
Bekijk API-referentie