NAV Navbar
python javascript

Introduction

Leverj REST and Websocket API enable access to all features of the platform. The testnet and live sites are built entirely using this API and should be seen as one of the many possible platform implementations. The API could be leveraged to power a comprehesive set of tools and utilities, including automated trading clients and bots.

Please refer to JSON field definitions for more information.

Language SDK/Libraries

Currently we support node.js and python for programmatic access. Select your programming language on the top right of the page to select code examples appropriately. Python code examples and the client library is compatible with Python3.

Scheme

REST URL = BASE_URL + ENDPOINT

Base URL

The base url for all REST API for the live site is https://live.leverj.io/api/v1. For testnet use https://test.leverj.io/api/v1. To request an endpoint, append it to the base url and make a request.

For example to access the /all/info endpoint:

From the command line

curl https://live.leverj.io/api/v1/all/info

From your programming language

import requests
print(requests.get("https://live.leverj.io/api/v1/all/info").text)
restjs.get("https://live.leverj.io/api/v1/all/info")
 .then(function(info) {
   console.log(info)
  })

Unified javascript Rest library

The rest.js library enables isomorphic usage of REST calls from either node.js or the browser using either browserify or as a SCRIPT tag in HTML

In Browser

  <script src="jquery.min.js"></script>
  <script src="https://raw.githubusercontent.com/coinpit/REST/master/index.js"></script>
  <script>
    restjs.get("https://live.leverj.io/api/v1/all/info")
          .then(function(result) {
            console.log(result)
          })
  </script>

In node.js

  var restjs = require('rest.js')
  restjs.get("https://live.leverj.io/api/v1/all/info")
        .then(function(result) {
          console.log(result)
        })

URL parameters

Url parameters are denoted by prepending a colon:

/instrument/:symbol/order/:uuid

The parameters :symbol and :uuid need to be filled in when making a REST call to server. To get a specific order with id 123e4567-e89b-12d3-a456-426655440000 of instrument LEVETH, the actual url would be

https://live.leverj.io/api/v1/instrument/LEVETH/order/123e4567-e89b-12d3-a456-426655440000

Pagination

All resource objects have a Type-1 UUID that also represents creation time. Requests return results in descending order of creation time. By default the most recent object is returned with a page size of 100. Use the query parameter from to get data for the next page.

Example: If the last accessed page had the final item with uuid 123e4567-e89b-12d3-a456-426655440000, to get page with subsequent items:

https://live.leverj.io/api/v1/instrument/LEVETH/executions?from=123e4567-e89b-12d3-a456-426655440000

HTTP headers

HTTP 1.1 requires Host header. In the examples here, we have used testnet host test.leverj.io. For production use, you should change it to live.leverj.io. You also need Authorization and Nonce headers for protected resources. You may also add other appropriate headers, which are omitted here for brevity.

Zero Knowledge Authentication (ZKA)

Leverj’s uses a zero-knowledge authentication system. Leverj replaces the typical username and password based authentication scheme with a triplet of your account id, an apikey and a secret associated with the apikey. There is absolutely no need for the system to know about your account’s private key. The apikey’s secret is used to sign and confirm your identity but is not transfered over to the server either. The loginless system relies on ECDSA (Elliptic Curve Digital Signature Algorithm). The scheme involves signing message payload using an apikey’s secret and subsequently using the elliptic curve signature elements to derive or recover the apikey. The recovered apikey is matched against the registered apikey. This pair of actions involving signing and recovery establishes trust and identity to facilitate authentication. Every request is authenticated using this mechanism.

You need to register online with the exchange to setup and download an apikey and its corresponding secret. An account can have multiple pairs of apikeys and their corresponding secrets.

Zero knowledge Authentication avoids setting session cookies and eliminates the following classes of attacks: session hijacking, some kinds of replay attacks, cookie sniffing, and some XSS and CSRF attacks. Not having the password or session id on the server mitigates some kinds of attacks due to server breach. Zero knowledge systems never send passwords or cookies and are also safer in case of information leak from TLS issues such as the Heartbleed bug.

Overview

ZKA requires you to set Authorization and Nonce headers in HTTP for protected endpoints. This requires your account id, apikey and secret, which are in your JSON key file that you saved when you registered with the exchange and setup your apikey.

Authorization and Nonce headers

The syntax for Authorization and Nonce headers is as below.

Authorization: SIGN <account_id>.<apiKey>.<v>.<r>.<s>
Nonce: <unix_time>

v, r, and s are ECDSA related elements. r and s are normal outputs of an ECDSA signature and v is the extra byte or header byte that helps in public key recovery.

For example, to get account information:

GET /api/v1/account HTTP/1.1
Host: live.leverj.io
Authorization: 'SIGN 0x175692523CC570fB0E1856BFa190c7a89777347d.0x5fB9c0E7d496C89792f0F5C7d3b0337C0Bba7C3a.28.0x711802f48404ef5abbc0962370b750f4d6ef71a4336e8a691b4b42953022465a.0x23c14435d18e972b19119791ec5f9f120b24ed26fef4feda4b8efc74d8297a41'
Nonce: 1529543915691

We support transparent authentication support for node.js and python and suggest you use them instead of rolling out your own

zka node module

The zka node module will do all the handshake and authentication and enables interaction with REST and socket API transparently. This may be used from a browser using browserify.

const zka    = require("zka")(baseUrl, "/api/v1")
zka.init(accountId, apiKey, secret)

Authentication with zka

Nonce

To prevent replay attacks, all requests should include a nonce and the nonce is also used to compute HMAC. The server expects UNIX time as the nonce. This requires a reasonably accurate clock on your client machine.

Nonce: 1478041310000

Clients with inaccurate clocks

If your client does not have an accurate clock or you are on an unusually slow network connection, you can compute the skew and apply it to all future requests using the Server-Time header in the HTTP responses. The node.js SDK does skew adjustment automatically. The non-cacheable HTTP methods PUT, POST, DELETE and OPTIONS return a Server-Time header.

Server-Time: 1478041315780

Send request using Authorization and nonce headers

curl -H "Authorization: 'SIGN 0x175692523CC570fB0E1856BFa190c7a89777347d.0x5fB9c0E7d496C89792f0F5C7d3b0337C0Bba7C3a.28.0x711802f48404ef5abbc0962370b750f4d6ef71a4336e8a691b4b42953022465a.0x23c14435d18e972b19119791ec5f9f120b24ed26fef4feda4b8efc74d8297a41'" -H 'Nonce 1529543915691' https://live.coinpit.me/api/v1/instrument/LEVETH/order

Leverj REST API

Unprotected REST API Endpoints

Unprotected endpoints do not require an Authorization header.

General Exchange Data

Method Rest Endpoint Description
GET /all/info Last price, 24Hr volume, etc

