Cookbook
API Cookbook
Smart Money ကုန်သွယ်အတည်ပြုချက် API ကို bot ထဲသို့ ချိတ်ဆက်ရန် အသုံးအများဆုံးနည်းလမ်းများအတွက် လက်တွေ့ကျပြီး ကူးယူထည့်နိုင်သော နည်းလမ်းများ။ နည်းလမ်းတိုင်းသည် ခေါ်ယူသည် GET /v1/confirm နှင့် လုပ်ဆောင်သည် action, confidence, နှင့် size_multiplier. သင့်သော့ကို ပေးပို့ပါ X-API-Key header — see the full docs.
Recipe 1
Confirm before entry (Python)
The canonical loop. Before your strategy opens a position, ask the API whether market structure agrees. Only enter when action == "CONFIRM".
import requests
API_KEY = sm_your_key
BASE = https://api.smartmoneyapi.com/v1
def confirm(symbol, direction):
r = requests.get(
f{BASE}/confirm,
params={"symbol": symbol, "direction": direction},
headers={"X-API-Key": API_KEY}၊
timeout=5,
)
r။raise_for_status()
return r။json() sig =
confirm(BTC, long)
if sig[action] == CONFIRM:
place_order(BTC, long)
else:
print(skip:, sig[reasons])
{
"symbol": "BTC",
"direction": "long",
"action": "CONFIRM",
"confidence": "HIGH",
"composite": 0.74,
"size_mult": 1.5,
"reasons": ["Funding positive across venues", "Whales 67% long"]
}
Recipe 2
Gate a Freqtrade signal
Override confirm_trade_entry so Freqtrade only takes entries the API confirms. Fail open on API errors so a timeout never blocks all trading.
import requests
from freqtrade.strategy import IStrategy
class SmartMoneyStrategy(IStrategy):
SM_KEY = "sm_your_key"
SM_BASE = "https://api.smartmoneyapi.com/v1"
def confirm_trade_entry(self, pair, order_type, amount, rate,
time_in_force, current_time, entry_tag, **kwargs):
symbol = pair.split("/")[0]
if symbol not in ("BTC", "ETH", "SOL"):
return True
ကြိုးစားကြည့်ပါ:r = requests.("{self.SM_BASE}/confirm",params={
"symbol": symbol, "direction": "long"},
headers={X-API-Key: self.SM_KEY},
timeout=3,
).json()
return r.get("action") == "CONFIRM"
except Exception:
return True
Recipe 3
Size by size_multiplier
Let conviction set position size. Multiply your base size by size_mult (0.0–1.5) so HIGH-confidence trades get more capital and weak ones get less.
BASE_SIZE_USD = 1000
sig = အတည်ပြုပါ("ETH", long) mult = sig.get("size_mult", 0.0size = BASE_SIZE_USD * mult
if အရွယ်အစား > 0:
အော်ဒါတင်မည်(ETH, long, size_usd=size)
print(f"${size:.0f} (အဆ {mult}) ထည့်သွင်းထားသည်")
A size_mult 0.0 ဆိုသည်မှာ မထည့်သွင်းပါ - SKIP နှင့်တူညီသောရလဒ်။ သင့်ကိုယ်ပိုင်အောက်ခြေထက် နည်းသောအရာကို skip အဖြစ်သဘောထားပါ။
Recipe 4
SKIP ပေါ်တွင် Skip / REDUCE ပေါ်တွင် လျှော့ချပါ
လုပ်ဆောင်ချက်သုံးခုလုံးကို ရှင်းရှင်းလင်းလင်းကိုင်တွယ်ပါ။ CONFIRM သည် အရွယ်အစားပြည့်ဝင်သည်၊ REDUCE သည် (သေးငယ်သော) အဆတိုးဖြင့်ဝင်သည်၊ SKIP သည် ဘေးဖယ်ထားသည်။
sig = confirm(symbol, direction)
action = sig["action"]
if action == "CONFIRM":
place_order(symbol, direction, BASE_SIZE_USD * sig["size_mult"])
elif action == "REDUCE":
place_order(symbol, direction, BASE_SIZE_USD * sig["size_mult"])
else:
log(f"skip {symbol} {direction}: {sig['reasons']}")
Recipe 5
Handle 402 / 429
A 402 ဆိုလိုသည်မှာ symbol သို့မဟုတ် endpoint သည် ပိုမိုမြင့်မားသော plan လိုအပ်သည်။ a 429 ဆိုလိုသည်မှာ သင်သည် rate limit ကိုထိမိသည်။ 429/5xx ကို transient အဖြစ် (back off)၊ 402/401/403 ကို terminal အဖြစ် (plan သို့မဟုတ် key ကိုပြင်ဆင်ပါ)။
import time, requests
def confirm_safe(symbol, direction, retries=3):
for attempt in range(ပြန်ကြိုးစားမှုများ):get("{BASE}/confirm","symbol": symbol, direction: direction},
headers={X-API-Key: API_KEY}, timeout=5,
)
if r.status_code == 200:
return r.json()
if r.status_code in (401, 402, 403):
raise RuntimeError(r.json())
if r.status_code == 429: reset =int(r.headers.(get, 2))အချိန်။(အိပ်မိနစ် 2 (ပြန်လည်သတ်မှတ်၊
** ကြိုးစားမှု))
ဆက်လက်အချိန်။(2 အိပ်
# 5xx / ယာယီ
ပြန်လာမှု မရှိ
Recipe 6
ကုဒ်ရေးသားခြင်းအေးဂျင့်နှင့် အသုံးပြုပါ /llms.txt Hand Claude Code, Codex, သို့မဟုတ် Cursor ကို စက်ဖတ်နိုင်သော ရည်ညွှန်းချက်များပေးပြီး ပေါင်းစပ်ခြင်းကို လုပ်ဆောင်ခိုင်းပါ။ ထို့နောက် ခြုံငုံသုံးသပ်ချက်အတွက် ညွှန်ပြပြီး တိကျသော ပုံစံများအတွက် OpenAPI သတ်မှတ်ချက်ကို ညွှန်ပြပါ။
Read https://smartmoneyapi.com/llms.txt and the OpenAPI spec at github.com/tashiardit/smartmoneyapi-docs, then add a pre-trade check to my bot: call GET /v1/confirm with my X-API-Key, and skip any entry unless action == "CONFIRM". Scale size by size_multiplier.
Resources: /llms.txt · OpenAPI spec · Python client.
Ready to gate your first trade?
Grab a free key and read the full endpoint reference.
Decision support, not execution advice. Not financial advice. Cryptocurrency trading involves substantial risk of loss.