Start freeSign in
Developers

Build a trading bot on Sonar Lab

A REST API and typed SDKs for developers building mature, well-tested trading bots on any platform. Route a Sonar Lab strategy to your own connected broker account, read what it traded, and ship it in a Telegram bot, a web app, or an autonomous agent.

SDKs and OpenAPI on GitHubRead the quickstart

What you build on

A Sonar Lab strategy is a rule-based trading model maintained by Sonar and running on Sonar's servers. Through the Lab API your code routes one of these strategies to the user's own connected broker account. Your bot owns the account link, the sizing choice and the user experience; the strategy's logic stays on the server. You never hold the user's broker password, and you never place an order yourself: the Sonar relay does that, under its own safety gates.

This is for developers who already know how to build software and want a maintained strategy inside it. It is not investment advice, and Sonar does not promise a return.

The integration, end to end

Four calls, from any language:

  • Generate a Lab API key from your account, on the Developers page in the app.
  • List the available strategies as records: what each trades, its timeframe, its tier.
  • Route a strategy to the connected account at a chosen size, from 1x to 10x.
  • Read the account state and a record of the positions the strategy opened.

The size multiplier is bounded to the 1x to 10x range and validated on the server, so your bot can never place a reversed or larger-than-sanctioned position.

Two credentials, on purpose

Key management uses your Sonar account session, because minting a credential that can move money on an account is a human action. Everything else uses a scoped Lab API key, sent as a bearer token, so a bot holds a revocable, least-privilege credential and never the user's login. Entitlement is checked live on every call against the current subscription.

Build on any platform

The same four calls power a Telegram bot, a Discord bot, a web dashboard, a serverless cron, or a desktop tool. Whatever the shell, the strategy runs on Sonar and executes on the user's connected MetaTrader or broker account. See the platform guides below.

What the API never exposes

A strategy is only ever a record: what it trades, its timeframe, and the tier it needs. No endpoint returns a strategy's composition or any performance figure. Past performance, simulated or live, does not guarantee future results.

Everything you need

Repository and SDKs
Python and TypeScript clients, generated from the spec.
OpenAPI 3.1 spec
The complete, authoritative contract.
Agent quickstart
Endpoint by endpoint, with every error branch.
Building bots
Mature, well-tested bots on any platform.
Telegram bot
A complete Telegram trading bot.
MetaTrader accounts
Automated trading on a connected broker.
Strategies
Find strategies by market and route them.
Status and errors
Every status code and how to relay it.