Exchange Configuration

Method Rest Endpoint Description
GET /all/spec Get specs for all exchange traded instruments
GET /all/config Get exchange configuration parameters

Market Data

Method Rest Endpoint Description
GET /instrument/:symbol/trade Get recent trade data
GET /instrument/:symbol/chart/:timeframe Get chart data for instrument
GET /instrument/:symbol/orderbook Get order book for the instrument

Protected REST API endpoints

All user specific endpoints require Authorization and Nonce headers as described in the Loginless or ZKA section

Open Orders

Method Rest Endpoint Description
GET /order Get all open orders
GET /order/:uuid Get a specific open order
POST /order Create orders
PUT /order Update Orders
DELETE /order/:uuids Delete specified orders

Orders by instrument and status

Method Rest Endpoint Description
GET /instrument/:symbol/order/:uuid Get specific order for a particular instrument
GET /instrument/:symbol/order/open Get all open orders for a specific instrument
GET /instrument/:symbol/order/closed?from=uuid Get closed orders. Use uuid of last item to fetch next page
GET /instrument/:symbol/order/cancelled?from=uuid Get closed orders. Use uuid of last item to fetch next page

Get account information: Margin, Position, P&L, open orders

Method Rest Endpoint Description
GET /account
GET /account/execution GET User’s recent executions

Examples

Examples are structured as follows:

Section Description
Title What the /api endpoint stands for
URL template Any colon prepended tokens are url parameters
HTTP Request Abbreviated HTTP request
Server Response Including expected HTTP error code

Exchange Basic Info

GET /all/info

GET /api/v1/all/info HTTP/1.1
Accept: application/json
Host: test.leverj.io

200 OK

Coming soon!

Instrument Specs

GET /all/spec

GET /api/v1/all/spec HTTP/1.1
Accept: application/json
Host: test.leverj.io

200 OK

{
    "instruments": [
        "FEEETH",
        "LEVETH"
    ],
    "parameter": {
        "LEVETH": {
            "symbol": "LEVETH",
            "address": "0xAa7127e250E87476FdD253f15e86A4Ea9c4c4BD4",
            "name": "LEV/ETH",
            "decimals": 9,
            "reward": -2500,
            "commission": 10000,
            "instrument_status": "active",
            "ticksize": 6,
            "ticksperpoint": 1000000,
            "significantEtherDigits": 6,
            "significantTokenDigits": 1,
            "quoted_asset": "LEV",
            "quoted_asset_address": "0xAa7127e250E87476FdD253f15e86A4Ea9c4c4BD4",
            "base_asset": "ETH",
            "base_asset_address": "0x0000000000000000000000000000000000000000"
        }
    }
}

Exchange config (format subject to frequent change)

GET /all/config

GET /api/v1/all/config HTTP/1.1
Accept: application/json
Host: test.leverj.io

200 OK

{
    "config": {
        "maxInputs": 50,
        "maxOrdersCreateUpdate": 100,
        "fee": {
            "maker": 1,
            "taker": 5,
            "factor": 10000,
            "weiPerFee": 1000000
        },
        "minimumNumberOfConfirmations": 12,
        "network": {
            "provider": "ropsten",
            "uri": "https://ropsten.infura.io",
            "etherscan": "https://ropsten.etherscan.io",
            "socket": "wss://ropsten.infura.io:443/ws",
            "id": 3,
            "registry": "0x835F739f3844590eec22ed1abBF768Bc69e529ce",
            "custodian": "0x31A5796d71c1f55cfed362faF1B60452bdbfc0Cc",
            "staking": "0xd36029d76af6fE4A356528e4Dc66B2C18123597D"
        },
        "geofence": {
            "block": [
                "US"
            ]
        },
        "noSignup": false
    },
    "instruments": {
        "LEVETH": {
            "symbol": "LEVETH",
            "address": "0xAa7127e250E87476FdD253f15e86A4Ea9c4c4BD4",
            "name": "LEV/ETH",
            "decimals": 9,
            "reward": -2500,
            "commission": 10000,
            "instrument_status": "active",
            "ticksize": 6,
            "ticksperpoint": 1000000,
            "significantEtherDigits": 6,
            "significantTokenDigits": 1,
            "quoted_asset": "LEV",
            "quoted_asset_address": "0xAa7127e250E87476FdD253f15e86A4Ea9c4c4BD4",
            "base_asset": "ETH",
            "base_asset_address": "0x0000000000000000000000000000000000000000"
        }
    },
    "assets": {
        "ETH": {
            "name": "ETHEREUM",
            "address": "0x0000000000000000000000000000000000000000",
            "symbol": "ETH",
            "decimals": 18,
            "asset_status": "active"
        },
        "LEV": {
            "name": "LEVERJ",
            "address": "0xAa7127e250E87476FdD253f15e86A4Ea9c4c4BD4",
            "symbol": "LEV",
            "decimals": 9,
            "asset_status": "active"
        }
    }
}

Recent trade data for an instrument (e.g. LEVETH)

GET /instrument/:symbol/trade

GET /api/v1/instrument/LEVETH/trade HTTP/1.1
Accept: application/json
Host: test.leverj.io

200 OK

[
    {
        "date": 1529697648,
        "price": 0.000143,
        "volume": 0.1,
        "instrument": "LEVETH"
    },
    {
        "date": 1529697618,
        "price": 0.000143,
        "volume": 0.1,
        "instrument": "LEVETH"
    },
    {
        "date": 1529697593,
        "price": 0.000145,
        "volume": 0.1,
        "instrument": "LEVETH"
    },
    {
        "date": 1529697498,
        "price": 0.000138,
        "volume": 0.1,
        "instrument": "LEVETH"
    }
]

Chart for instrument

GET /instrument/:symbol/chart/:timeframe

GET /api/v1/instrument/LEVETH/chart/5 HTTP/1.1
Accept: application/json
Host: test.leverj.io

200 OK

[
    {
        "v": 0.2,
        "s": 0.0000231,
        "t": 1529704500,
        "o": 0.000131,
        "h": 0.000131,
        "l": 0.0001,
        "c": 0.0001,
        "instrument": "LEVETH"
    },
    {
        "v": 0.7000000000000001,
        "s": 0.0000917,
        "t": 1529704200,
        "o": 0.000102,
        "h": 0.00015,
        "l": 0.000102,
        "c": 0.00012,
        "instrument": "LEVETH"
    },
    {
        "v": 0.4,
        "s": 0.000042600000000000005,
        "t": 1529703900,
        "o": 0.000108,
        "h": 0.00011,
        "l": 0.0001,
        "c": 0.00011,
        "instrument": "LEVETH"
    },
    {
        "v": 0.8,
        "s": 0.0001308,
        "t": 1529703600,
        "o": 0.000169,
        "h": 0.000169,
        "l": 0.000149,
        "c": 0.000149,
        "instrument": "LEVETH"
    }
]

