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. Platform keys can act on behalf of any end-user they have provisioned. Legacy direct-user keys can only call the unscoped endpoints.
Authorization: Bearer tsk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/users/{id}/... with your platform key. There is no end-user UI hosted on Trade AI.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: "grow_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",
});await 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);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
}Ready to build?
Mint your first key with the onboarding wizard, then drop the SDK into your project.