අනුකලනය මාර්ගෝපදේශය
Smart Money API සමඟ Bybit perpetuals ඇතුළත් කිරීම් තහවුරු කරන්න
CCXT සමඟ සජීවී Bybit swap වෙළඳපොල දත්ත කියවන්න, Smart Money API ගෙන් ඇසීමෙන් තල්මාන ප්රවාහය සහ ව්යුත්පන්න ස්ථානගත කිරීම් ඔබේ දිශාව තහවුරු කරයිදැයි පරීක්ෂා කරන්න, ඉන්පසු යෝජිත ගුණකය අනුව ප්රමාණය කරන ලද perpetuals ඇතුළත් කිරීම සිදු කරන්න.
මෙය කවුරුන් සඳහාද
Python ඩෙවලපර්වරුන් Bybit USDT-perpetuals bot ධාවනය කරන CCXT එක් එක් ඇතුළත් කිරීමට පෙර ස්වාධීන වෙළඳපොල-සන්දර්භ පරීක්ෂාවක් අවශ්ය අය. Smart Money API යනු තීරණ සහායයකි — එය ඔබ වෙනුවෙන් ඇණවුම් තබන්නේ නැත; ඔබේ CCXT කේතය ක්රියාත්මක කිරීම සහ අවධානම පාලනය කරයි.
පූර්වාවශ්යතා
- Python 3.9+ සමඟ
pip install ccxt requests. - CCXT සඳහා Bybit API යතුරු වින්යාස කර ඇත (පරීක්ෂා කිරීම සඳහා කියවීම පමණක් ප්රමාණවත්).
- Smart Money API යතුරක් (නිදහස් තලය BTC සඳහා ආවරණය කරයි).
ඔබේ API යතුර ලබා ගන්න
සෑම ඉල්ලීමක්ම සත්යාපනය කරන්නේ X-API-Key header. යතුරක් ලබා ගැනීමට:
- 1නිදහස් ගිණුමක් සාදන්න, ඉන්පසු ඔබේ උපකරණ පුවරුව.
- 2පහත දැක්වෙන API යතුර පිටපත් කරන්න API ප්රවේශය. නිදහස් තලය BTC සඳහා දිනකට ඉල්ලීම් 20 ක් ආවරණය කරයි — මෙම මාර්ගෝපදේශය අවසානය දක්වා පරීක්ෂා කිරීමට ප්රමාණවත්ය.
- 3වැඩි සංකේත හෝ ඉහළ සීමාවන් අවශ්යද? තල සංසන්දනය කරන්න මිල නියම පිටුව.
යතුර රහස් තබා ගන්න — එය පරිසර විචල්යයක ගබඩා කරන්න, කිසි විටෙකත් එය මූලාශ්ර පාලනයට භාර නොකරන්න.
සැකසුම
- 1පුස්තකාල ස්ථාපනය කරන්න:
pip install ccxt requests. - 2ඔබේ යතුර නිර්යාත කරන්න:
export SMA_API_KEY="sm_your_key_here". - 3CCXT සමඟ Bybit swaps විවෘත කරන්න (
ccxt.bybit({"options":{"defaultType":"swap"}})), ඔබේ උපායමාර්ගය අපේක්ෂිත දිශාවක් තෝරා ගන්නා අතර, අවසාන සන්දර්භ දොරටුවක් ලෙස/v1/confirmඇමතුම් කරන්න. - 4ක්රියාව සිදු වූ විට පමණක් CCXT සමඟ perpetuals ඇතුළත් කිරීම සිදු කරන්න.
CONFIRM, sizing bysize_mult.
Working example
This script reads a Bybit swap ticker with CCXT, derives a candidate direction, then calls GET /v1/confirm?symbol=BTC&direction=long before deciding whether to place the entry.
import os
import ccxt
import requests
API_KEY = os.environ["SMA_API_KEY"] # never hard-code
SMA_BASE = "https://api.smartmoneyapi.com"
exchange = ccxt.bybit({"options": {"defaultType": "swap"}}) # Bybit perpetuals
def confirm(symbol: str, direction: str) -> dict:
"""Ask Smart Money API for market-context confirmation."""
r = requests.get(
f"{SMA_BASE}/v1/confirm",
params={"symbol": symbol, "direction": direction, "source": "bybit-bot"},
headers={"X-API-Key": API_KEY},
timeout=10,
)
r.raise_for_status()
return r.json()
# 1. Read Bybit swap market data with CCXT and pick a candidate direction
ticker = exchange.fetch_ticker("BTC/USDT:USDT")
direction = "long" if ticker["percentage"] and ticker["percentage"] > 0 else "short"
# 2. Confirm with Smart Money API before acting
sig = confirm("BTC", direction)
print(sig["action"], sig["confidence"], "size_mult", sig["size_mult"])
# 3. Act on the recommendation (CCXT executes; the API only advises)
if sig["action"] == "CONFIRM":
base_qty = 0.01
qty = base_qty * sig["size_mult"] # scale by suggested multiplier
# exchange.create_order("BTC/USDT:USDT", "market", direction, qty)
print(f"Would place {direction} {qty} BTC/USDT:USDT perp")
elif sig["action"] == "REDUCE":
print("Context is mixed -> trade smaller or wait for a cleaner setup")
else: # SKIP
print("Context does not support this trade -> stand aside")
Expected response
A successful call to /v1/confirm returns JSON like this:
{
"ts": 1710940821,
"symbol": "BTC",
"direction": "long",
"composite": 0.74,
"confidence": "HIGH",
"action": "CONFIRM",
"size_mult": 1.5,
"deriv_score": 0.81,
"onchain_score": 0.68,
"whale_score": 0.73,
"reasons": [
"Funding rate positive across all venues",
"LSR favors longs: 1.42",
"Whales: 67% long consensus",
"MVRV above 1.0 — on-chain bullish"
]
}
composite ranges from -1.0 (strong contra) to +1.0 (strong confirm), confidence is HIGH or MEDIUM, and size_mult is a 0.0–1.5 suggested size multiplier. See the full field reference in the API docs.
How to act on the response
CONFIRM
Context supports your direction. Proceed with your own entry and risk rules, optionally scaling size by size_mult.
REDUCE
Signals are mixed. Consider a smaller position, tighter stops, or waiting for a cleaner setup.
SKIP
Market context does not support this trade. Stand aside and re-check on the next candidate.
Ready to build?
Grab a free key and make your first confirmation call in under a minute.
Not financial advice. Crypto trading involves risk.