The Exchangery

Developer Documentation

Trading API

This is the public interface of the trading platform, to be used to develop trading screens.


Login

Before any data can be retrieved from the api, a login must be made. A login is per client, and subsequent calls to the api will only return information pertinent to that particular client. In order to achieve this, a session-id cookie is returned with the login response. It must be returned in the request header of all subsequent requests. In the future there may be an optional request parameter version of this for non browser clients.

Request

method: POST
url: /ts/login
body:
{
    "username":"[username]", 
    "password":"[p455w0rd]", 
    "market_id":"[id]"
}

Response

{"result":"success"} or {"result":"error","errors":"[Reason]"}

Market Snapshot

The market snapshot is the current state of the market at any given time. This lookup is expensive, and should only be performed once after login. This data can be used to construct an orders grid with full depth.

Request

method: GET
url: /ts/market_snapshot?market_id=[id]

Response

The response to this request is a JSON data structure called the snapshot. A snapshot consists of a market, a list of products and a list of orders.

snapshot.products

A list of all the products that are available to trade in the market. A product consists of an id and a symbol.

snapshot.orders

A list of all of the orders currently in the live market. An order consists of a market_id, product_id, side (buy or sell), quantity and price.


Market Update

request

method: GET
url: /ts/market_update?market_id=[id]

response

The response to this request is a JSON data structure called the market_update. A market_update consists of a list of orders and a list of fills.

market_update.orders

A list of all of the orders that have been created since the last time this method was called (or since login if it has not previously been called). An order consists of a market_id, product_id, side (buy or sell), quantity and price.

market_update.trades

A list of all the trades that have occured since the last time this method was called. A trade consists of an price, product_id, quantity and timestamp which is a long integer that can be used to order trades.


Order

Request

method: POST
url: /ts/orders
body:
{"order":{
    "market_id":"[id]",
    "product_id":"[id]",
    "side":"[buy/sell]",
    "quantity":"[quantity]",
    "price":"[price]"
}}

response

{"result":"success"}

Product API

This is the public interface for creating and managing products.

Account API

This is the public interface for creating and managing company and user accounts.

Risk API

This is the public interface for setting up clearing, margins and limits.

Screen API

For hosted accounts this is the public interface to modify your user's trading screen.

Sign up for our newsletter and get updates and early access.