Order book for the instrument

GET /instrument/:symbol/orderbook

GET /api/v1/instrument/LEVETH/orderbook HTTP/1.1
Accept: application/json
Host: test.leverj.io

200 OK

{
    "bid": 0.000107,
    "ask": 0.000123,
    "buy": [
        {
            "price": 0.000107,
            "numberOfOrders": 1,
            "totalQuantity": 0.1,
            "instrument": "LEVETH"
        },
        {
            "price": 0.0001,
            "numberOfOrders": 1,
            "totalQuantity": 0.1,
            "instrument": "LEVETH"
        },
        {
            "price": 0.000098,
            "numberOfOrders": 1,
            "totalQuantity": 0.3,
            "instrument": "LEVETH"
        },
        {
            "price": 0.000096,
            "numberOfOrders": 1,
            "totalQuantity": 0.1,
            "instrument": "LEVETH"
        }
    ],
    "sell": [
        {
            "price": 0.000123,
            "numberOfOrders": 1,
            "totalQuantity": 0.1,
            "instrument": "LEVETH"
        },
        {
            "price": 0.000136,
            "numberOfOrders": 1,
            "totalQuantity": 0.3,
            "instrument": "LEVETH"
        },
        {
            "price": 0.000166,
            "numberOfOrders": 1,
            "totalQuantity": 0.1,
            "instrument": "LEVETH"
        },
        {
            "price": 0.000184,
            "numberOfOrders": 2,
            "totalQuantity": 0.2,
            "instrument": "LEVETH"
        }
    ]
}

Get all open orders

GET /order

GET /api/v1/order HTTP/1.1
Accept: application/json
Host: test.leverj.io
Authorization: HMAC mfxWFDho5Aa2TTnxKRZNRgBED6GP8C9gDd:7c3fa2fb0702bf1e4f9a94ca6c48cc250d95e078b42c339307096fbe679e2c84
Nonce: 1481655922696

200 OK

[
  {
    "uuid": "d3b22f20-7688-11e8-a699-5e68bf92f205",
    "accountId": "0x50F7a5CE920E2Ab517E6178CB1Edb90030f32167",
    "side": "buy",
    "quantity": 0.1,
    "filled": 0,
    "cancelled": 0,
    "price": 0.000098,
    "entryTime": 1529719067410372,
    "eventTime": 1529719067410372,
    "status": "open",
    "orderType": "LMT",
    "instrument": "LEVETH",
    "makerFee": 0,
    "takerFee": 0,
    "useFEE": false,
    "reward": -2500,
    "timestamp": 1529719067326,
    "signature": "0x1b8bba98827d23062ce4782f7329397bdeb31af14a42bbd3116a025f33a74b33089194df05a09e888344120fc489de0339260d1b51aa6e59ef076db8a73e067b00",
    "token": "0xAa7127e250E87476FdD253f15e86A4Ea9c4c4BD4"
  },
  {
    "uuid": "c0299d70-7689-11e8-a99b-cd95ac56fa0c",
    "accountId": "0x50F7a5CE920E2Ab517E6178CB1Edb90030f32167",
    "side": "buy",
    "quantity": 0.1,
    "filled": 0,
    "cancelled": 0,
    "price": 0.00001,
    "entryTime": 1529719464136165,
    "eventTime": 1529719464136165,
    "status": "open",
    "orderType": "LMT",
    "instrument": "LEVETH",
    "makerFee": 0,
    "takerFee": 0,
    "useFEE": false,
    "reward": -2500,
    "timestamp": 1529719464081,
    "signature": "0xe4c1cf216bed6e7a6021150ed313d4fde54177d3e07363d315592caef6470779732ef6e79edecfca55ea916313147ab95f1d3af7ebe967f1f989fc30d27b069900",
    "token": "0xAa7127e250E87476FdD253f15e86A4Ea9c4c4BD4"
  }
]

Get open order by id

GET /order/:uuid

GET /api/v1/order/d3b22f20-7688-11e8-a699-5e68bf92f205 HTTP/1.1
Accept: application/json
Host: test.leverj.io
Authorization: HMAC mfxWFDho5Aa2TTnxKRZNRgBED6GP8C9gDd:7c3fa2fb0702bf1e4f9a94ca6c48cc250d95e078b42c339307096fbe679e2c84
Nonce: 1481655922696

200 OK

[
    {
    "uuid": "d3b22f20-7688-11e8-a699-5e68bf92f205",
    "accountId": "0x50F7a5CE920E2Ab517E6178CB1Edb90030f32167",
    "side": "buy",
    "quantity": 0.1,
    "filled": 0,
    "cancelled": 0,
    "price": 0.000098,
    "entryTime": 1529719067410372,
    "eventTime": 1529719067410372,
    "status": "open",
    "orderType": "LMT",
    "instrument": "LEVETH",
    "makerFee": 0,
    "takerFee": 0,
    "useFEE": false,
    "reward": -2500,
    "timestamp": 1529719067326,
    "signature": "0x1b8bba98827d23062ce4782f7329397bdeb31af14a42bbd3116a025f33a74b33089194df05a09e888344120fc489de0339260d1b51aa6e59ef076db8a73e067b00",
    "token": "0xAa7127e250E87476FdD253f15e86A4Ea9c4c4BD4"
  }
]

Create New Order

POST /order

POST /api/v1/order HTTP/1.1
Accept: application/json
Host: test.leverj.io
Authorization: 'SIGN 0x50F7a5CE920E2Ab517E6178CB1Edb90030f32167.0x5641C10fC028a5385dEC3A89f0a61f98DfBfCd30.28.0x37a8fbcf67406dbd68d825763727eebaf95aba915fcd0eb361f45163242c2b66.0x0f989ae4615b1ca4981fab0325b79ecb75aa943736af2ef279b4f0f3671ee837'
Nonce: 1529719510312
[
    {
        "orderType": "LMT",
        "price": 0.00001,
        "accountId": "0x50F7a5CE920E2Ab517E6178CB1Edb90030f32167",
        "instrument": "LEVETH",
        "side":"buy",
        "quantity": 0.1
    }
]

200 OK

[
  {
    "uuid": "dbb46570-7689-11e8-84d2-e6bad3a82d26",
    "accountId": "0x50F7a5CE920E2Ab517E6178CB1Edb90030f32167",
    "side": "buy",
    "quantity": 0.1,
    "filled": 0,
    "cancelled": 0,
    "price": 0.00001,
    "entryTime": 1529719510343649,
    "eventTime": 1529719510343649,
    "status": "open",
    "orderType": "LMT",
    "instrument": "LEVETH",
    "makerFee": 0,
    "takerFee": 0,
    "useFEE": false,
    "reward": -2500,
    "timestamp": 1529719510312,
    "signature": "0xb229696627a3e82cd8d1ee79b173dc2084ccb6f358a7be385fa87197f9312bcd0fcc38d71d4fe4796fd7e56a21a5bc9284082c4ea1ddc107e77fba2a7845ba7000",
    "token": "0xAa7127e250E87476FdD253f15e86A4Ea9c4c4BD4"
  }
]

