NAV Navbar
python javascript

Introduction

Coinpit REST and Websocket API enable access to all features of the platform. A complete and comprehensive platform on top of the Coinpit API comprising of Trading clients, Trading bots, etc. can be built on top of it. The live trading site is also built entirely using this API and should be seen as one of the many possible platform implementations.

Please refer to JSON field definitions for more information.

Language SDK/Libraries

Currently we support node.js and python SDK for programmatic access. Select your programming language on the top right of the page to select code examples appropriately.

Scheme

REST URL = BASE_URL + ENDPOINT

Base URL

The base url for all REST API for the live site is https://live.coinpit.io/api/v1. For testnet use https://live.coinpit.me. 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.coinpit.io/api/v1/all/info

From your programming language

import requests
print requests.get("https://live.coinpit.io/api/v1/all/info").text'
restjs.get("https://live.coinpit.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.coinpit.io/api/v1/all/info")
          .then(function(result) {
            console.log(result)
          })
  </script>

In node.js

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

URL parameters

Url parameters are denoted by prepending a colon:

/contract/: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 contract BTCUSDW, the actual url would be

https://live.coinpit.io/api/v1/contract/BTCUSDW/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.coinpit.io/api/v1/contract/BTCUSDW/executions?from=123e4567-e89b-12d3-a456-426655440000

HTTP headers

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

Quickstart using Coinpit shell: coinpit.py

The python package pycoinpit enables a shell like interaction with the coinpit.io API and enables you to enter REST commands and have them translated to authenticated REST calls. The -p or --pretty option pretty-prints JSON responses. The -v or --verbose option in addition also dumps headers.

$ pip install pycoinpit

$ coinpit.py -v -k mx5YeJZSJbrENq24PLzW8BYHUxJb48Ttfj.json

Using keyfile:  mx5YeJZSJbrENq24PLzW8BYHUxJb48Ttfj.json

Connected to  https://live.coinpit.me/api/v1
Enter REST commands: METHOD path body. Enter quit to exit
For more information: https://coinpit.io/api

Examples:
  GET /account
  POST /order [{"price":1201.2,"side":"buy","quantity":10,"orderType":"LMT","instrument":"BTCUSDW"}]
  PUT /order [{"price":1201.3,"uuid":"b117ef30-1f50-11e7-b324-e2f410d2f5f7"}]
  GET /order
  DELETE /order/b117ef30-1f50-11e7-b324-e2f410d2f5f7

mx5YeJZSJbrENq24PLzW8BYHUxJb48Ttfj>

REST commands may be entered at the prompt as HTTP method, url and optional body. The shell performs authenticated REST call and displays the result

mx5YeJZSJbrENq24PLzW8BYHUxJb48Ttfj>get /account
GET https://live.coinpit.me/api/v1/account HTTP/1.0
Nonce: 1492043473117
Accept: application/json
Authorization: HMAC mx5YeJZSJbrENq24PLzW8BYHUxJb48Ttfj:f6d59269584a86f7457e23c8c61e8aba4c5d9fca1fe800fd3536caa22a3348fd
===================================

200
===================================
{
    "displayMargin":9414800,
    "positions":{},
    "userid":"mx5YeJZSJbrENq24PLzW8BYHUxJb48Ttfj",
    "margin":9414800,
    "orders":{
        "BTCUSD7J14":{
            "6feea600-1fa7-11e7-883c-2b1c532b3fc4":{
                "marginPerQty":27815,
                "stopPrice":2,
                "eventTime":1492018965601165,
                "uuid":"6feea600-1fa7-11e7-883c-2b1c532b3fc4",
                "instrument":"BTCUSD7J14",
                "orderType":"LMT",
                "filled":0,
                "status":"open",
                "normalizedPrice":8325008,
                "price":1201.2,
                "entryTime":1492018965601165,
                "targetPrice":3,
                "cancelled":0,
                "averagePrice":0,
                "side":"buy",
                "quantity":10
            }
        },
        "BTCUSD7J21":{}
    },
    "accountMargin":9971100
}

Loginless Authentication

Loginless is a zero-knowledge authentication system, which relies on ECDSA. The scheme involves arriving at a shared secret using your private key and the public key of the peer. Every request is HMAC authenticated using this shared secret.

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 Heartbleed bug

Overview

Loginless requires you to set Authorization and Nonce headers in HTTP for protected endpoints. This requires your public key and user id, which are in your JSON key file that you saved when you first visit the web site.

Authorization and Nonce headers

The syntax for Authorization and Nonce headers is as below.

Authorization: HMAC <user_id>:<hmac_sha256>
Nonce: <unix_time>

For example, to get account information:

GET /api/v1/account HTTP/1.1
Host: live.coinpit.io
Authorization: HMAC mvuQJYbLDDMKsNtr2KLV6fqeYj5Zis1Xdk:0a9448430e631022ca75425805072ce7bad9d1f8229373fe64a479ab98a50ab3
Nonce: 1478041315653

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

Loginless node module

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

var Loginless = require('loginless')
var loginless = Loginless(coinpitUrl, "/api/v1")

