Opisyal na SDK Libraries
Opisyal na client libraries para sa Python, JavaScript, Go, at Rust. Pasimplehin ang API integration gamit ang typed clients, automatic retry logic, at WebSocket support.
Python SDK
Package: smartmoney-api
Installation: 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}")
Mga Tampok
- Suporta sa Async/await (asyncio, aiohttp)
- Automatic retry na may exponential backoff
- WebSocket streaming na may auto-reconnect
- Type hints at IDE autocomplete
- Request logging at debugging
JavaScript SDK
Package: smartmoney-api
Installation: 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
Installation: 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
Installation: 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(())
}
Mga Karaniwang Pattern
Pag-handle ng Error
Lahat ng SDK ay nagbibigay ng rich error types na may automatic retry logic. Kasama sa mga error ang status code, error code, at human-readable message.
Mga Request Timeouts
Configurable na request timeouts (default 30s). Magtakda ng custom timeouts para sa mga long-running operations.
Pag-handle ng Rate Limit
Automatic exponential backoff kapag na-hit ang rate limits. Sumusunod sa Retry-After header.
Pumili ng Iyong SDK
Magsimula gamit ang iyong napiling wika. Kasama ang buong dokumentasyon at mga halimbawa.
Tingnan ang API Reference