Update Orders

Only uuid and any fields that need to be changed should be sent. Only price can be updated at present. Non-changeable fields are ignored.

PUT /order

PUT /api/v1/order HTTP/1.1
Accept: application/json
Host: test.leverj.io
Authorization: 'SIGN 0x50F7a5CE920E2Ab517E6178CB1Edb90030f32167.0x5641C10fC028a5385dEC3A89f0a61f98DfBfCd30.28.0x37a8fbcf67406dbd68d825763727eebaf95aba915fcd0eb361f45163242c2b66.0x0f989ae4615b1ca4981fab0325b79ecb75aa943736af2ef279b4f0f3671ee837'
Nonce: 1529719510312
[
    {
       "uuid":"d3b22f20-7688-11e8-a699-5e68bf92f205",
       "price": 0.000088
    }
]

200 OK

[
    {
    "uuid": "d3b22f20-7688-11e8-a699-5e68bf92f205",
    "accountId": "0x50F7a5CE920E2Ab517E6178CB1Edb90030f32167",
    "side": "buy",
    "quantity": 0.1,
    "filled": 0,
    "cancelled": 0,
    "price": 0.000088,
    "entryTime": 1529719067410372,
    "eventTime": 1529719067410372,
    "status": "open",
    "orderType": "LMT",
    "instrument": "LEVETH",
    "makerFee": 0,
    "takerFee": 0,
    "useFEE": false,
    "reward": -2500,
    "timestamp": 1529719067326,
    "signature": "0x1b8bba98827d23062ce4782f7329397bdeb31af14a42bbd3116a025f33a74b33089194df05a09e888344120fc489de0339260d1b51aa6e59ef076db8a73e067b00",
    "token": "0xAa7127e250E87476FdD253f15e86A4Ea9c4c4BD4"
  }
]

Cancel Specified orders

Specify orders to be deleted by comma separated uuids. Any stop orders deleted will trigger and result in closing of position.

DELETE /order/:uuids

DELETE /api/v1/order/adcb4c70-b72a-11e6-9b68-be1cfc0a27e0,50192f40-c7b3-11e6-ba51-b8bd8cf25f84 HTTP/1.1
Accept: application/json
Host: test.leverj.io
Authorization: 'SIGN 0x50F7a5CE920E2Ab517E6178CB1Edb90030f32167.0x5641C10fC028a5385dEC3A89f0a61f98DfBfCd30.28.0x37a8fbcf67406dbd68d825763727eebaf95aba915fcd0eb361f45163242c2b66.0x0f989ae4615b1ca4981fab0325b79ecb75aa943736af2ef279b4f0f3671ee837'
Nonce: 1529719510312

200 OK

[
   "d3b22f20-7688-11e8-a699-5e68bf92f205",
   "c0299d70-7689-11e8-a99b-cd95ac56fa0c"
]

Specific order for a instrument

GET /instrument/:symbol/order/:uuid

GET /api/v1/instrument/LEVETH/order/d3b22f20-7688-11e8-a699-5e68bf92f205 HTTP/1.1
Accept: application/json
Host: test.leverj.io
Authorization: 'SIGN 0x50F7a5CE920E2Ab517E6178CB1Edb90030f32167.0x5641C10fC028a5385dEC3A89f0a61f98DfBfCd30.28.0x37a8fbcf67406dbd68d825763727eebaf95aba915fcd0eb361f45163242c2b66.0x0f989ae4615b1ca4981fab0325b79ecb75aa943736af2ef279b4f0f3671ee837'
Nonce: 1529719510312

200 OK

[
    {
    "uuid": "d3b22f20-7688-11e8-a699-5e68bf92f205",
    "accountId": "0x50F7a5CE920E2Ab517E6178CB1Edb90030f32167",
    "side": "buy",
    "quantity": 1.0,
    "filled": 0,
    "cancelled": 0,
    "price": 0.000098,
    "entryTime": 1529719067410372,
    "eventTime": 1529719067410372,
    "status": "open",
    "orderType": "LMT",
    "instrument": "LEVETH",
    "makerFee": 0,
    "takerFee": 0,
    "useFEE": false,
    "reward": -2500,
    "timestamp": 1529719067326,
    "signature": "0x1b8bba98827d23062ce4782f7329397bdeb31af14a42bbd3116a025f33a74b33089194df05a09e888344120fc489de0339260d1b51aa6e59ef076db8a73e067b00",
    "token": "0xAa7127e250E87476FdD253f15e86A4Ea9c4c4BD4"
  }
]

Open Orders (including partially filled)

GET /instrument/:symbol/order/open

GET /api/v1/instrument/LEVETH/order/open HTTP/1.1
Accept: application/json
Host: test.leverj.io
Authorization: 'SIGN 0x50F7a5CE920E2Ab517E6178CB1Edb90030f32167.0x5641C10fC028a5385dEC3A89f0a61f98DfBfCd30.28.0x37a8fbcf67406dbd68d825763727eebaf95aba915fcd0eb361f45163242c2b66.0x0f989ae4615b1ca4981fab0325b79ecb75aa943736af2ef279b4f0f3671ee837'
Nonce: 1529719510312

200 OK

[
    {
    "uuid": "d3b22f20-7688-11e8-a699-5e68bf92f205",
    "accountId": "0x50F7a5CE920E2Ab517E6178CB1Edb90030f32167",
    "side": "buy",
    "quantity": 0.5,
    "filled": 0,
    "cancelled": 0,
    "price": 0.000098,
    "entryTime": 1529719067410372,
    "eventTime": 1529719067410372,
    "status": "open",
    "orderType": "LMT",
    "instrument": "LEVETH",
    "makerFee": 0,
    "takerFee": 0,
    "useFEE": false,
    "reward": -2500,
    "timestamp": 1529719067326,
    "signature": "0x1b8bba98827d23062ce4782f7329397bdeb31af14a42bbd3116a025f33a74b33089194df05a09e888344120fc489de0339260d1b51aa6e59ef076db8a73e067b00",
    "token": "0xAa7127e250E87476FdD253f15e86A4Ea9c4c4BD4"
  }
]

Closed Orders (including partially cancelled)

GET /instrument/:symbol/order/closed?from=:uuid