loginless.getServerKey(key.privateKey).then(function (serverResponse) {
  loginless.rest.get("/aacount")
  loginless.socket.register() // listen to socket messages

  Object.keys(socketCallbacks).forEach(function(topic) {
    loginless.socket.on(topic, socketCallbacks[topic])
  })

Authentication with loginless server

If you prefer a programming language that does not yet have loginless library, you can authenticate using the scheme below:

Setup ECDH

Getting the corresponding public address of the server for your personal public address: GET /api/v1/auth/:my_public_key

Send your public key

GET /api/v1/auth/038657d14c91aef4c7b2b117cfd1ee18fb7a9e0b248f8168f16b1bad63f9e7df37 HTTP/1.1
Accept: application/json
Host: live.coinpit.io

Server returns the corresponding public key

{
"serverPublicKey": "03133b6286431a0a5251a464ced4a5dbf156e8631a01cdadda9e6fd448bfc7eda7",
"userid": "mvuQJYbLDDMKsNtr2KLV6fqeYj5Zis1Xdk"
}

Compute Shared Secret

Compute the shared secret using your private key and the server’s public key

  var bitcoin      = require('bitcoinjs-lib')
  var crypto       = require('crypto')
  var myEcdhKey    = getEcdhKey(bitcoin.ECPair.fromWIF(myPrivateKeyWif, bitcoin.networks[network]))
  var sharedSecret = myEcdhKey.computeSecret(serverPublicKeyHex, 'hex', 'hex')

  function getEcdhKey(privateKey) {
    var ecdhKey = crypto.createECDH('secp256k1')
    ecdhKey.generateKeys()
    ecdhKey.setPrivateKey(privateKey.d.toBuffer(32))
    ecdhKey.setPublicKey(privateKey.getPublicKeyBuffer())
    return ecdhKey
  }

import binascii
import pybitcointools
import pyelliptic

network_code = 111 # 111 for testnet; 0 for livenet

pub_key_bytes           = binascii.unhexlify(self.server_pub_key)
uncompressed_user_key   = binascii.unhexlify(pybitcointools.decompress(self.user_pub_key))
uncompressed_server_key = binascii.unhexlify(pybitcointools.decompress(self.server_pub_key))
user_priv_key_bin       = binascii.unhexlify(pybitcointools.encode_privkey(self.private_key, 'hex', network_code))
self.user               = pyelliptic.ECC(privkey=user_priv_key_bin, pubkey=uncompressed_user_key, curve='secp256k1')
self.shared_secret      = self.user.get_ecdh_key(uncompressed_server_key)

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

Compute HMAC authorization for all subsequent requests

  function getAuthorization(userId, secret, method, uri, body, nonce) {
    if (!secret) return 'HMAC ' + userId
    var message = JSON.stringify({ method: method, uri: uri, body: body, nonce: nonce })
    var hmac    = crypto.createHmac('sha256', new Buffer(secret, 'hex'))
    hmac.update(message)
    return 'HMAC ' + userId + ":" + hmac.digest('hex')
  }
    nonce = str(long(time.time() * 1000))
    request_string = '{"method":"' + method + '","uri":"' + rest_url  + ('",' if(body == None) else '","body":' + body + ',') + '"nonce":' + nonce + '}'
    mac = hmac.new(self.shared_secret, request_string,    hashlib.sha256)
    sig = mac.hexdigest()
    headers = {
        'Authorization': 'HMAC ' + self.user_id + ':' + sig,
        'Nonce': nonce,
        'Accept': 'application/json'
    }
    return headers

Send request using Authorization and nonce headers

curl -H 'Authorization: HMAC mvuQJYbLDDMKsNtr2KLV6fqeYj5Zis1Xdk:0a9448430e631022ca75425805072ce7bad9d1f8229373fe64a479ab98a50ab3' -H 'Nonce 1478041315653' https://live.coinpit.me/api/v1/contract/BTCUSDW/order

Coinpit REST API

Unprotected REST API endpoints

Unprotected endpoints do not require an Authorization header.

Authentication

Method Rest Endpoint Description
GET /auth Get Server public key for loginless auth
POST /auth Register new user

General Exchange data

Method Rest Endpoint Description
GET /all/info Last price, 24Hr volume, etc
GET /all/band GET external index prices for different instruments

Exchange configuration

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

Protected REST API endpoints

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

Market Data

Method Rest Endpoint Description
GET /contract/:symbol/chart/:timeframe Get chart info for instrument :symbol

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
PATCH /order Combined create/update/cancel

Orders by contract and status

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

Order Book

Method Rest Endpoint Description
GET /contract/:symbol/orderbook Get order book

Recent Trades

Method Rest Endpoint Description
GET /contract/:symbol/trade Get recent trades

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

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

Margin

Method Rest Endpoint Description
GET /account/margin Get balance in margin account
POST /account/margin Move coins from multisig to Margin account
DELETE /account/margin/:amount Move specified amount of coins from margin account to multisig account

Multisig Account functions

Method Rest Endpoint Description
POST /account/tx/withdraw Send user signed withdrawal tx for server signature
GET /account/tx/recovery Get Server signed Multisig account Recovery TX

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

Get Loginless Server pubkey

If you have already registered your public key, for example by signing on via the trading site, you can use the public key from the json key file to get the server’s public key. The server uses a different key for each user.

GET /auth

200 OK

GET /api/v1/auth/038657d14c91aef4c7b2b117cfd1ee18fb7a9e0b248f8168f16b1bad63f9e7df37 HTTP/1.1
Accept: application/json
Host: live.coinpit.me

200 OK

{
  "serverPublicKey": "03133b6286431a0a5251a464ced4a5dbf156e8631a01cdadda9e6fd448bfc7eda7",
  "userid": "mvuQJYbLDDMKsNtr2KLV6fqeYj5Zis1Xdk"
}

Register Loginless User

It is easiest to register on the trading site, but if you wish to programmatically register a user, you can do so by sending a signed message with your public key, country and IP of registration. During registration, your IP needs to match your country code. Our SDK enables you to do the signatures easily.

POST /auth

POST /api/v1/auth/038657d14c91aef4c7b2b117cfd1ee18fb7a9e0b248f8168f16b1bad63f9e7df37 HTTP/1.1
Accept: application/json
Host: live.coinpit.me
[
  {
    "message":"{\"publicKey\":\"039d43948b9ce88893f3f3cb61d1995142741418f86412f1d5fcc12a010a753ac8\",\"country\":\"DK\",\"timestamp\":1487534736607,\"ip\":\"127.0.0.1\",\"introducerid\":\"\"}",
    "signature":"IF3239UZOPfdU3Ko8Wxf1Ohu5v0SF8TiXhdd66Nb2S4XXDyftF4r7ev1y/S/SGULLX9VxEMi4CJEmtiGzrHDCf0="
  }
]

200 OK

 {"userid":"my7hu7RZDhRRBFRHXgqDMbbtCNX8rokGS9","serverPublicKey":"03cfa0eb0226f9c189967f048ba575b989bded84bebf4042e08571384f12252408"}

Exchange Basic Info

GET /all/info

GET /api/v1/all/info HTTP/1.1
Accept: application/json
Host: live.coinpit.me

200 OK

{
    "BTCUSD7J21":{
        "lastPrice":1218.2,
        "vol24H":{
            "instrument":"BTCUSD7J21",
            "btc":0,
            "qty":0
        },
        "bid":1223,
        "ask":1224.1,
        "indexPrice":1217.3,
        "openInterest":{
            "instrument":"BTCUSD7J21",
            "btc":3.35991635,
            "qty":40
        }
    },
    "BTCUSD7J14":{
        "lastPrice":1216.9,
        "vol24H":{
            "instrument":"BTCUSD7J14",
            "btc":2.95598808,
            "qty":36
        },
        "bid":1217.2,
        "ask":1217.9,
        "indexPrice":1217.3,
        "openInterest":{
            "instrument":"BTCUSD7J14",
            "btc":2.30003528,
            "qty":28
        }
    },
    "BTCUSD":{
        "aggregate":true,
        "vol24H":{
            "btc":2.95598808,
            "qty":36
        },
        "openInterest":{
            "btc":5.65995163,
            "qty":68
        },
        "indexPrice":1217.3
    }
}

Anti-Manipulation bands

GET /all/band

GET /api/v1/all/band HTTP/1.1
Accept: application/json
Host: live.coinpit.me

200 OK

{
    "BTCUSD7J14":{
        "max":1227.7,
        "price":1217.7,
        "instrument":"BTCUSD7J14",
        "min":1207.7
    },
    "BTCUSD7J21":{
        "max":1229.9,
        "price":1217.7,
        "instrument":"BTCUSD7J21",
        "min":1205.5
    }
}

Contract Specs

GET /all/spec

GET /api/v1/all/spec HTTP/1.1
Accept: application/json
Host: live.coinpit.me

200 OK

{
    "instruments":[
        "BTCUSD7J14",
        "BTCUSD7J21"
    ],
    "parameter":{
        "BTCUSD7J14":{
            "maxLeverage":50,
            "expiryClass":"weekly",
            "bandUpperLimit":10,
            "minLimitStop":1.6,
            "minMarketStop":1.6,
            "bandLowerLimit":10,
            "ticksize":1,
            "uplDecimalPlaces":4,
            "start":1490980500000,
            "next":"BTCUSD7J21",
            "commission":0.0005,
            "template":"BTCUSD",
            "crossMarginInitialStop":15,
            "type":"inverse",
            "introducerReward":0,
            "status":"active",
            "targetprice":3,
            "symbol":"BTCUSD7J14",
            "expiry":1492190100000,
            "contractusdvalue":100,
            "introducedReward":0,
            "externalFeed":"coinpit-index#BTCUSD",
            "stopcushion":2,
            "ticksperpoint":10,
            "stopprice":2,
            "rewardsCalculationInterval":14400,
            "reward":0
        },
        "BTCUSD7J21":{
            "maxLeverage":50,
            "expiryClass":"weekly",
            "bandUpperLimit":0.01,
            "minLimitStop":1.6,
            "minMarketStop":1.6,
            "bandLowerLimit":0.01,
            "ticksize":1,
            "uplDecimalPlaces":4,
            "start":1491585300000,
            "next":"BTCUSD7J28",
            "commission":0.0005,
            "template":"BTCUSD",
            "crossMarginInitialStop":15,
            "type":"inverse",
            "introducerReward":0,
            "status":"active",
            "targetprice":3,
            "symbol":"BTCUSD7J21",
            "expiry":1492794900000,
            "contractusdvalue":100,
            "introducedReward":0,
            "externalFeed":"coinpit-index#BTCUSD",
            "stopcushion":2,
            "ticksperpoint":10,
            "stopprice":2,
            "rewardsCalculationInterval":14400,
            "reward":0
        }
    }
}

Exchange config (format subject to frequent change)

GET /all/config

GET /api/v1/all/config HTTP/1.1
Accept: application/json
Host: live.coinpit.me

200 OK

{
    "instruments":{
        "BTCUSD7J28":{
            "maxLeverage":100,
            "expiryClass":"weekly",
            "bandUpperLimit":0.01,
            "minLimitStop":1.6,
            "minMarketStop":1.6,
            "bandLowerLimit":0.01,
            "ticksize":1,
            "uplDecimalPlaces":8,
            "start":1492190100000,
            "next":"BTCUSD7K05",
            "commission":0.0005,
            "template":"BTCUSD",
            "crossMarginInitialStop":15,
            "type":"inverse",
            "introducerReward":0,
            "status":"active",
            "targetprice":3,
            "symbol":"BTCUSD7J28",
            "expiry":1493399700000,
            "contractusdvalue":100,
            "introducedReward":0,
            "externalFeed":"coinpit-index#BTCUSD",
            "stopcushion":2,
            "ticksperpoint":10,
            "stopprice":2,
            "rewardsCalculationInterval":14400,
            "reward":0
        },
        "BTCUSD7K05":{
            "maxLeverage":100,
            "expiryClass":"weekly",
            "bandUpperLimit":0.01,
            "minLimitStop":1.6,
            "minMarketStop":1.6,
            "bandLowerLimit":0.01,
            "ticksize":1,
            "uplDecimalPlaces":8,
            "start":1492794900000,
            "next":"BTCUSD7K12",
            "commission":0.0005,
            "template":"BTCUSD",
            "crossMarginInitialStop":15,
            "type":"inverse",
            "introducerReward":0,
            "status":"active",
            "targetprice":3,
            "symbol":"BTCUSD7K05",
            "expiry":1494004500000,
            "contractusdvalue":100,
            "introducedReward":0,
            "externalFeed":"coinpit-index#BTCUSD",
            "stopcushion":2,
            "ticksperpoint":10,
            "stopprice":2,
            "rewardsCalculationInterval":14400,
            "reward":0
        }
    },
    "config":{
        "sliceSize":10000000,
        "maxLeverage":50,
        "links":{
            "blockcypher":"https://live.blockcypher.com/btc-testnet",
            "blocktrail":"https://www.blocktrail.com/tBTC",
            "blockexplorer":"https://testnet.blockexplorer.com"
        },
        "maximumFee":150000,
        "minimumFee":50000,
        "sliceThreshold":10,
        "geofence":{
            "block":[
                "UM"
            ]
        },
        "bitcoinDust":10000,
        "network":"testnet",
        "maxInputs":50,
        "feePerKB":50510,
        "recoveryFeePerKB":25000,
        "maxPositionsMerge":20,
        "blockchainapi":{
            "socketuri":"https://insight.coinpit.me",
            "uri":"https://insight.coinpit.me/insight-api",
            "provider":"insight"
        },
        "maxOrdersCreateUpdate":100,
        "marginFeeThreshold":0.9,
        "sendFundsMaxTXfee":1000000,
        "noSignup":false,
        "feeCheckInterval":3600000,
        "feeChangeTolerance":0.05,
        "reservedTicks":2,
        "sendFundsTXfee":50000
    }
}

Chart for contract

GET /contract/:symbol/chart/:timeframe

GET /api/v1/contract/BTCUSDW/chart/5 HTTP/1.1
Accept: application/json
Host: live.coinpit.me
Authorization: HMAC mvuQJYbLDDMKsNtr2KLV6fqeYj5Zis1Xdk:0a9448430e631022ca75425805072ce7bad9d1f8229373fe64a479ab98a50ab3
Nonce: 1481655922696

200 OK

[
  {
    "v": 0,
    "s": 0,
    "t": 1481655900,
    "o": 779.4,
    "h": 779.5,
    "l": 779.4,
    "c": 779.5,
    "instrument": "BTCUSD7J28"
  },
  {
    "v": 0,
    "s": 0,
    "t": 1481655600,
    "o": 779.6,
    "h": 779.6,
    "l": 779.5,
    "c": 779.6,
    "instrument": "BTCUSD7J28"
  }
]

Get all open orders

GET /order

GET /api/v1/order HTTP/1.1
Accept: application/json
Host: live.coinpit.me
Authorization: HMAC mfxWFDho5Aa2TTnxKRZNRgBED6GP8C9gDd:7c3fa2fb0702bf1e4f9a94ca6c48cc250d95e078b42c339307096fbe679e2c84
Nonce: 1480957451447

200 OK

[
    {
        "clientid":"de12c110-c616-11e6-8cd0-fbf50c0d0231",
        "marginPerQty":27815,
        "stopPrice":2,
        "eventTime":1492903310910487,
        "uuid":"76d015e0-27b2-11e7-8df2-8467e413f756",
        "instrument":"BTCUSD7J28",
        "orderType":"LMT",
        "filled":0,
        "status":"open",
        "normalizedPrice":8326395,
        "price":1201,
        "entryTime":1492904077170872,
        "targetPrice":3,
        "userid":"mx5YeJZSJbrENq24PLzW8BYHUxJb48Ttfj",
        "cancelled":0,
        "averagePrice":0,
        "side":"buy",
        "quantity":10
    }
]

Get open order by id

GET /order/:uuid

GET /api/v1/order/a5ab5320-27b2-11e7-96d8-d4ff6da48147 HTTP/1.1
Accept: application/json
Host: live.coinpit.me
Authorization: HMAC mfxWFDho5Aa2TTnxKRZNRgBED6GP8C9gDd:7c3fa2fb0702bf1e4f9a94ca6c48cc250d95e078b42c339307096fbe679e2c84
Nonce: 1481655922696

200 OK

[
    {
        "clientid":"de12c110-c616-11e6-8cd0-fbf50c0d0231",
        "marginPerQty":119512,
        "stopPrice":15,
        "eventTime":1492903389522334,
        "uuid":"a5ab5320-27b2-11e7-96d8-d4ff6da48147",
        "instrument":"BTCUSD7J28",
        "orderType":"LMT",
        "filled":0,
        "status":"open",
        "normalizedPrice":8325008,
        "price":1201.2,
        "entryTime":1492903389522334,
        "crossMargin":true,
        "targetPrice":3,
        "userid":"mx5YeJZSJbrENq24PLzW8BYHUxJb48Ttfj",
        "cancelled":0,
        "averagePrice":0,
        "side":"buy",
        "quantity":10
    }
]

Create New Order

POST /order

POST /api/v1/order HTTP/1.1
Accept: application/json
Host: live.coinpit.me
Authorization: HMAC mx5YeJZSJbrENq24PLzW8BYHUxJb48Ttfj:0ec8dce463f49532b2a32a2ae2ffadb9c1d637e3654c6b32f1773ddcc47f8819
Nonce: 1481655922696
[
    {
        "orderType":"LMT",
        "price":1201.2,
        "clientid":"de12c110-c616-11e6-8cd0-fbf50c0d0231",
        "instrument":"BTCUSDW",
        "crossMargin":false,
        "side":"buy",
        "quantity":10
    }
]

200 OK

[
    {
        "clientid":"de12c110-c616-11e6-8cd0-fbf50c0d0231",
        "marginPerQty":27815,
        "stopPrice":2,
        "eventTime":1492903397870121,
        "uuid":"aaa4f9d0-27b2-11e7-ae2c-bbcdf5153f0d",
        "instrument":"BTCUSD7J28",
        "orderType":"LMT",
        "filled":0,
        "status":"open",
        "normalizedPrice":8325008,
        "price":1201.2,
        "entryTime":1492903397870121,
        "crossMargin":false,
        "targetPrice":3,
        "userid":"mx5YeJZSJbrENq24PLzW8BYHUxJb48Ttfj",
        "cancelled":0,
        "averagePrice":0,
        "side":"buy",
        "quantity":10
    }
]

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: live.coinpit.me
Authorization: HMAC mfxWFDho5Aa2TTnxKRZNRgBED6GP8C9gDd:26751dd64f75523257a3aeda5f2d59e68f4322500bcbc4beaa8ad27754ddd62b
Nonce: 1482348434637
[
    {
       "uuid":"503eb8a0-c7b3-11e6-a1d4-539d1cb6cbbc",
       "price":814.8
    }
]

200 OK

[
   {
      "uuid":"503eb8a0-c7b3-11e6-a1d4-539d1cb6cbbc",
      "userid":          "mfxWFDho5Aa2TTnxKRZNRgBED6GP8C9gDd",
      "side":"sell",
      "quantity":        1,
      "filled":          0,
      "cancelled":       0,
      "price":814.8,
      "averagePrice":    0,
      "entryTime":1482348434328077,
      "eventTime":1482348364074468,
      "status":          "open",
      "entryOrder":{
         "50192f40-c7b3-11e6-ba51-b8bd8cf25f84":1
      },
      "orderType":"STP",
      "stopPrice":7.2,
      "targetPrice":     "NONE",
      "instrument":      "BTCUSDW",
      "oco":"503eb8a1-c7b3-11e6-bbb6-4029c20f8e39",
      "maxStop":814,
      "entryPrice":822.3,
      "entryAmount":822.3,
      "commission":10000,
      "reward":          -2500,
      "cushion":         1,
      "reservedTicks":   2,
      "crossMargin":     false
   }
]

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: live.coinpit.me
Authorization: HMAC mfxWFDho5Aa2TTnxKRZNRgBED6GP8C9gDd:fbe7496da2d6f82657d15ad2bf997ca778704f814d8e4601159f4a5519d885e4
Nonce: 1482347623909

200 OK

[
   "adcb4c70-b72a-11e6-9b68-be1cfc0a27e0",
   "50192f40-c7b3-11e6-ba51-b8bd8cf25f84"
]

Combined create/update/cancel

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

PATCH /order

PATCH /api/v1/order HTTP/1.1
Accept: application/json
Host: live.coinpit.me
Authorization: HMAC mfxWFDho5Aa2TTnxKRZNRgBED6GP8C9gDd:0d83676173fe248c8a765d86a551e827e1afe7749a688a836e957a7fde510d69
Nonce: 1482349148300
[
   {
      "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
         }
       ]
   }
]

