← Home

Getting set up

Two things to connect: an exchange (only needed for live trading — skip this for paper mode), and where your strategy's decisions come from. This covers the most common setup for each.

Connecting an exchange

Full setup steps (including the IP to whitelist) are on the Exchange connections page once you're subscribed.

Bringing your own strategy

A "bring your own" bot doesn't run inside Latis — it runs wherever you like, and just tells Latis what to do by sending one HTTP request. Create a BYOS bot on the Bots page and you'll get a private webhook URL, shown once and always available again from that bot's own detail page. Anything capable of sending a POST request can drive it — a TradingView alert, a Python script, a cron job, another SaaS product's own webhook feature. Send this JSON body:

POST https://<your Latis domain>/api/strategy-webhook/<your bot's secret> Content-Type: application/json { "action": "buy", "sizeFraction": 1.0 }

This block is meant to be copied exactly as shown — it's real JSON, sent as-is in the request body, so it can't contain comments the way the field reference below does.

Trading an amount vs. setting a position

buy and sell are amounts to trade, added to or taken off whatever the bot already holds. Send buy with 0.25 three times and the bot ends up holding roughly 75% of its cap.

target is the position itself, not a trade. Send target with 0.25 three times and the bot ends up at 25% — it works out the difference each time and buys, sells, or does nothing to get there. Use it if your strategy thinks in allocations ("hold 40% while the trend holds") rather than in entries and exits.

Two practical differences. A target can reduce a position as well as grow one, which a sell can't do precisely — it's sized against your cap, not against what you're holding. And a target repairs itself: if a signal is missed while a bot is paused, or skipped as too small to be worth trading, the next one still names the right position and corrects the gap, where a missed buy leaves the bot permanently behind. Targets below your bot's minimum trade size are skipped rather than churning, and target with 0 exits the position completely.

A bot only ever acts on one signal per its own check interval — send them faster than that and the extra ones get a clean rejection rather than queuing up and firing late.

Using TradingView alerts

TradingView's own alert system sends exactly this kind of request — a URL and a JSON message you write, POSTed the moment your alert condition fires. No separate integration needed on our end; this just works because both sides speak plain webhooks.

  1. Create your alert in TradingView, on a Pine strategy or indicator.
  2. Under Notifications, enable Webhook URL and paste your bot's webhook URL.
  3. In the Message field, enter the JSON body above, with a fixed action for a one-off alert (e.g. a "buy the breakout" indicator condition that should always send "buy").
  4. For an alert built from a Pine strategy's own orders (not a plain indicator condition), you can use {"action": "{{strategy.order.action}}"} instead — TradingView fills this in with buy or sell for you. It only resolves inside a strategy-order alert, and only ever to those two values, never hold or close — those need their own separate alert conditions with a fixed action.
Webhook alerts are a paid TradingView feature — not available on their free plan as of this writing. Check your current TradingView plan if the webhook option isn't showing up.

Something not working the way this describes? Tell us — real exchange and TradingView UIs shift over time, and we'd rather fix the docs than have you stuck.