API tokens
A read-only API for a bot or a channel. It reads one paper account, in percent, and cannot change anything.
On this page
What a token can do
A token reads one paper account: closed trades, open positions, statistics and PnL cards. Everything is in percent, never in amounts. It cannot place, change or cancel anything.
Create a token
-
Have a paper account
Tokens read a paper account, so create one first.
-
Open Settings → API
Name the token and choose the account it reads.
-
Copy it right away
It is shown only once. If you lose it, revoke it and make a new one.
Anything using a revoked token stops working at once.
Requests
The base URL is https://tarvis.trade/api/v1/agent. Every request sends the header Authorization: Bearer <token>. Times are UTC ISO 8601, ids are stable, and you can make up to 120 requests a minute per token.
curl -H "Authorization: Bearer $TOKEN" https://tarvis.trade/api/v1/agent/meEndpoints
| Endpoint | What it returns |
|---|---|
/trades/closed?since_id=&limit= | New closed trades after since_id, oldest first. Poll this. |
/trades/{id}?lang=en|ru | One trade, why it entered and exited, and its fills |
/trades/{id}/card.png?theme=&lang=&size= | The PnL card, ready for Telegram |
/positions/open | What the account holds now |
/stats?period=7d|30d|all | Win rate, profit factor, drawdown, return, overall and per strategy |
/equity?from=&to=&interval=1h|1d | The equity curve, in percent from the first point |
/equity/card.png?period= | The equity curve as a card |
/market/candles?symbol=&interval=&from=&to= | Candles, if you draw your own chart |
/me | Whether this token is live |
A channel bot in three steps
-
Poll for new trades
Call
/trades/closedwith the last id you have seen, as often as once a minute. -
Fetch the card
For each new trade, download
/trades/{id}/card.png. -
Post it
Send the picture to your channel, with your own words beside it.