200 OK

[
  {
    "op": "remove",
    "statusCode": 200,
    "response": [
       "19b3a371-c7b5-11e6-a305-6ee5416bea55"
     ]
   },
  {
    "op": "replace",
    "statusCode": 200,
    "response": [
      {
        "clientid": "de12c110-c616-11e6-8cd0-fbf50c0d0231",
        "marginPerQty": 27815,
        "stopPrice": 2,
        "eventTime": 1492903310910487,
        "uuid": "76d015e0-27b2-11e7-8df2-8467e413f756",
        "instrument": "BTCUSD7J28",
        "orderType": "LMT",
        "commission": 0.0005,
        "entryOrder": {},
        "filled": 0,
        "status": "open",
        "normalizedPrice": 9090909,
        "price": 1100,
        "entryTime": 1492922049174770,
        "cushion": 2,
        "targetPrice": 3,
        "reservedTicks": 2,
        "userid": "mx5YeJZSJbrENq24PLzW8BYHUxJb48Ttfj",
        "cancelled": 0,
        "reward": 0,
        "averagePrice": 0,
        "side": "buy",
        "quantity": 10
          }
      ]
   },
  {
    "op": "add",
    "statusCode": 200,
    "response": [
      {
        "uuid": "16f9fe70-f6d8-11e6-ad01-e5a16988c694",
        "userid": "mfxWFDho5Aa2TTnxKRZNRgBED6GP8C9gDd",
        "side": "buy",
        "quantity": 1,
        "filled": 0,
        "cancelled": 0,
        "price": 1035.3,
        "normalizedPrice": 1035.3,
        "averagePrice": 0,
        "entryTime": 1487531864023840,
        "eventTime": 1487531864023840,
        "status": "open",
        "entryOrder": {},
        "orderType": "LMT",
        "stopPrice": 4.2,
        "targetPrice": "NONE",
        "clientid": "b825ce03-fb16-4fd7-8fbe-e225803509a4",
        "instrument": "BTCUSDW",
        "commission": 20000,
        "reward": -2500,
        "cushion": 1,
        "reservedTicks": 2,
        "crossMargin": false
         }
      ]
   }
]

