Thư viện SDK chính thức

Thư viện client chính thức cho Python, JavaScript, Go và Rust. Đơn giản hóa tích hợp API với client có kiểu, logic tự động thử lại và hỗ trợ WebSocket.

Python SDK

Gói: smartmoney-api

Cài đặt: pip install smartmoney-api

Kho lưu trữ: github.com/smartmoneyapi/python-client

Python
from smartmoney import SmartMoneyAPI # Khởi tạo client client = SmartMoneyAPI(api_key="sk_live_abc123xyz789") # Lấy vị thế cá voi whales = client.whale_positions(symbol="BTCUSDT", limit=50) for position in whales: print(f"{position.wallet_address}: {position.position_size} BTC @ {position.entry_price}") # Lấy tỷ lệ funding funding = client.funding_rates(symbol="BTCUSDT", interval="4h", limit=24) # Theo dõi cập nhật trực tiếp with client.stream_whale_positions(["BTCUSDT", "ETHUSDT"]) as stream: for update in stream: print(f"Position update: {update}")

Tính năng

  • Hỗ trợ async/await (asyncio, aiohttp)
  • Tự động thử lại với backoff theo cấp số nhân
  • WebSocket streaming với tự động kết nối lại
  • Gợi ý kiểu và tự động hoàn thành trên IDE
  • Ghi log và debug request

JavaScript SDK

Gói: smartmoney-api

Cài đặt: npm install smartmoney-api

Kho lưu trữ: github.com/smartmoneyapi/js-client

JavaScript
import { SmartMoneyAPI } from "smartmoney-api"; const client = new SmartMoneyAPI({ apiKey: "sk_live_abc123xyz789" }); // Lấy vị thế cá voi const whales = await client.whalePositions({ symbol: "BTCUSDT", limit: 50 }); whales.positions.forEach(pos => { console.log(`${pos.wallet_address}: ${pos.position_size} BTC`); }); // Theo dõi cập nhật thời gian thực 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

Cài đặt: go get github.com/smartmoneyapi/go-client

Go
package main import ( "fmt" "github.com/smartmoneyapi/go-client" ) func main() { // Tạo client client := smartmoney.NewClient("sk_live_abc123xyz789") // Lấy vị thế cá voi 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

Crate: smartmoney-api

Cài đặt: cargo add smartmoney-api

Rust
use smartmoney_api::Client; #[tokio::main] async fn main() -> Result<(), Box> { let client = Client::new("sk_live_abc123xyz789"); // Lấy vị thế cá voi 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(()) }

Mẫu phổ biến

Xử lý lỗi

Tất cả SDK cung cấp kiểu lỗi chi tiết với logic tự động thử lại. Lỗi bao gồm mã trạng thái, mã lỗi và thông báo dễ hiểu.

Thời gian chờ request

Thời gian chờ request có thể cấu hình (mặc định 30s). Đặt thời gian chờ tùy chỉnh cho các thao tác dài.

Xử lý giới hạn tốc độ

Tự động backoff theo cấp số nhân khi đạt giới hạn tốc độ. Tuân thủ header Retry-After.

Chọn SDK của bạn

Bắt đầu với ngôn ngữ bạn chọn. Bao gồm đầy đủ tài liệu và ví dụ.

Xem tài liệu API
Bắt đầu miễn phí — 100 lần gọi/ngày, không cần thẻ

Nhận dòng tiền cá voi, funding, open interest và dữ liệu on-chain từ 3 sàn giao dịch từ một API duy nhất. Miễn phí, không cần thẻ, nâng cấp bất cứ lúc nào.

Bắt đầu miễn phí →
Dùng thử console API trực tiếp → (không cần tài khoản)
Nhận API key của bạn trong 30 giây

Sẵn sàng xây dựng? Lấy API key miễn phí (100 lần gọi/ngày, không cần thẻ) và bắt đầu lấy dữ liệu cá voi, funding và on-chain trực tiếp.

Nhận API key của bạn →