การจำกัดอัตราการใช้งานและโควตา

ทำความเข้าใจขีดจำกัดอัตราการใช้งานของ Smart Money API โควตารายวันสำหรับแต่ละระดับการสมัครสมาชิก และกลยุทธ์การปรับปรุงเพื่อใช้ประโยชน์จาก API ให้สูงสุด

ภาพรวม

Smart Money API ใช้โควตาการร้องขอรายวันเพื่อรักษาคุณภาพบริการและความยุติธรรมสำหรับผู้ใช้ทุกคน แต่ละระดับการสมัครสมาชิกมีขีดจำกัดรายวันต่างกัน เมื่อคุณใช้โควตารายวันเกิน คุณจะได้รับข้อผิดพลาด 429 Too Many Requests จนกว่าโควตาจะรีเซ็ตที่เวลาเที่ยงคืน UTC

ขีดจำกัดอัตราการใช้งานจะถูกนำไปใช้กับแต่ละคีย์ API แต่ละคีย์มีโควตาเป็นของตัวเอง คุณสามารถสร้างคีย์หลายคีย์สำหรับแอปพลิเคชันต่างกันและตรวจสอบการใช้งานของแต่ละคีย์แยกกัน

โควตาตามระดับการสมัครสมาชิก

ระดับ การร้องขอรายวัน ราคา คุณสมบัติ
ฟรี 200 requests/day $0 BTC, ETH, SOL, funding rates, liquidations
Trader 1,000 requests/day $29/month All symbols, whale positions, OI data
Pro 5,000 requests/day $79/month Confirmation scores, on-chain data, webhooks
Enterprise Custom Custom Dedicated support, custom integrations

ส่วนหัวการตอบสนองการจำกัดอัตราการใช้งาน

ทุกการตอบสนองของ API จะรวมส่วนหัวที่แสดงสถานะโควตาปัจจุบันของคุณ:

HTTP Headers
X-Requests-Limit: 200 X-Requests-Remaining: 147 X-Requests-Reset: 1711116000 X-Requests-Reset-ISO: 2026-03-22T00:00:00Z
ส่วนหัว คำอธิบาย
X-Requests-Limit จำนวนการร้องขอที่อนุญาตต่อวัน (เช่น 200 สำหรับ Trader)
X-Requests-Remaining การร้องขอที่เหลืออยู่ในวันปัจจุบัน
X-Requests-Reset Unix timestamp เมื่อโควตารีเซ็ต
X-Requests-Reset-ISO ISO 8601 timestamp สำหรับการรีเซ็ตโควตา

ตรวจสอบโควตาก่อนทำการร้องขอ

Python
import requests from datetime import datetime def check_quota_before_request(api_key): response = requests.head( "https://api.smartmoneyapi.com/v1/whales/events", headers={"Authorization": f"Bearer {api_key}"} ) limit = int(response.headers.get("X-Requests-Limit", 0)) remaining = int(response.headers.get("X-Requests-Remaining", 0)) reset_unix = int(response.headers.get("X-Requests-Reset", 0)) reset_time = datetime.fromtimestamp(reset_unix) percent_used = (limit - remaining) / limit * 100 print(f"Quota: {remaining}/{limit} requests ({percent_used:.1f}% used)") print(f"Resets at: {reset_time}") if remaining < 5: print("WARNING: Approaching quota limit!") return False return True # Check before making requests if check_quota_before_request("sk_live_abc123xyz789"): print("Safe to proceed with API calls")

ช่วงเวลาการจำกัดอัตราการใช้งานรายวัน

ขีดจำกัดอัตราการใช้งานทำงานในหน้าต่าง 24 ชั่วโมง โควตาของคุณจะรีเซ็ตทุกวันที่เวลาเที่ยงคืน UTC (00:00 UTC) เวลารีเซ็ตที่แน่นอนจะระบุใน X-Requests-Reset-ISO ส่วนหัว

ตัวอย่าง: ระดับ Trader (1,000 requests/day)

  • วันที่ 1 (21 มี.ค.): 200 requests ที่ใช้ได้ที่ 00:00 UTC
  • 10:30 UTC: ทำการร้องขอ 75 ครั้ง เหลือ 125
  • 15:45 UTC: ทำการร้องขอเพิ่มอีก 100 ครั้ง เหลือ 25
  • 23:59 UTC: ยังเหลือ 25 requests (ไม่สามารถนำไปใช้ต่อได้)
  • วันที่ 2 (22 มี.ค., 00:00 UTC): โควตารีเซ็ตเป็น 200

กลยุทธ์การปรับปรุงประสิทธิภาพ

1. แคชการตอบสนองของ API

ตำแหน่งวอลไม่เปลี่ยนแปลงทุกวินาที แคชผลลัพธ์ไว้ 30-60 วินาที และให้บริการข้อมูลที่แคชไว้แทนการเรียก API ใหม่