Using PATCH to merge positions

To merge positions, send both target and stop orders. They will be replaced with new stop and target orders that represent the merged positions.

PATCH https://live.coinpit.me/api/v1/order HTTP/1.1
Nonce: 1493072997331
Host: live.coinpit.me
Accept: application/json
Authorization: HMAC mx5YeJZSJbrENq24PLzW8BYHUxJb48Ttfj:68cd2d30a15e1ac140cdcb335ce9e9e922ea1af573ab0f19728cd9e8a4e9d839
[
  {
    "value": [
            "6f5d5160-293d-11e7-99a0-55b28e36f889",
            "6d74bb40-293d-11e7-bbbe-3aa4c229b3fd"
        ],
    "op": "merge"
    }
]

200 OK

[
    {
        "statusCode":200,
        "response":{
            "removed":[
                "6f5d5160-293d-11e7-99a0-55b28e36f889",
                "6f5d7870-293d-11e7-9d90-39954eec9913",
                "6d74bb40-293d-11e7-bbbe-3aa4c229b3fd",
                "6d74e250-293d-11e7-8f0b-615850a8fdc3"
            ],
            "added":[
                {
                    "entryOrder":{},
                    "normalizedEntryPrice":7923302,
                    "stopPrice":2,
                    "eventTime":1493072997157693,
                    "entryAmount":158477972,
                    "uuid":"8bb29550-293d-11e7-b2cd-49c1c6dde9fb",
                    "oco":"8bb44300-293d-11e7-a7d6-d6ba1ddb48bc",
                    "commission":null,
                    "orderType":"STP",
                    "instrument":"BTCUSD7J28",
                    "maxStop":1251.1,
                    "normalizedMaxStop":7992966,
                    "filled":0,
                    "status":"open",
                    "entryPrice":1262.1,
                    "normalizedPrice":7980209,
                    "price":1253.1,
                    "entryTime":1493072997157693,
                    "executionPrice":0,
                    "crossMargin":false,
                    "targetPrice":3,
                    "userid":"mx5YeJZSJbrENq24PLzW8BYHUxJb48Ttfj",
                    "cancelled":0,
                    "reward":null,
                    "averagePrice":0,
                    "side":"sell",
                    "quantity":20
                },
                {
                    "normalizedEntryPrice":7923302,
                    "stopPrice":2,
                    "eventTime":1493072997168228,
                    "executionPrice":0,
                    "uuid":"8bb44300-293d-11e7-a7d6-d6ba1ddb48bc",
                    "oco":"8bb29550-293d-11e7-b2cd-49c1c6dde9fb",
                    "commission":null,
                    "orderType":"TGT",
                    "instrument":"BTCUSD7J28",
                    "entryOrder":{},
                    "filled":0,
                    "status":"open",
                    "entryPrice":1262.1,
                    "normalizedPrice":7904513,
                    "price":1265.1,
                    "entryTime":1493072997168228,
                    "entryAmount":158477972,
                    "crossMargin":false,
                    "targetPrice":3,
                    "userid":"mx5YeJZSJbrENq24PLzW8BYHUxJb48Ttfj",
                    "cancelled":0,
                    "reward":null,
                    "averagePrice":0,
                    "side":"sell",
                    "quantity":20
                }
            ]
        },
        "op":"merge"
    }
]

