On Sunday, April 28th, the platform will be temporarily inaccessible from 3 AM to 7 AM EST (9 AM to 1 PM CET) while we work on infrastructure upgrades. IMPORTANT: Pending orders and SL&TP settings WILL NOT trigger.

TradeLocker REST API specification.
 2.10.5 

[ Base URL: demo.tradelocker.com/backend-api/ ]

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, as well as request info (historical quotes, list of orders and positions, balance info, etc.) from TradeLocker servers.

NEW: To start writing strategies, you can install the official TradeLocker API Python Client .
COMING SOON: Sign up to get access to TradeLocker Studio. Start using our AI to convert your ideas into running bots in seconds!

Authentication

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:

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.

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).

Important info

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.

routeId

TradeLocker uses various connection identifiers (routeId) for fetching quote data (INFO) and making trade orders (TRADE). These can be user-specific and instrument-specific, so you should first fetch the list of all instruments, together with their corresponding INFO and TRADE routeId from the /trade/accounts/<{accountId}>/instruments endpoint.

Field names (/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.

Auth

JWT access and refresh token, list of all accounts

JWT accessTokens and refreshToken

Parameters

Name Description
body *
object
(body)

User credentials - email, password, brandId

Responses

Curl

curl -X 'POST' \
  'http://stg.tradelocker.com/backend-api/auth/jwt/token' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "email": "[email protected]",
  "password": "secretPassword123",
  "brandId": "BRAND1"
}'

Request URL

http://stg.tradelocker.com/backend-api/auth/jwt/token

Server response

Code Details
Undocumented

Failed to fetch.
Possible Reasons:

  • CORS
  • Network Failure
  • URL scheme must be "http" or "https" for CORS request.

Responses

Code Description
201

response

{
  "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0cmFkZWxvY2tlci1hcGkiLCJhdWQiOiJ0cmFkZWxvY2tlci1hcGktdHJhZGVycyIsInR5cGUiOiJhY2Nlc3NfdG9rZW4iLCJzdWIiOiJPU1AjREVWQ0xMOWc0aXNUT0VpS2pmTmRKdzEzIiwidWlkIjoiMTQ0YmYyODctNTFlNC00YjQyLWJlNTQtYzBkZTRmMTE3ODMzIiwiYnJhbmQiOiJPU1AiLCJpYXQiOjE2ODUxMTY3OTMsImV4cCI6MTY4NTEyMDM5M30.cyDXRqUNVX6h5rtZb7m30vNIwEoYN7xUU2jfGM-Cf90",
  "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0cmFkZWxvY2tlci1hcGkiLCJhdWQiOiJ0cmFkZWxvY2tlci1hcGktdHJhZGVycyIsInR5cGUiOiJyZWZyZXNoX3Rva2VuIiwic3ViIjoiT1NQI0RFVkNMTDlnNGlzVE9FaUtqZk5kSncxMyIsInVpZCI6IjE0NGJmMjg3LTUxZTQtNGI0Mi1iZTU0LWMwZGU0ZjExNzgzMyIsImJyYW5kIjoiT1NQIiwiaWF0IjoxNjg1MTE2NzkzLCJleHAiOjE2ODU3MjE1OTN9.GKNglolZzX76lKjTsrQ28MpmLTfU0A_T7vCMrsojLcg"
}
400

Bad Request

Config

Basic settings and accesses

Instruments

Financial instrument information

Market data

Price and other related data for a financial instrument

Trading

Buying and selling of financial instruments in order to make a profit

TradeLocker © 2023. All rights reserved.

*Neither this app or its contents should be regarded as professional, financial or investment advice. This app is a suite of trading tools, meant to be used in connection with an account held by a trader with their brokerage firm. If you intend on using this app for real trading, you should understand how various financial products work and the risks you will be undertaking on your own.

**By using this app you will have access to information of a general nature (i.e., that does not address the circumstances of any particular individual). If you require further information, or otherwise a more comprehensive or complete statement of the related matters and regulations, you should seek the advice of a lawyer, your brokerage firm, or from a licensed financial service provider before you start trading.