Python
import requests import time class CachedClient: def __init__(self, api_key, cache_ttl=60): self.api_key = api_key self.cache_ttl = cache_ttl self.cache = {} self.cache_time = {} def get_whale_positions(self, symbol): cache_key = f"whales:{symbol}" now = time.time() # Return cached data if still fresh if cache_key in self.cache: age = now - self.cache_time[cache_key] if age < self.cache_ttl: print(f"Served from cache (age: {age:.1f}s)") return self.cache[cache_key] # Fetch fresh data response = requests.get( f"https://api.smartmoneyapi.com/v1/whales/events?symbol={symbol}", headers={"Authorization": f"Bearer {self.api_key}"} ) data = response.json() self.cache[cache_key] = data self.cache_time[cache_key] = now return data # Usage: Cache for 60 seconds client = CachedClient("sk_live_abc123xyz789", cache_ttl=60) whales1 = client.get_whale_positions("BTCUSDT") # API call whales2 = client.get_whale_positions("BTCUSDT") # From cache whales3 = client.get_whale_positions("BTCUSDT") # From cache

2. ใช้ WebSocket สำหรับข้อมูลแบบเรียลไทม์

การเชื่อมต่อ WebSocket ส่งการอัปเดตทันทีโดยไม่นับรวมในขีดจำกัดอัตราการใช้งานของคุณ สมัครรับสตรีมและรับการอัปเดตทันทีที่เกิดขึ้น ลดจำนวนการเรียก REST API ที่จำเป็น

3. รวบรวมการร้องขออย่างมีกลยุทธ์

ทำการร้องขอหนึ่งครั้งด้วยหลายสัญลักษณ์เมื่อเป็นไปได้ แทนที่จะแยกการร้องขอสำหรับแต่ละสัญลักษณ์ ซึ่งลดการเรียก API ได้ถึง 10 เท่า

4. ใช้การกรองขณะร้องขอ

ใช้ตัวกรอง (สัญลักษณ์, exchange, min_position_size) ในพารามิเตอร์คำขอเพื่อรับข้อมูลที่คุณต้องการโดยตรง โดยไม่ต้องประมวลผลเพิ่มเติม

การจัดการข้อผิดพลาดขีดจำกัดอัตราการใช้งาน

ลองใหม่ด้วย Exponential Backoff

Python
import requests import time def request_with_retry(url, api_key, max_retries=5): for attempt in range(max_retries): try: response = requests.get( url, headers={"Authorization": f"Bearer {api_key}"}, timeout=10 ) if response.status_code == 200: return response.json() elif response.status_code == 429: # Rate limited - back off exponentially wait_time = min(2 ** attempt, 300) # Max 5 minutes reset_time = response.headers.get("X-Requests-Reset-ISO") print(f"Rate limited. Retrying in {wait_time}s (resets at {reset_time})") time.sleep(wait_time) elif response.status_code >= 500: # Server error - retry wait_time = 2 ** attempt print(f"Server error {response.status_code}. Retrying in {wait_time}s") time.sleep(wait_time) else: # Other error - don't retry raise Exception(f"HTTP {response.status_code}: {response.text}") except requests.exceptions.Timeout: wait_time = 2 ** attempt print(f"Timeout. Retrying in {wait_time}s") time.sleep(wait_time) raise Exception("Max retries exceeded") # Usage data = request_with_retry( "https://api.smartmoneyapi.com/v1/whales/events", "sk_live_abc123xyz789" ) print(data)

พร้อมที่จะอัปเกรดหรือยัง?

ระดับฟรีไม่เพียงพอ? อัปเกรดเป็น Trader หรือ Pro เพื่อโควตาที่สูงขึ้นและเข้าถึงคุณสมบัติขั้นสูงเช่น confirmation scores และ on-chain data

ดูราคา

ปรับปรุงการใช้ API ของคุณวันนี้

ใช้การแคช ใช้ WebSocket สำหรับข้อมูลแบบเรียลไทม์ และจัดการขีดจำกัดอัตราการใช้งานอย่างเหมาะสม

อ่านเอกสารประกอบ
เริ่มต้นฟรี — 200 calls/day ไม่ต้องใช้บัตร

รับข้อมูล whale flow, funding, open interest และ on-chain data แบบเรียลไทม์จาก 3 exchange จาก API เดียว ระดับฟรี ไม่ต้องใช้บัตรเครดิต อัปเกรดได้ทุกเมื่อ

เริ่มต้นฟรี →
ลองใช้ API console แบบเรียลไทม์ → (ไม่ต้องมีบัญชี)
รับคีย์ API ของคุณใน 30 วินาที

พร้อมที่จะสร้างแล้วหรือยัง? รับคีย์ API ฟรี (200 calls/day ไม่ต้องใช้บัตร) และเริ่มดึงข้อมูล whale, funding และ on-chain แบบเรียลไทม์

รับคีย์ API ของคุณ →