Using PATCH to split a position

Send the UUID of the stop order representing the position to be split and the quantity to be split off.

PATCH https://live.coinpit.me/api/v1/order HTTP/1.1
Nonce: 1493073253043
Host: live.coinpit.me
Accept: application/json
Authorization: HMAC mx5YeJZSJbrENq24PLzW8BYHUxJb48Ttfj:db6e359ae9adc4c8aa17487d539082b5a6ced147dd81e83180210a388b2d3657
[
    {
        "quantity":10,
        "value":[
            "8bb29550-293d-11e7-b2cd-49c1c6dde9fb"
        ],
        "op":"split"
    }
]

200 OK

[
    {
        "statusCode":200,
        "response":[
            {
                "entryOrder":{},
                "normalizedEntryPrice":7923930,
                "stopPrice":2,
                "eventTime":1493072997157693,
                "entryAmount":79244952,
                "uuid":"8bb29550-293d-11e7-b2cd-49c1c6dde9fb",
                "oco":"8bb44300-293d-11e7-a7d6-d6ba1ddb48bc",
                "commission":null,
                "orderType":"STP",
                "instrument":"BTCUSD7J28",
                "maxStop":1251.1,
                "normalizedMaxStop":7992966,
                "filled":0,
                "status":"open",
                "entryPrice":1262,
                "normalizedPrice":7980209,
                "price":1253.1,
                "entryTime":1493072997157693,
                "executionPrice":0,
                "crossMargin":false,
                "targetPrice":3,
                "userid":"mx5YeJZSJbrENq24PLzW8BYHUxJb48Ttfj",
                "cancelled":10,
                "reward":null,
                "averagePrice":0,
                "side":"sell",
                "quantity":20
            },
            {
                "normalizedEntryPrice":7923930,
                "stopPrice":2,
                "eventTime":1493072997168228,
                "executionPrice":0,
                "uuid":"8bb44300-293d-11e7-a7d6-d6ba1ddb48bc",
                "oco":"8bb29550-293d-11e7-b2cd-49c1c6dde9fb",
                "commission":null,
                "orderType":"TGT",
                "instrument":"BTCUSD7J28",
                "entryOrder":{},
                "filled":0,
                "status":"open",
                "entryPrice":1262,
                "normalizedPrice":7904513,
                "price":1265.1,
                "entryTime":1493072997168228,
                "entryAmount":79244952,
                "crossMargin":false,
                "targetPrice":3,
                "userid":"mx5YeJZSJbrENq24PLzW8BYHUxJb48Ttfj",
                "cancelled":10,
                "reward":null,
                "averagePrice":0,
                "side":"sell",
                "quantity":20
            },
            {
                "entryOrder":{},
                "normalizedEntryPrice":7922675,
                "stopPrice":2,
                "eventTime":1493072997157693,
                "entryAmount":79233020,
                "uuid":"241dbf90-293e-11e7-9093-9cf21d0dd434",
                "oco":"241e0db0-293e-11e7-bfe1-d12137b73cf6",
                "commission":null,
                "orderType":"STP",
                "instrument":"BTCUSD7J28",
                "maxStop":1251.1,
                "normalizedMaxStop":7992966,
                "filled":0,
                "status":"open",
                "entryPrice":1262.2,
                "normalizedPrice":7980209,
                "price":1253.1,
                "entryTime":1493072997157693,
                "executionPrice":0,
                "crossMargin":false,
                "targetPrice":3,
                "userid":"mx5YeJZSJbrENq24PLzW8BYHUxJb48Ttfj",
                "cancelled":0,
                "reward":null,
                "averagePrice":0,
                "side":"sell",
                "quantity":10
            },
            {
                "normalizedEntryPrice":7922675,
                "stopPrice":2,
                "eventTime":1493072997168228,
                "executionPrice":0,
                "uuid":"241e0db0-293e-11e7-bfe1-d12137b73cf6",
                "oco":"241dbf90-293e-11e7-9093-9cf21d0dd434",
                "commission":null,
                "orderType":"TGT",
                "instrument":"BTCUSD7J28",
                "entryOrder":{},
                "filled":0,
                "status":"open",
                "entryPrice":1262.2,
                "normalizedPrice":7904513,
                "price":1265.1,
                "entryTime":1493072997168228,
                "entryAmount":79233020,
                "crossMargin":false,
                "targetPrice":3,
                "userid":"mx5YeJZSJbrENq24PLzW8BYHUxJb48Ttfj",
                "cancelled":0,
                "reward":null,
                "averagePrice":0,
                "side":"sell",
                "quantity":10
            }
        ],
        "op":"split"
    }
]