GET /api/v1/instrument/LEVETH/order/closed HTTP/1.1
Accept: application/json
Host: test.leverj.io
Authorization: 'SIGN 0x50F7a5CE920E2Ab517E6178CB1Edb90030f32167.0x5641C10fC028a5385dEC3A89f0a61f98DfBfCd30.28.0x37a8fbcf67406dbd68d825763727eebaf95aba915fcd0eb361f45163242c2b66.0x0f989ae4615b1ca4981fab0325b79ecb75aa943736af2ef279b4f0f3671ee837'
Nonce: 1529719510312

200 OK

[
    {
    "uuid": "d3b22f20-7688-11e8-a699-5e68bf92f205",
    "accountId": "0x50F7a5CE920E2Ab517E6178CB1Edb90030f32167",
    "side": "buy",
    "quantity": 0.5,
    "filled": 0,
    "cancelled": 0,
    "price": 0.000098,
    "entryTime": 1529719067410372,
    "eventTime": 1529719067410372,
    "status": "open",
    "orderType": "LMT",
    "instrument": "LEVETH",
    "makerFee": 0,
    "takerFee": 0,
    "useFEE": false,
    "reward": -2500,
    "timestamp": 1529719067326,
    "signature": "0x1b8bba98827d23062ce4782f7329397bdeb31af14a42bbd3116a025f33a74b33089194df05a09e888344120fc489de0339260d1b51aa6e59ef076db8a73e067b00",
    "token": "0xAa7127e250E87476FdD253f15e86A4Ea9c4c4BD4"
  }
]

Cancelled orders (with no fills)

GET /instrument/:symbol/order/cancelled?from=:uuid

GET /api/v1/instrument/LEVETH/order/cancelled HTTP/1.1
Accept: application/json
Host: test.leverj.io
Authorization: 'SIGN 0x50F7a5CE920E2Ab517E6178CB1Edb90030f32167.0x5641C10fC028a5385dEC3A89f0a61f98DfBfCd30.28.0x37a8fbcf67406dbd68d825763727eebaf95aba915fcd0eb361f45163242c2b66.0x0f989ae4615b1ca4981fab0325b79ecb75aa943736af2ef279b4f0f3671ee837'
Nonce: 1529719510312

200 OK

[
  {
    "uuid": "d3b22f20-7688-11e8-a699-5e68bf92f205",
    "accountId": "0x50F7a5CE920E2Ab517E6178CB1Edb90030f32167",
    "side": "buy",
    "quantity": 0.5,
    "filled": 0,
    "cancelled": 0,
    "price": 0.000098,
    "entryTime": 1529719067410372,
    "eventTime": 1529719067410372,
    "status": "open",
    "orderType": "LMT",
    "instrument": "LEVETH",
    "makerFee": 0,
    "takerFee": 0,
    "useFEE": false,
    "reward": -2500,
    "timestamp": 1529719067326,
    "signature": "0x1b8bba98827d23062ce4782f7329397bdeb31af14a42bbd3116a025f33a74b33089194df05a09e888344120fc489de0339260d1b51aa6e59ef076db8a73e067b00",
    "token": "0xAa7127e250E87476FdD253f15e86A4Ea9c4c4BD4"
  }
]

User account

GET /account

GET /api/v1/account HTTP/1.1
Accept: application/json
Host: test.leverj.io
Authorization: 'SIGN 0x50F7a5CE920E2Ab517E6178CB1Edb90030f32167.0x5641C10fC028a5385dEC3A89f0a61f98DfBfCd30.28.0x37a8fbcf67406dbd68d825763727eebaf95aba915fcd0eb361f45163242c2b66.0x0f989ae4615b1ca4981fab0325b79ecb75aa943736af2ef279b4f0f3671ee837'
Nonce: 1529719510312

200 OK

Coming soon!

User Executions

GET /account/execution

GET /api/v1/account/execution HTTP/1.1
Accept: application/json
Host: test.leverj.io
Authorization: 'SIGN 0x50F7a5CE920E2Ab517E6178CB1Edb90030f32167.0x5641C10fC028a5385dEC3A89f0a61f98DfBfCd30.28.0x37a8fbcf67406dbd68d825763727eebaf95aba915fcd0eb361f45163242c2b66.0x0f989ae4615b1ca4981fab0325b79ecb75aa943736af2ef279b4f0f3671ee837'
Nonce: 1529719510312

200 OK

Coming soon!

Socket API

The socket.io API can be used for high speed order management. Notifications of server-side events are also received through the socket interface. Socket API calls are also authenticated using the loginless zero-knowledge authentication system. The loginless socket API will transparently perform authenticated requests for you.

Socket Request and Response

The Socket API uses the same request response format of the REST API but adds some additional envelope to pass headers. Since socket responses are asynchronous, you may optionally supply a requestid field in the headers so you can co-relate the response.

Request Serialization Format (create order sent on topic POST /order)

{
  "headers": {
    "requestid": "13ca323b-c2a7-4359-ab35-4a6a1f1de7ea",
    "Authorization": "HMAC mjNCXZT2k8oYRRu4mrRwFfcFWZoF6J5hi2:41fbd3f4a0c28780e11232061c1ae872adbcf91c78961c2aee900c2a4c79309c",
    "Nonce": 1491177913277
  },
  "method": "POST",
  "uri": "/order",
  "body": [{
    "userid": "mjNCXZT2k8oYRRu4mrRwFfcFWZoF6J5hi2",
    "instrument": "BTCUSDW",
    "side": "buy",
    "quantity": 1,
    "price": 1103,
    "orderType": "LMT",
    "clientid": "9fdda9ee-667a-4341-b317-072a923a753a",
    "stopPrice": 19.7,
    "crossMargin": false,
    "targetPrice": "NONE",
    "postOnly": false
  }]
}

Response Serialization Format on event order_add

Responses also follow the REST format but have an additional envelope containing the requestid and socket topic

{
  "result": [{
    "uuid": "35cab340-1801-11e7-a281-495834a76145",
    "userid": "mjNCXZT2k8oYRRu4mrRwFfcFWZoF6J5hi2",
    "side": "buy",
    "quantity": 1,
    "filled": 0,
    "cancelled": 0,
    "price": 1103,
    "normalizedPrice": 45330916,
    "averagePrice": 0,
    "entryTime": 1491177913461088,
    "eventTime": 1491177913461088,
    "status": "open",
    "entryOrder": {},
    "orderType": "LMT",
    "stopPrice": 19.7,
    "targetPrice": "NONE",
    "clientid": "9fdda9ee-667a-4341-b317-072a923a753a",
    "instrument": "BTCUSD7J07",
    "commission": 0.0005,
    "reward": 0,
    "cushion": 2,
    "reservedTicks": 2,
    "crossMargin": false,
    "marginPerQty": 918953
  }],
  "methodName": "createOrders",
  "requestid": "13ca323b-c2a7-4359-ab35-4a6a1f1de7ea",
  "topic": "order_add"
}

