Getting Started with TradeLocker Public API
This page will help you get started with TradeLocker Public API. You'll be up and running in a jiffy!
Overview
TradeLocker users can interact with the demo.tradelocker.com and live.tradelocker.com environments using TradeLocker REST API and setting the corresponding Base URL to demo.tradelocker.com/backend-api/
or live.tradelocker.com/backend-api/
.
The API provides a request-response model, which allows external applications to create, modify and delete trade orders and positions, as well as request info (historical quotes, lists of orders and positions, balance info, etc.) from TradeLocker servers.
If your language of choice is Python, you can use our TradeLocker API Python Client.
If your goal is to write trading bots, make sure you download the latest TradeLocker Desktop app and check out TradeLocker Studio for AI-powered algotrading!
Authentification
TradeLocker uses JWT token authentication. After completing the authorization process, you must send an accessToken
with each request in the Authorization header: 'Authorization': 'Bearer {accessToken}'
JWT token request
To obtain an access token, a call to /auth/jwt/token
should be sent using the following parameters:
parameter | usage |
---|---|
email | TradeLocker user's email. |
password | TradeLocker user's password. |
server | The name of the server that you connect to when logging into TradeLocker. |
If all parameters are valid, TradeLocker server issues a new access token and a new refresh token, together with their expiration information.
Important Info
accountId
accountId
Your accountId
uniquely identifies each of your accounts on a specific environment (Demo or Live).
When you are logged into the TradeLocker Platform, you can find it by clicking on the account switcher (the small circular icon in the corner) and finding the number that follows the hashtag (#).

accNum
accNum
Every request to /trade/*
endpoints must also include accNum
in the header. You can retrieve the list of all accounts and their respective account numbers (accNum
) from the /auth/jwt/all-accounts
endpoint.
Difference between accountId and accNum
The account ID is a unique number attributed to an account - it is usually in a format such as
123456
.The accNum indicates which account by order you want to select. For example, a user might have 3 accounts and if the second one wants to be selected then accNum of
2
would be used.accNum is most likely a single digit while the accountId is multiple digits.
routeId
routeId
Some endpoints require that you specify one of the two routeId
values (either TRADE
or INFO
). These are instrument-specific; you can find their values by querying the /trade/accounts/{accountId}/instruments
endpoint, and looking at the routes value for the specific instrument.
For endpoints related to information about quotes (/trade/dailyBar
, /trade/history
, /trade/quotes
) , use the INFO
routeId
. For endpoints related to making trades (/trade/accounts/{accountId}/orders
, /trade/instruments/{tradableInstrumentId}
), use the TRADE
routeId
.
Field names (/trade/config
)
/trade/config
)You can find the specification and names of fields returned when requesting positions
, orders
, ordersHistory
, filledOrders
and accountDetails
, as well as rate limits
for different routes and general limits by querying the /config
endpoint.
tl-developer-api-key
tl-developer-api-key
If you are developing a solution that will be used by multiple users or will be making requests on behalf of multiple accounts from the same IP address, make sure you join our TradeLocker Developer Program. You will thus receive your own tl-developer-api-key
which will unlock less restrictive rate limits and many other benefits.
Rate Limits
Each route has a rate limit that prevents too frequent querying. The exact values for each of the routes can be fetched from the /trade/config/
route, and require that you make a maximum of limit requests per each intervalNum
SECONDS/MINUTES
(e.g. max of 2 requests per second).
Data Limits
Currently, endpoints /ordersHistory
and /quotes
have limits on the maximum number of rows that can be returned in any single request. You can find those limits by querying the JSON object from /trade/config
and looking at its limits key.
Updated about 1 month ago