Specific order for a contract

GET /contract/:symbol/order/:uuid

GET /api/v1/contract/BTCUSDW/order/ec9a2f00-27de-11e7-a957-c11c2594f049 HTTP/1.1
Accept: application/json
Host: live.coinpit.me
Authorization: HMAC mfxWFDho5Aa2TTnxKRZNRgBED6GP8C9gDd:0d83676173fe248c8a765d86a551e827e1afe7749a688a836e957a7fde510d69
Nonce: 1481651130426

200 OK

[
    {
        "marginPerQty":65905,
        "stopPrice":5,
        "eventTime":1492922406384773,
        "uuid":"ec9a2f00-27de-11e7-a957-c11c2594f049",
        "instrument":"BTCUSD7J28",
        "orderType":"LMT",
        "commission":0.0005,
        "entryOrder":{},
        "filled":0,
        "status":"open",
        "normalizedPrice":9670245,
        "price":1034.1,
        "entryTime":1492922406384773,
        "cushion":2,
        "crossMargin":false,
        "targetPrice":"NONE",
        "reservedTicks":2,
        "userid":"mx5YeJZSJbrENq24PLzW8BYHUxJb48Ttfj",
        "cancelled":0,
        "reward":0,
        "averagePrice":0,
        "side":"buy",
        "quantity":1
    }
]

Open Orders (including partially filled)

GET /contract/:symbol/order/open

GET /api/v1/contract/BTCUSDW/order/open HTTP/1.1
Accept: application/json
Host: live.coinpit.me
Authorization: HMAC mfxWFDho5Aa2TTnxKRZNRgBED6GP8C9gDd:0d83676173fe248c8a765d86a551e827e1afe7749a688a836e957a7fde510d69
Nonce: 1481651130426

200 OK

[
    {
        "marginPerQty":65905,
        "stopPrice":5,
        "eventTime":1492922406384773,
        "uuid":"ec9a2f00-27de-11e7-a957-c11c2594f049",
        "instrument":"BTCUSD7J28",
        "orderType":"LMT",
        "commission":0.0005,
        "entryOrder":{},
        "filled":0,
        "status":"open",
        "normalizedPrice":9670245,
        "price":1034.1,
        "entryTime":1492922406384773,
        "cushion":2,
        "crossMargin":false,
        "targetPrice":"NONE",
        "reservedTicks":2,
        "userid":"mx5YeJZSJbrENq24PLzW8BYHUxJb48Ttfj",
        "cancelled":0,
        "reward":0,
        "averagePrice":0,
        "side":"buy",
        "quantity":1
    }
]

Closed Orders (including partially cancelled)

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

GET /api/v1/contract/BTCUSDW/order/closed HTTP/1.1
Accept: application/json
Host: live.coinpit.me
Authorization: HMAC mfxWFDho5Aa2TTnxKRZNRgBED6GP8C9gDd:0d83676173fe248c8a765d86a551e827e1afe7749a688a836e957a7fde510d69
Nonce: 1481651130426

200 OK

