Trade AI API
Programmatic access to AI trading signals, portfolio insights, chart analysis, and Telegram delivery — for your end-users, under your brand.
SDKs
// Drop-in single file
curl -O https://tradeai.smartchain.consulting/api/public/v1/sdk/typescriptcurl -O https://tradeai.smartchain.consulting/api/public/v1/sdk/pythonAuthentication
Every request carries a Bearer token. API keys are issued only to accounts on a Business plan — Individual plans (Free, Pro) are dashboard-only. A Business key can act on behalf of any end-user it has provisioned, and on the Business account itself for the unscoped endpoints.
Authorization: Bearer tsk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/users/{id}/... with your platform key. There is no end-user UI hosted on Trade AI.Plan access
The API is a Business product. Each plan unlocks a specific set of endpoints; calling anything outside your plan returns 403 PlanUpgradeRequired with the missing capability.
| Plan | Trading API | Telegram API | Market Data API | Broadcast | Req/min |
|---|---|---|---|---|---|
| Business Starter $49/mo | Included | — | — | — | 20 |
| Business Pro $99/mo | Included | Included | — | — | 40 |
| Business Ultra $149/mo | Included | Included | Included | Included | 55 |
| Business Market $49/mo | — | — | Included | — | 20 |
Trading API = signals, charts, portfolio, AI functions and summarize. News and sentiment are included with every Business plan. Individual plans do not include API keys, webhooks or the market data feed.
Quickstart
Five steps from zero to pushing a signal into a user's Telegram.
// Registration is unauthenticated — call once from your provisioning script.
const res = await fetch("https://tradeai.smartchain.consulting/api/public/v1/platforms/register", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
owner_user_id: process.env.TRADEAI_OWNER_ID,
company_name: "Acme Brokerage",
contact_email: "ops@acme.io",
country: "US",
activity: "trading_platform",
user_size_band: "501_10k",
plan_slug: "biz_starter_monthly",
}),
});
const { platform, api_key } = await res.json();
console.log("Save this key now:", api_key);import { TradeAI } from "./tradeai";
const client = new TradeAI({ apiKey: process.env.TRADEAI_KEY! });
const user = await client.users.create({
external_user_id: "u_42",
first_name: "Ada",
last_name: "Lovelace",
email: "ada@example.com",
});const signals = await client.signals.generate(user.id, {
asset_class: "crypto",
symbol: "BTC/USD",
timeframe: "1Hour",
language: "en", // or omit to auto-detect from Accept-Language
preset: "swing", // scalping | swing | price_action | trend | mean_reversion | custom
strategy: "swing_trading", // aggressive_scalping | moderate_scalping | swing_trading | forex_aggressive | forex_moderate | forex_conservative | commodities_* | crypto_* | indices_*
indicators: ["ema", "rsi", "macd", "bbands", "atr"],
params: {
ema: { fast: 20, slow: 50 },
rsi: { period: 14, overbought: 70, oversold: 30 },
atr: { period: 14, sl_mults: [1, 1.5, 2], tp_mults: [1.5, 2.5, 4] },
},
weights: { ema: 1.5, rsi: 1, macd: 1 },
include_chart: true,
});
// → entry, stop_losses {sl1, sl2, sl3}, take_profits {tp1, tp2, tp3},
// bias, support[], resistance[], indicators, summary, chart_urlawait client.platforms.signals.publish({
asset_class: "crypto",
symbol: "BTCUSD",
side: "long",
entry: 64500,
targets: [66000, 68000],
});// 1. Mint a one-time code
const { link_code } = await client.telegram.linkCode(user.id);
// 2. In YOUR own UI, render:
// "Open @{botUsername} and send /start {link_code}"
const { bot_username } = await client.telegram.status(user.id);
// 3. Poll status until linked
let status = await client.telegram.status(user.id);
while (!status.linked) {
await new Promise((r) => setTimeout(r, 3000));
status = await client.telegram.status(user.id);
}
// 4. Push messages
await client.telegram.send(user.id, "BTC just printed a long signal at $63,420.");
// 5. Unlink when the user asks (inside your app)
await client.telegram.unlink(user.id);// Real-time quotes
const quotes = await client.market.quote({ symbol: ["AAPL", "MSFT"], asset_class: "equities" });
// OHLCV candles
const candles = await client.market.ohlcv({
symbol: "EUR/USD",
asset_class: "forex",
timeframe: "1Hour",
limit: 200,
});
// End-of-day close
const eod = await client.market.eod({ symbol: "SPY" });
// Symbol search
const found = await client.market.symbols({ q: "apple", limit: 10 });
// Indicator values with custom periods
const indicators = await client.market.indicators({
symbol: "BTC/USD",
asset_class: "crypto",
timeframe: "1Hour",
indicators: ["ema", "rsi", "macd", "atr", "pivots"],
params: { rsi: { period: 9 } },
});
// Attribute usage to one of your end-users
const perUser = await client.market.quote({ symbol: "TSLA", userId: user.id });
// Public ticker board (no key required)
const board = await client.market.ticker();Rate limits & quotas
Each response includes X-Quota-Limit, X-Quota-Used, X-Quota-Remaining, and X-Quota-Reset (unix seconds for the next month). Watch them in production to avoid surprises.
Error responses
Errors return a JSON body with a stable error field and a human-readable message. The SDKs raise TradeAIError with the HTTP status and parsed body attached.
{
"error": "rate_limited",
"message": "Plan quota exceeded for this minute. Retry in 12s.",
"retry_after_seconds": 12
}