Loginless socket

The node.js and python loginless APIs will enable you to send and receive messages over socket transparently adding the necessary Authorization and Nonce headers and passes the request on the topic method + uri.

Registering to listen to events

To request notifications for server and user events, register socket with server.

loginless.socket.register()

Stop listening to events

To stop listening to events for this user, for example to change user account, unregister from the server

loginless.socket.unregister()
// change account

Socket Order Management

All REST order management can also be done over sockets. The loginless.socket library automatically adds Authorization and Nonce headers .

Create New orders

loginless.socket.send({
  method: "POST",
  uri: "/order",
  headers: { "requestid": "13ca323b-c2a7-4359-ab35-4a6a1f1de7ea" },
  body: [{
    "userid": "mjNCXZT2k8oYRRu4mrRwFfcFWZoF6J5hi2",
    "instrument": "BTCUSDW",
    "side": "buy",
    "quantity": 1,
    "price": 1103,
    "orderType": "LMT",
    "clientid": "9fdda9ee-667a-4341-b317-072a923a753a",
    "stopPrice": 19.7,
    "crossMargin": false,
    "targetPrice": "NONE",
    "postOnly": false
  }]
})

Update Orders

  loginless.socket.send({
    "method": "PUT",
    "uri": "/order",
    "headers": { "requestid": "09ca323b-c2a7-4359-ab35-4a6a1f1de7ea" },
    "body": [{
      "price": 1103,
      "clientid": "9fdda9ee-667a-4341-b317-072a923a753a",
    }]
})

PATCH: Combined create/delete/update

The PATCH method uses the syntax for RFC6902. In addition to the standard ops, we have added merge and split for position management

PATCH op Order operation
add Create new order
remove Delete order
replace Update order
split Split position
merge Merge positions
loginless.socket.send({
  "method": "PATCH",
  "uri": "/order",
  "headers": { "requestid": "f4ca323b-c2a7-4359-ab35-4a6a1f1de7ea" },
  "body": [
     {
        "op":"remove",
        "value": ["0d71f940-c7b5-11e6-9906-9cd1c95275e5"]
     },
     {
         "op":"replace",
         "value":[
             {
                 "uuid":"76d015e0-27b2-11e7-8df2-8467e413f756",
                 "price":1100
             }
         ]
     },
     {
         "op":    "add",
         "value": [
           {
             "instrument": "BTCUSDW",
             "side":        "buy",
             "quantity":    1,
             "price":       1035.3,
             "orderType":   "LMT",
             "clientid":    "b825ce03-fb16-4fd7-8fbe-e225803509a4",
             "stopPrice":   4.2,
             "crossMargin": false,
             "targetPrice": "NONE",
             "postOnly":    false
           }
         ]
     }
]
})

Merge multiple positions

loginless.socket.send({
  "method": "PATCH",
  "uri": "/order",
  "headers": { "requestid": "bcda323b-c2a7-4359-ab35-4a6a1f1de7ea" },
  "body": [{
    "op": "merge",
    "value": ["241dbf90-293e-11e7-9093-9cf21d0dd434", "8bb29550-293d-11e7-b2cd-49c1c6dde9fb"]
  }]
})

Split positions

To split a 5 quantity position into 3 and 2:

loginless.socket.send({
  "method": "PATCH",
  "uri": "/order",
  "headers": { "requestid": "faaa323b-c2a7-4359-ab35-4a6a1f1de7ea" },
  "body": [{
    "op": "split",
    "value": ["785e0bf0-293e-11e7-b3a6-bfced17d398c"],
    "quantity": 10
  }]
})

Socket Events

General Sitewide events

Event Meaning
advisory General advisory regarding exchange
config Server Configuration has changed.
readonly Server is in read-only maintenance mode.
server_time Unix timestamp on server. Useful for adjusting clock skew if needed.
version Version of the client code
Event Meaning
delivery_price Estimated delivery price
difforderbook Quantity and size for changed prices only (real-time)
orderbook Entire orderbook (every minute)
priceband Trading Band where trades can take place
instruments Current tradable instruments
open_interest Open interest
trade Execution data when a trade occurs.
volume_24h Volume over the last 24 hrs

These events are standard socket.io connection events.

Event Meaning
connect_error There was an error trying to connect
connect_timeout Can’t seem to reach server
reconnect Attempting reconnect (usually after laptop is reopened)
reconnect_error Failed to reconnect (bad wifi?)
reconnect_failed Failed to reconnect (bad wifi?)
Event Meaning
auth_error You are using the wrong key or your clock is off
account Your account info with margin, P&L and orders
affiliate Affiliate info
settlement There has been an on-chain settlement
Event Meaning HTTP
order_add create order request POST
order_del delete order request DELETE
order_update Update order request PUT
order_patch Multi-operation request PATCH
order_closed Order was filled completely
order_error There was an error processing your order
order_execution Order was filled partially or completely

Sitewide Events

advisory

{
  "id": "advisoryid",
  "advice": "There will be a 24 hour settlement delay"
}

config

Server config has changed. See REST API

readonly

{
  "readonly": true
}

server_time

1492927290621

version

{
  "version": "23733f8923"
}

delivery_price

{
  "BTCUSD7K05": 1237,
  "BTCUSD7J28": 1237
}

difforderbook

{
  "instrument": "BTCUSD7K05",
  "buy": {
    "1244.8": {
      "price": 1244.8,
      "numberOfOrders": 0,
      "totalQuantity": 0,
      "instrument": "BTCUSD7K05"
    },
    "1244.7": {
      "price": 1244.7,
      "numberOfOrders": 1,
      "totalQuantity": 20,
      "instrument": "BTCUSD7K05"
    }
  },
  "sell": {},
  "bid": 1245.2,
  "ask": 1246.4
}

orderbook

{
  "BTCUSD7K05": {
    "bid": 1245.2,
    "ask": 1246.4,
    "buy": [{
      "price": 1245.2,
      "numberOfOrders": 1,
      "totalQuantity": 20,
      "instrument": "BTCUSD7K05"
    }, {
      "price": 1245.1,
      "numberOfOrders": 1,
      "totalQuantity": 20,
      "instrument": "BTCUSD7K05"
    }],
    "sell": [{
      "price": 1246.4,
      "numberOfOrders": 1,
      "totalQuantity": 20,
      "instrument": "BTCUSD7K05"
    }, {
      "price": 1246.5,
      "numberOfOrders": 1,
      "totalQuantity": 20,
      "instrument": "BTCUSD7K05"
    }]
  },
  "BTCUSD7J28": {
    "bid": 1240,
    "ask": 1241.2,
    "buy": [{
      "price": 1240,
      "numberOfOrders": 1,
      "totalQuantity": 20,
      "instrument": "BTCUSD7J28"
    }, {
      "price": 1239.9,
      "numberOfOrders": 1,
      "totalQuantity": 20,
      "instrument": "BTCUSD7J28"
    }],
    "sell": [{
      "price": 1241.2,
      "numberOfOrders": 1,
      "totalQuantity": 20,
      "instrument": "BTCUSD7J28"
    }, {
      "price": 1241.3,
      "numberOfOrders": 1,
      "totalQuantity": 20,
      "instrument": "BTCUSD7J28"
    }]
  }
}