[
  {
    "uuid": "6cc52580-bb0c-11e6-b831-df21626bb966",
    "userid": "mqJ36LnDCjRavP1wwsieBTxHAb9R5grwsy",
    "side": "buy",
    "quantity": 3,
    "filled": 3,
    "cancelled": 0,
    "price": 752.2,
    "averagePrice": 752.2,
    "entryTime": 1480957272024245,
    "eventTime": 1480965089774447,
    "status": "closed",
    "entryOrder": {},
    "orderType": "LMT",
    "stopPrice": 2.8,
    "targetPrice": "NONE",
    "clientid": "6badc210-bb0c-11e6-b1b0-31a3e9373a6c",
    "instrument": "BTCUSDW",
    "commission": 10000,
    "reward": -2500,
    "cushion": 1,
    "reservedTicks": 2,
    "crossMargin": false
  }
]

Cancelled orders (with no fills)

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

GET /api/v1/contract/BTCUSDW/order/cancelled HTTP/1.1
Accept: application/json
Host: live.coinpit.me
Authorization: HMAC mfxWFDho5Aa2TTnxKRZNRgBED6GP8C9gDd:0d83676173fe248c8a765d86a551e827e1afe7749a688a836e957a7fde510d69
Nonce: 1481653294715

200 OK

[
  {
    "uuid": "8a1cbe40-bb0c-11e6-b56f-e850d46d696a",
    "userid": "mqJ36LnDCjRavP1wwsieBTxHAb9R5grwsy",
    "side": "sell",
    "quantity": 2,
    "filled": 0,
    "cancelled": 2,
    "price": 745,
    "averagePrice": 0,
    "entryTime": 1480957321252323,
    "eventTime": 1480957321696555,
    "status": "cancelled",
    "entryOrder": {},
    "orderType": "LMT",
    "stopPrice": 2.7,
    "targetPrice": "NONE",
    "clientid": "89064530-bb0c-11e6-b1b0-31a3e9373a6c",
    "instrument": "BTCUSDW",
    "reason": "Cancelled self-matching order",
    "commission": 10000,
    "reward": -2500,
    "cushion": 1,
    "reservedTicks": 2,
    "crossMargin": false
  },
  {
    "uuid": "32e11200-baa5-11e6-a434-3f7d9d3258be",
    "userid": "mqJ36LnDCjRavP1wwsieBTxHAb9R5grwsy",
    "side": "sell",
    "quantity": 21,
    "filled": 0,
    "cancelled": 21,
    "price": "NONE",
    "averagePrice": 0,
    "entryTime": 1480912936736294,
    "eventTime": 1480915778195181,
    "status": "cancelled",
    "entryOrder": {
      "1f0c2a80-baa5-11e6-9558-951ab84e8daa": 1
    },
    "orderType": "TGT",
    "stopPrice": 6.6,
    "targetPrice": "NONE",
    "instrument": "BTCUSDW",
    "oco": "32e0eaf0-baa5-11e6-bb13-65d0268ef8f6",
    "entryPrice": 758,
    "entryPrices": [
      758,
      758,
      758,
      758,
      758,
      758
    ],
    "entryAmounts": [
      15918,
      12886,
      9096,
      5306,
      4548,
      1516
    ],
    "entryAmount": 0,
    "commission": 10000,
    "reward": -2500,
    "cushion": 1,
    "reservedTicks": 2,
    "crossMargin": false
  }
]

Order Book

GET /contract/:symbol/orderbook

GET /api/v1/contract/BTCUSDW/orderbook HTTP/1.1
Accept: application/json
Host: live.coinpit.me
Authorization: HMAC mfxWFDho5Aa2TTnxKRZNRgBED6GP8C9gDd:7c3fa2fb0702bf1e4f9a94ca6c48cc250d95e078b42c339307096fbe679e2c84
Nonce: 1480947259178

200 OK

{
   "bid":748,
   "ask":749.1,
   "buy":[
      {
         "price":748,
         "numberOfOrders":1,
         "totalQuantity":5,
         "instrument":"BTCUSDW"
      },
      {
         "price":747.9,
         "numberOfOrders":1,
         "totalQuantity":5,
         "instrument":"BTCUSDW"
      }
   ],
   "sell":[
      {
         "price":749.1,
         "numberOfOrders":2,
         "totalQuantity":6,
         "instrument":"BTCUSDW"
      },
      {
         "price":749.2,
         "numberOfOrders":1,
         "totalQuantity":5,
         "instrument":"BTCUSDW"
      }
   ]
}

Recent Trades

GET /contract/:symbol/trade

GET /api/v1/contract/BTCUSDW/trade HTTP/1.1
Accept: application/json
Host: live.coinpit.me
Authorization: HMAC mfxWFDho5Aa2TTnxKRZNRgBED6GP8C9gDd:0d83676173fe248c8a765d86a551e827e1afe7749a688a836e957a7fde510d69
Nonce: 1480947260712

200 OK

[
   {
      "date":1480965360,
      "price":752.1,
      "volume":1
   },
   {
      "date":1480965089,
      "price":752.2,
      "volume":3
   },
   {
      "date":1480915778,
      "price":751.7,
      "volume":2
   },
   {
      "date":1480915777,
      "price":750.7,
      "volume":4
   },
   {
      "date":1480895098,
      "price":767.5,
      "volume":2
   },
   {
      "date":1480496266,
      "price":739.9,
      "volume":5
   }
]

User account

GET /account

GET /api/v1/account HTTP/1.1
Accept: application/json
Host: live.coinpit.me
Authorization: HMAC mfxWFDho5Aa2TTnxKRZNRgBED6GP8C9gDd:0d83676173fe248c8a765d86a551e827e1afe7749a688a836e957a7fde510d69
Nonce: 1480947266323

200 OK

{
    "displayMargin":0,
    "positions":{},
    "userid":"mk1n8MGrgMEVRHuLarJ6W4MKuZG8CYfh8i",
    "margin":0,
    "orders":{
        "BTCUSD7J14":{},
        "BTCUSD7J21":{}
    },
    "accountMargin":0
}

User Executions

GET /account/execution

GET /api/v1/account/execution HTTP/1.1
Accept: application/json
Host: live.coinpit.me
Authorization: HMAC mfxWFDho5Aa2TTnxKRZNRgBED6GP8C9gDd:7c3fa2fb0702bf1e4f9a94ca6c48cc250d95e078b42c339307096fbe679e2c84
Nonce: 1480957451447

200 OK

