On Sunday, September 24th, the platform will be inaccessible for a brief period between 8 am and 9 am GMT+1 while our development team works on releasing new and updating the existing features.

TradeLocker REST API specification for custom Front-end integration
1.2.6

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

Authentication

TradeLocker uses JWT token authentication.
After completing the authorization process, you must send an access token with each request in the Authorization header: `'Authorization': 'Bearer TOKEN_VALUE'`


JWT token request

To obtain an access token, a call to /auth/jwt/token should be sent using the following parameters:\n
`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.

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

/config

You can find the specification of fields returned when requesting `positions, orders, ordersHistory, filledOrders, accountDetails` 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.