priceband

{
  "BTCUSD7K05": {
    "price": 1236.5,
    "lastProvider": "gemini",
    "used": 5,
    "providers": {
      "gemini": {
        "price": 1236.51,
        "time": 1492925983543
      },
      "okcoin": {
        "price": 1229.89,
        "time": 1492925905600
      },
      "coinbase": {
        "price": 1241.5,
        "time": 1492925968688
      },
      "bitfinex": {
        "price": 1345,
        "time": 1492925956683
      },
      "bitstamp": {
        "price": 1223.8,
        "time": 1492925871058
      }
    },
    "max": 1248.9,
    "min": 1224.1,
    "instrument": "BTCUSD7K05"
  },
  "BTCUSD7J28": {
    "price": 1236.5,
    "lastProvider": "gemini",
    "used": 5,
    "providers": {
      "gemini": {
        "price": 1236.51,
        "time": 1492925983543
      },
      "okcoin": {
        "price": 1229.89,
        "time": 1492925905600
      },
      "coinbase": {
        "price": 1241.5,
        "time": 1492925968688
      },
      "bitfinex": {
        "price": 1345,
        "time": 1492925956683
      },
      "bitstamp": {
        "price": 1223.8,
        "time": 1492925871058
      }
    },
    "max": 1248.9,
    "min": 1224.1,
    "instrument": "BTCUSD7J28"
  }
}

instruments

The available instrument list has changed. A new contract may have been added, an old one dropped or a futures contract has rolled over (expired and new one created)

{
  "BTCUSD7K05": {
    "type": "inverse",
    "template": "BTCUSD",
    "commission": 0.0005,
    "reward": 0,
    "stopcushion": 2,
    "stopprice": 2,
    "targetprice": 3,
    "crossMarginInitialStop": 15,
    "ticksize": 1,
    "ticksperpoint": 10,
    "contractusdvalue": 100,
    "bandUpperLimit": 0.01,
    "bandLowerLimit": 0.01,
    "introducerReward": 0,
    "introducedReward": 0,
    "rewardsCalculationInterval": 14400,
    "minMarketStop": 1.6,
    "minLimitStop": 1.6,
    "uplDecimalPlaces": 8,
    "externalFeed": "coinpit-index#BTCUSD",
    "expiryClass": "weekly",
    "maxLeverage": 100,
    "symbol": "BTCUSD7K05",
    "start": 1492794900000,
    "expiry": 1494004500000,
    "next": "BTCUSD7K12",
    "status": "active"
  },
  "BTCUSD7J28": {
    "type": "inverse",
    "template": "BTCUSD",
    "commission": 0.0005,
    "reward": 0,
    "stopcushion": 2,
    "stopprice": 2,
    "targetprice": 3,
    "crossMarginInitialStop": 15,
    "ticksize": 1,
    "ticksperpoint": 10,
    "contractusdvalue": 100,
    "bandUpperLimit": 0.01,
    "bandLowerLimit": 0.01,
    "introducerReward": 0,
    "introducedReward": 0,
    "rewardsCalculationInterval": 14400,
    "minMarketStop": 1.6,
    "minLimitStop": 1.6,
    "uplDecimalPlaces": 8,
    "externalFeed": "coinpit-index#BTCUSD",
    "expiryClass": "weekly",
    "maxLeverage": 100,
    "symbol": "BTCUSD7J28",
    "start": 1492190100000,
    "expiry": 1493399700000,
    "next": "BTCUSD7K05",
    "status": "active"
  }
}

open_interest

{
  "BTCUSD7J28": {
    "qty": 41,
    "btc": 3.29861387,
    "instrument": "BTCUSD7J28"
  }
}

trade

{
  "date": 1492925983,
  "price": 1236.5,
  "volume": 0,
  "instrument": "BTCUSD7K05"
}

volume_24h

{
  "BTCUSD7K05": {
    "qty": 0,
    "btc": 0,
    "instrument": "BTCUSD7K05"
  },
  "BTCUSD7J28": {
    "qty": 0,
    "btc": 0,
    "instrument": "BTCUSD7J28"
  }
}

auth_error

{
  "error": "Authentication error. Nonce stale"
}

account

{
  "account": {
    "orders": {
      "BTCUSD7K05": {},
      "BTCUSD7J28": {
        "c70af2e0-27ef-11e7-9105-85071ed4b987": {
          "uuid": "c70af2e0-27ef-11e7-9105-85071ed4b987",
          "userid": "mjNCXZT2k8oYRRu4mrRwFfcFWZoF6J5hi2",
          "side": "sell",
          "quantity": 1,
          "filled": 0,
          "cancelled": 0,
          "price": 1228.7,
          "normalizedPrice": 8138683,
          "averagePrice": 0,
          "entryTime": 1492929644814486,
          "eventTime": 1492929644814486,
          "status": "open",
          "entryOrder": {
            "c7024050-27ef-11e7-b103-690a3b9a9f71": 1
          },
          "orderType": "STP",
          "stopPrice": 15.4,
          "targetPrice": "NONE",
          "instrument": "BTCUSD7J28",
          "oco": "c70b19f0-27ef-11e7-a30f-c593750e3cb0",
          "maxStop": 1226.7,
          "entryPrice": 1243.2,
          "entryAmount": 8043758,
          "commission": 0.0005,
          "reward": 0,
          "cushion": 2,
          "reservedTicks": 2,
          "crossMargin": false,
          "normalizedEntryPrice": 8043758,
          "normalizedMaxStop": 8151952
        },
        "c70b19f0-27ef-11e7-a30f-c593750e3cb0": {
          "uuid": "c70b19f0-27ef-11e7-a30f-c593750e3cb0",
          "userid": "mjNCXZT2k8oYRRu4mrRwFfcFWZoF6J5hi2",
          "side": "sell",
          "quantity": 1,
          "filled": 0,
          "cancelled": 0,
          "price": "NONE",
          "normalizedPrice": "NONE",
          "averagePrice": 0,
          "entryTime": 1492929644815281,
          "eventTime": 1492929644815281,
          "status": "open",
          "entryOrder": {
            "c7024050-27ef-11e7-b103-690a3b9a9f71": 1
          },
          "orderType": "TGT",
          "stopPrice": 15.4,
          "targetPrice": "NONE",
          "instrument": "BTCUSD7J28",
          "oco": "c70af2e0-27ef-11e7-9105-85071ed4b987",
          "entryPrice": 1243.2,
          "entryAmount": 8043758,
          "commission": 0.0005,
          "reward": 0,
          "cushion": 2,
          "reservedTicks": 2,
          "crossMargin": false,
          "normalizedEntryPrice": 8043758
        }
      },
      "MBTCUSD7J230645": {},
      "MBTCUSD7J230650": {}
    },
    "positions": {
      "BTCUSD7J28": {
        "userid": "mjNCXZT2k8oYRRu4mrRwFfcFWZoF6J5hi2",
        "instrument": "BTCUSD7J28",
        "averagePrice": 1243.2,
        "quantity": 1,
        "entryAmount": -8043758,
        "commission": 0
      }
    },
    "pnl": {
      "userid": "mjNCXZT2k8oYRRu4mrRwFfcFWZoF6J5hi2",
      "accountid": "2MvZ31TkfyNhe26PdSxVaDHGQ73te9eNsfM",
      "pnl": -4022,
      "commission": 4022
    },
    "margin": 214668166,
    "displayMargin": 214668166,
    "accountMargin": 214784404,
    "userid": "mjNCXZT2k8oYRRu4mrRwFfcFWZoF6J5hi2"
  }
}