[{
  "userid": "mvuQJYbLDDMKsNtr2KLV6fqeYj5Zis1Xdk",
  "executionid": "27a99cb0-f5bd-11e6-9bc0-ab69e5d88384",
  "side": "sell",
  "orderType": "MKT",
  "orderid": "278ec1b0-f5bd-11e6-a389-363d200d248d",
  "price": 1063.9,
  "quantity": 1,
  "liquidity": "commission",
  "commission": 23498,
  "eventTime": 1487410344443683,
  "instrument": "BTCUSD7G24",
  "entryAmount": -46952766,
  "pnl": -44132
}, {
  "userid": "mvuQJYbLDDMKsNtr2KLV6fqeYj5Zis1Xdk",
  "executionid": "1f0c9080-f5bd-11e6-8fe3-628ba4ed8f57",
  "side": "buy",
  "orderType": "MKT",
  "orderid": "1ef6e5a0-f5bd-11e6-8279-f198eadae07e",
  "price": 1064.9,
  "quantity": 1,
  "liquidity": "commission",
  "commission": 23476,
  "eventTime": 1487410329992901,
  "instrument": "BTCUSD7G24",
  "entryAmount": 0,
  "pnl": 0
}]

Margin account balance

GET /account/margin

GET /api/v1/account/margin HTTP/1.1
Accept: application/json
Host: live.coinpit.me
Authorization: HMAC mfxWFDho5Aa2TTnxKRZNRgBED6GP8C9gDd:7c3fa2fb0702bf1e4f9a94ca6c48cc250d95e078b42c339307096fbe679e2c84
Nonce: 1480957451447

200 OK

{
   "value":67350920
}

Add Margin (Move from Multisig to Margin)

Move specified amount of BTC from multisig account to margin account. Use this to ensure you have sufficient coins in your margin account to cover your positions and orders.

POST /account/margin

POST /api/v1/account/margin HTTP/1.1
Accept: application/json
Host: live.coinpit.me
Authorization: HMAC mvuQJYbLDDMKsNtr2KLV6fqeYj5Zis1Xdk:cbe864dca0c4a39f4247d241840fa46cf2cbd948cdc46b51ac1ef0a6e249ce39
Nonce: 1487489261278
[{"txs":["0100000002687c0cf9d5e0dec13dab256fad30672b34c65fdeddcf9662bec7a1d9274308fa01000000920000473044022031ecaf36aa52b438c9c335d066209408aa7cfbe82120746849fc9f4783f06f7a0220208bb556e0dfbd86818de3a5fb7acb7aba0efdd1dc11950bfbe28d32edc4c5690147522103133b6286431a0a5251a464ced4a5dbf156e8631a01cdadda9e6fd448bfc7eda721038657d14c91aef4c7b2b117cfd1ee18fb7a9e0b248f8168f16b1bad63f9e7df3752aeffffffffc2585bc27effc1cb58b957e4dc71681b6180a8457679533f0a3b0a21a09835bf010000009200004730440220277154208a1062408175682e8a640edbcb46ae0056b39aebda3e2ce00f05679202204e1b5b248f2b010c1ee72eb68ea811e1464f94a5bb07d328fa8ba6744422f23a0147522103133b6286431a0a5251a464ced4a5dbf156e8631a01cdadda9e6fd448bfc7eda721038657d14c91aef4c7b2b117cfd1ee18fb7a9e0b248f8168f16b1bad63f9e7df3752aeffffffff03b8ca0e00000000001976a914c2db9d057d9988d2a7ee8e4887f851fc874a647a88ac809698000000000017a91427649de18dc419c47efdbfde57e0d0d12215f53d87541eaa010000000017a91427649de18dc419c47efdbfde57e0d0d12215f53d8700000000"]}]

200 OK

{"txids":["351f2dedb630ddd6b34182eb9ddd0a15df7b95165ca2148e95e4dbb63e19bcaf"]}

Clear Margin (Move to Multisig)

Move specified amount of BTC from margin account to multisig account. Coins in multisig account are provably safe from a possible server breach.

/api/v1/account/margin/:amount

DELETE /api/v1/account/margin/10000000 HTTP/1.1
Accept: application/json
Host: live.coinpit.me
Authorization: HMAC mvuQJYbLDDMKsNtr2KLV6fqeYj5Zis1Xdk:b7156a8863712494903e66170cba78a4ce9b7412b72b12c00903b4ba191cfa67
Nonce: 1487490137968

200 OK

{"txids":["351f2dedb630ddd6b34182eb9ddd0a15df7b95165ca2148e95e4dbb63e19bcaf"]}

Withdraw from Multisig

POST /account/tx/withdraw

POST /api/v1/account/tx/withdraw HTTP/1.1
Accept: application/json
Host: live.coinpit.me
Authorization:HMAC mvuQJYbLDDMKsNtr2KLV6fqeYj5Zis1Xdk:8da600485b53e5ce4dacc9e302c8950d09376a1bbf3f30bfef3f78fdd42b252e
Nonce: 1487489119205
{"tx":"01000000013a0204fc74b9448b8138a0a4007c212dd9c94d3afefe6356a0a31f0173a3fe83030000009200004730440220626e7b4af2b692274d0f7710737e0283b7a0d8a45da232837feda72874e592cc02200b13651c9b631a12cfb9656d637af2e1f50ae6fe7fcb82a5d29f2ee413852f070147522103133b6286431a0a5251a464ced4a5dbf156e8631a01cdadda9e6fd448bfc7eda721038657d14c91aef4c7b2b117cfd1ee18fb7a9e0b248f8168f16b1bad63f9e7df3752aeffffffff0240420f000000000017a9146d8873aa9fd5426f4704906697f3591b27c7f46b879460b9010000000017a91427649de18dc419c47efdbfde57e0d0d12215f53d8700000000"}

200 OK

{
  "txid": "bf3598a0210a3b0a3f53797645a880611b6871dce457b958cbc1ff7ec25b58c2"
}

Recovery Transaction

GET /account/tx/recovery

GET /api/v1/account/tx/recovery HTTP/1.1
Accept: application/json
Host: live.coinpit.me
Authorization: HMAC mfxWFDho5Aa2TTnxKRZNRgBED6GP8C9gDd:0d83676173fe248c8a765d86a551e827e1afe7749a688a836e957a7fde510d69
Nonce: 1480947265266

200 OK

{
   "tx":"01000000018d348442ac8fa041d6bf9bf1f99f701e2d46f703d7f90f3bbc3fb6e1c39865c2020000009300483045022100ae2678cb72ae04da31dce7867f02da35a16a352f838857dfa96567ed457635f702203fa6c8d610ed3cdd31821b00145408ffceab7c6a127d69a45fac6a8d4a185d2c010047522102453b9f78cf1d254840c8a7b87a058a665db0c1c51cc3edd33ff0ef3be98fb6842102babd831e59837b55a1e37ee48bcc928516c72baabff06afdfb0ab963b826414652aeffffffff017a2de400000000001976a9146b3fdb05dcf753ccbb377371beeba58d6c263a1788ac00000000"
}

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