affiliate

Affiliate balance has changed. (Temporarily disabled)

settlement

Indicates a settlement has occurred at this timestamp.

1492929905529

order_add

{
  "result": [{
    "uuid": "c9899630-27e9-11e7-899a-ef2b4de19b63",
    "userid": "mvuQJYbLDDMKsNtr2KLV6fqeYj5Zis1Xdk",
    "side": "buy",
    "quantity": 56,
    "filled": 0,
    "cancelled": 0,
    "price": 1226.4,
    "normalizedPrice": 8153947,
    "averagePrice": 0,
    "entryTime": 1492927072019986,
    "eventTime": 1492927072019986,
    "status": "open",
    "entryOrder": {},
    "orderType": "LMT",
    "stopPrice": 22.2,
    "targetPrice": "NONE",
    "clientid": "05f06edb-07ad-41b1-9b19-1bc94ee88d48",
    "instrument": "BTCUSD7J28",
    "commission": 0.0005,
    "reward": 0,
    "cushion": 2,
    "reservedTicks": 2,
    "crossMargin": false,
    "marginPerQty": 164137
  }],
  "requestid": "6ffa07e6-72bb-46a6-85f2-d5e2b33a19ea"
}

order_del

{
  "result": ["c9899630-27e9-11e7-899a-ef2b4de19b63"],
  "requestid": "3630eb81-f8cf-4cd2-aa30-1af1a35ceb23"
}

order_update

{
  "result": [{
    "uuid": "c9899630-27e9-11e7-899a-ef2b4de19b63",
    "userid": "mvuQJYbLDDMKsNtr2KLV6fqeYj5Zis1Xdk",
    "side": "buy",
    "quantity": 20,
    "filled": 0,
    "cancelled": 0,
    "price": 10000000,
    "normalizedPrice": 1000,
    "averagePrice": 0,
    "entryTime": 1492927971592021,
    "eventTime": 1492926742986517,
    "status": "open",
    "entryOrder": {
      "3630eb81-f8cf-4cd2-aa30-31f1a35ceb23": 10
    },
    "orderType": "STP",
    "stopPrice": 15,
    "targetPrice": 1.1,
    "instrument": "BTCUSD7K05",
    "oco": "0000eb81-f8cf-4cd2-aa30-1af1a35ceb23",
    "maxStop": 10000002,
    "entryPrice": 1247.9,
    "entryAmount": 160262840,
    "commission": 0.0005,
    "reward": 0,
    "cushion": 2,
    "reservedTicks": 2,
    "crossMargin": true,
    "normalizedEntryPrice": 8013463,
    "normalizedMaxStop": 1000
  }]
}

order_patch

{
  "result": [{
    "op": "replace",
    "response": [{
      "uuid": "f55da690-27ec-11e7-9cdc-162c83ed5b42",
      "userid": "mzW114gYZGfa49BPm87hfB7zt1QdcRQeCw",
      "side": "buy",
      "quantity": 1,
      "filled": 0,
      "cancelled": 0,
      "price": 1246.7,
      "normalizedPrice": 8021176,
      "averagePrice": 0,
      "entryTime": 1492928605494265,
      "eventTime": 1492928434041100,
      "status": "open",
      "entryOrder": {
        "d3836451-2559-11e7-bb02-cd2d81d82f6b": 1
      },
      "orderType": "TGT",
      "stopPrice": 15,
      "targetPrice": 1.1,
      "instrument": "BTCUSD7J28",
      "oco": "f55d7f80-27ec-11e7-8044-39e1b67933d6",
      "entryPrice": 1247.8,
      "entryAmount": 8014105,
      "commission": 0.0005,
      "reward": 0,
      "cushion": 2,
      "reservedTicks": 2,
      "crossMargin": true,
      "normalizedEntryPrice": 8014105
    }],
    "statusCode": 200
  }],
  "requestid": "caa31739-6067-43f2-acef-411e187fcbe3"
}

order_error

{
  "error": {
    "message": "Orders must be a list"
  },
  "requestid": "9999b86e-7db0-4d54-b4b3-01c1c1c66305"
}

order_execution

{
  "userid": "mvuQJYbLDDMKsNtr2KLV6fqeYj5Zis1Xdk",
  "executionid": "f5576502-27ec-11e7-89a2-61b4b036d3ce",
  "side": "buy",
  "orderType": "MKT",
  "orderid": "f5506020-27ec-11e7-b01a-831908d49bb9",
  "price": 1247.8,
  "quantity": 1,
  "liquidity": "commission",
  "commission": 4007,
  "eventTime": 1492928434001042,
  "instrument": "BTCUSD7J28",
  "entryAmount": 0,
  "pnl": 0
}

Errors

The Leverj API uses the standard HTTP error codes:

Error Code Meaning
400 Bad Request – Usually syntax error in your HTTP request URI or headers
401 Unauthorized – You are using an unregistered private key or your clock is way off
404 Not Found – The specified resource could not be found
405 Method Not Allowed – Resource does not support that method. Eg. PUT on a GET only resource
406 Not Acceptable – You requested a format that isn’t JSON
410 Gone – Resource no longer supported
429 Too Many Requests – You have exceed the rate limit
500 Internal Server Error – We had a problem with our server. Try again later.
503 Service Unavailable – We’re temporarily offline for maintenance. Please try again later.