NAV Navbar
javascript cURL

Quadency - Unified API

Welcome to Quadency's Unified API developer documentation. The API provides a standardized and simplified interface for communicating with Quadency and its supported exchanges.

What can I do with these APIs?

Two sets of APIs are provided:

Public (Unauthenticated)

Private (Authenticated)

Getting Access

The Quadency Unified API is currently available by invite only. To request access, please email support@quadency.com.

Base URL

All Quadency endpoints share the same base url: https://quadency.com

Supported Exchanges

Quadency API currency support the following exchanges:

All assets and pairs have been normalized across the exchanges.

Rate Limit

Public REST endpoints are throttled by IP: 100 requests per 1 seconds.

Private REST endpoints are throttled by the user IP: 20 requests per 1 seconds.

Please use Websocket whenever possible to get updates instead of polling REST endpoints

Requests

Success

All requests and responses are application/json content type and follow typical HTTP response status codes for success and failure.

Errors

Unless otherwise stated, errors to bad requests will respond with HTTP 4xx or status codes. The body will also contain a message parameter indicating the cause. Your languageā€™s http library should be configured to provide message bodies for non-2xx requests so that you can read the message field from the body.

Quadency API uses the following error codes:

Status Code Meaning
400 Bad Request -- Your request is invalid.
401 Unauthorized -- Your API key/secret is wrong.
403 Forbidden -- The resource requested is hidden for administrators only.
404 Not Found -- The specified resource could not be found.
405 Method Not Allowed -- You tried to access a resource with an invalid method.
429 Too Many Requests -- Exceeded the access frequency 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.

Public Rest API

All public endpoints do not require authentication.

Exchanges

List Exchange Market Info

import axios from 'axios';

const options = {
  method: 'GET',
  url: 'https://quadency.com/api/v1/public/exchanges/markets?exchange=GDAX',
};

axios(options).then((response)=>{
  console.log(response.data);
});
curl https://quadency.com/api/v1/public/exchanges/markets?exchange=GDAX

Example Response:

{
  "ETH/BTC": {
    "limits": {
      "amount": {
        "min": 0.001,
        "max": 100000
      },
      "price": {},
      "cost": {
        "min": 0.001
      }
    },
    "precision": {
      "base": 8,
      "quote": 8,
      "amount": 3,
      "price": 6
    },
    "tierBased": false,
    "percentage": true,
    "taker": 0.001,
    "maker": 0.001,
    "id": "ETHBTC",
    "symbol": "ETH/BTC",
    "base": "ETH",
    "quote": "BTC",
    "baseId": "ETH",
    "quoteId": "BTC",
    "info": {...},
    "active": true
  },
  ...
}

Retrieves config level information such as fees, precisions, step sizes for supported exchanges

HTTP Request

GET /api/v1/public/exchanges/markets?exchange=<exchange name>

Example

GET /api/v1/public/exchanges/markets?exchange=BINANCE

Details

The query param exchange is required. This endpoint will be updated in the future to provide all markets for all exchanges.

Query Parameters

Name Description
exchange Exchange to get markets for (required)

Prices

List Latest Prices for Exchanges and Pairs

import axios from 'axios';

const options = {
  method: 'GET',
  url: 'https://quadency.com/api/v1/public/prices?pairs=BTC/USD&exchanges=GDAX,KRAKEN',
};

axios(options).then((response)=>{
  console.log(response.data);
});
curl https://quadency.com/api/v1/public/prices?pairs=BTC%2FUSD&exchanges=GDAX,KRAKEN

GET Prices Example Response:

{
  "BTC/USD": {
    "GDAX": {
      "exchange": "GDAX",               // name of exchange
      "price": 5034.01,                 // latest price
      "high": 5075.98,                  // current high price
      "low": 5034,                      // current low price
      "price24h": 5145.45,              // average price in last 24 hours
      "volume": 294.658,                // volume in last tick
      "volume24h": "46849375.8592987"   // total 24h volume
    },
    "KRAKEN": {
      "exchange": "KRAKEN",
      "price": 5035.4,
      "high": 5075,
      "low": 5032,
      "price24h": 5147.1,
      "volume": 217.83993948,
      "volume24h": "22176711.951806337"
    }
  }
}

Get latest prices for pairs from all integrated exchanges. Returns price, 24hr price, high, low, volume, and 24hr volume.

HTTP Request

GET /api/v1/public/prices?pairs=<given-pairs>&exchanges=<given-exchanges>

Example

GET /api/v1/public/prices?pairs=BTC/USD&exchanges=GDAX,KRAKEN

Details

You may filter the response by passing the appropriate query parameters.

Query Parameters

Name Description
pairs Comma separated list of pairs. If no pairs are specified, all pairs will be returned.
exchange Comma separated list of exchanges. If no exchanges are specified, all exchanges will be returned.

List Average Prices

import axios from 'axios';

const options = {
  method: 'GET',
  url: 'https://quadency.com/api/v1/public/prices/averages?pairs=XRP/USD,ETH/BTC',
};

axios(options).then((response)=>{
  console.log(response.data);
});
curl https://quadency.com/api/v1/public/prices/averages?pairs=XRP%2FUSD,ETH%2FBTC

Get Average Prices Example Response:

{
  "BCH/BTC": {
    "price": 0.06208911820142301,               // latest price
    "price24h": 0.05771136851656187,            // average price 24h
    "high": 0.06262137620713173,                // current high
    "low": 0.06187019240749417,                 // current low
    "volume": 5263.58689965524,                 // volume since last tick
    "volume24h": 19441.68088608209              // total 24h volume
  },
  "MKR/BTC": {
    "price": 0.12641318575286847,
    "price24h": 0.12368710831867302,
    "high": 0.12645622320116828,
    "low": 0.1259610655389163,
    "volume": 1.1690686799999999,
    "volume24h": 10.107787252907698
  },
  "BCH/GBP": {
    "price": 239.04,
    "price24h": 227.75,
    "high": 243.76,
    "low": 238.69,
    "volume": 40.7098,
    "volume24h": 471824.849088
  },
  ...
}

Get the average price of a pair. This endpoint returns the volume weighted average of the prices of a particular pair from all integrated exchanges, along with the average, 24hr price volume, 24hr volume, high, and low price.

HTTP Request

GET /api/v1/public/prices/averages?pairs=<given-pairs>

Example

GET /api/v1/public/prices/averages?pairs=XRP/USD,ETH/BTC

Query Parameters

Name Description
pairs Comma separated list of pairs

List Historical Average Prices

import axios from 'axios';

const options = {
  method: 'GET',
  url: 'https://quadency.com/api/v1/public/prices/history/averages?pairs=BTC%2FUSD,ETH%2FUSDT',
};

axios(options).then((response)=>{
  console.log(response.data);
});
curl https://quadency.com/api/v1/public/prices/history/averages?pairs=BTC%2FUSD,ETH%2FUSDT

Get Historical Average Prices Example Response:

{
  "BTC/USD": [
    [
      "1555416000000",  // epoch time in ms
      "5036.26459518"   // price at time
    ],
    [
      "1555412400000",
      "5069.97389092"
    ],
    [
      "1555408800000",
      "5056.65770991"
    ],
    [
      "1555405200000",
      "5086.00008410"
    ],
    ...
  ]
}

Get volume weighted historical average prices for given pairs, interval, and number of bars

HTTP Request

GET /api/v1/public/prices/history/averages?pairs=<given pairs>

Example

GET /api/v1/public/prices/history/averages?pairs=BTC%2FUSD,ETH%2FUSDT

Query Parameters

Name Description
pairs Comma separated list of pairs that (required)
interval Defaults to 1h. Time interval you want the average prices for. Following are supported ['1m', '5m', '15m', '30m', '1h', '6h', '1d']
bars Defaults to 24. Number bars from current time. For example, if 5 Bars is given, the endpoint will return the most current 5 bars. The current bar will not be included.

List Current Foreign Exchange Rates

import axios from 'axios';

const options = {
  method: 'GET',
  url: 'https://quadency.com/api/v1/public/prices/forex?fiat=EUR',
};

axios(options).then((response)=>{
  console.log(response.data);
});
curl https://quadency.com/api/v1/public/prices/forex?fiat=EUR

Get Foreign Exchange Rates Example Response:

{
"symbol": "USD/EUR",
"price": 0.8839388314
}

Gets foreign exchange rates base in USD

HTTP Request

GET /api/v1/public/prices/forex?fiat=<currency>

Example

GET /api/v1/public/prices/forex?fiat=EUR

Details

Base currency is USD.

Query Parameters

Name Description
fiat The quote currency. If none provided, all exchange rates are returned.

Trades

List Trade History

import axios from 'axios';

const options = {
  method: 'GET',
  url: 'https://quadency.com/api/v1/public/trades/exchange/BINANCE?pair=ADA/USDT',
};

axios(options).then((response)=>{
  console.log(response.data);
});
curl https://quadency.com/api/v1/public/trades/exchange/BINANCE?pair=ADA%2FUSDT

Get Trade History Example Response:

{
  "exchange": "BINANCE",
  "pair": "ADA/USDT",
  "ts": 1555421396997,
  "trades": [
    {
      "price": "0.08108",
      "amount": "142.3",
      "side": "SELL",
      "ts": 1555421341673
    },
    {
      "price": "0.08105",
      "amount": "18716.8",
      "side": "SELL",
      "ts": 1555421338274
    },
    {
      "price": "0.08106",
      "amount": "246.4",
      "side": "SELL",
      "ts": 1555421338274
    },
    ...
  ]
}

Get current trade history snapshot for pair for specified exchange

HTTP Request

GET /api/v1/public/trades/exchange/:exchange?pair=<given-pair>

Example

GET /api/v1/public/trades/exchange/BINANCE?pair=ADA/USDT

Query Parameters

Name Description
exchange Exchange from which to get trade history from (required)
pair Pair for which to get trade history for (required)

Orders

Retrieve Order Book

Get orderbook for pair from exchange

HTTP Request

GET /api/v1/public/orders/exchange/gdax?pairs=<given-pairs>

Example

/api/v1/public/orders/exchange/gdax?pairs=BTC/USD

Query Parameters

Name Description
exchange Exchange from which to get orderbook from (required)
pair Pair for which to get trade history for

Public Websocket

Websocket Endpoint

const SOCKET = new WebSocket(`https://quadency.com/api/v1/public/ws`);

SOCKET.onopen = () => {
  const SUBSCRIPTION_MESSAGE = {
    subscriptionType: '<enter type>', exchange, pair, eventType: 'subscribe', ts: Date.now(),
  };
  SOCKET.send(JSON.stringify(SUBSCRIPTION_MESSAGE));
}

SOCKET.onmessage = (message) => {
  console.log(message)
}

wscat -c https://quadency.com/api/v1/public/ws
> {"subscriptionType":"aggregatePriceStream","eventType":"subscribe"}

/api/v1/public/ws

Subscribing and Unsubscribing

In order to subscribe to or unsubscribe from a stream, send a json object with the following structure

{
  "subscriptionType": "...",
  "eventType": "...",
  ...
}

Here, subscriptionType would be the stream you are attempting to subscribe to or unsubscribe from. eventType specifies whether to subscribe, or unsubscribe. If the websocket connection should close from the client side, your will automatically be unsubscribed. Depending on the stream, additional properties may need to be included in the json object as well.

Price Ticker

Provide Price ticks. Latest price, 24h change, high, low, 24 Volume are provided.

Price Ticker Example Subscribe/Unsubscribe Request:

{
  "subscriptionType":"priceStream",
  "exchange":"BINANCE",
  "pairs":["ETH/BTC", "BNB/BTC"], // must provide at least one pair in array
  "eventType":"subscribe" // "unsubscribe"
}

Price Ticker Example Message

{
  "subscriptionType":"priceStream",
  "exchange":"BINANCE",
  "prices":
    {
      "ETH/BTC":{"priceTs":1555419853784,"price":"0.03205600","percentChange":"-0.7277569601436884","high":"0.03238100","low":"0.03112600","volume":"5580.12039981"},
      "BNB/BTC":{"priceTs":1555419853773,"price":"0.00383060","percentChange":"0.2801120448179262","high":"0.00387560","low":"0.00369980","volume":"6812.25592343"}
    },
  "ts":1555419854529
}

Average Price Ticker

Provide volume weighted average price ticks for all integrated exchanges. Latest price, high, low, 24 Volume are provided.

Average Price Ticker Example Subscribe/Unsubscribe Request:

{
  "subscriptionType": "aggregatePriceStream",
  "eventType": "subscribe"
}

Average Price Ticker Example Message

{
  "subscriptionType": "aggregatePriceStream",
  "prices": {
    "LTC/BTC": {
      "price": 0.015535240145286067,
      "high": 0.01609437650560356,
      "low": 0.01500753629175055,
      "volume": 30346.17744223735
    },
    "BTC/USDT": {
      "price": 5049.476899111109,
      "high": 5155.161802246553,
      "low": 4949.809739321527,
      "volume": 300516399.37811536
    },
  },
  "ts": 1555421702290
}

Trade history

Provides trade history deltas. Deltas will be provided as trades are executed on the exchange.

Trade history Example Subscribe/Unsubscribe Request:

{
  "subscriptionType":"tradeStream",
  "exchange":"<exchange name>",
  "pair":"<pair>",
  "eventType":"subscribe" // "unsubscribe" 
}

Trade history Example Message

{
  "subscriptionType":"tradeStream",
  "exchange":"BINANCE",
  "pair":"BTC/USDT",
  "price":"5037.25000000",
  "amount":"0.00776200",
  "side":"BUY",
  "ts":1555418295594
}

Order book

Provides order book snapshot and order book updates

Order Book Example Subscribe/Unsubscribe Request:

{
  "subscriptionType": "orderStream",
  "exchange": "BINANCE",
  "pair": "BTC/USDT",
  "eventType": "subscribe" // "unsubscribe"
}

Order Book Example Snapshot Message:

{
  "subscriptionType": "orderStream-snapshot",
  "exchange": "BINANCE",
  "pair": "BTC/USDT",
  "bids": {
    "4833.43000000": {
      "volume": "0.002577",
      "total": "12.45574911"
    },
    "4803.87000000": {
      "volume": "0.002577",
      "total": "12.37957299"
    },
    ...
  },
  "asks": {
    "5120.00000000": {
      "volume": "1.477292",
      "total": "7563.7350400000005"
    },
    "5120.40000000": {
      "volume": "0.003",
      "total": "15.361199999999998"
    },
    ...
  },
  "ts": 1555421702178
}

Example Order Book Update

{
  "subscriptionType": "orderStream-delta",
  "exchange": "BINANCE",
  "pair": "BTC/USDT",
  "bids": {
    "5042.31000000": {
      "volume": "0.00000000",
      "total": "0",
      "deltaType": "D"
    },
    "5042.27000000": {
      "volume": "0.04956300",
      "total": "249.91002801000005",
      "deltaType": "E"
    }
  },
  "asks": {
    "5046.28000000": {
      "volume": "0.00000000",
      "total": "0",
      "deltaType": "D"
    },
    "5400.00000000": {
      "volume": "257.65981500",
      "total": "1391363.001",
      "deltaType": "E"
    }
  }
  "ts": 1555421703050
}

orderStream-snapshot

Upon subscribing to order book stream, the first initial response will be the current snapshot of the order book for the subscribed pair.

orderStream-delta

All subsequent messages after the snapshot message will be deltas to the order book

E - Insert or update order to the order book bids/asks

D - Delete order book bids/ask price

Private Rest API

All private endpoints (REST and WS ) require authentication (see section below). These endpoints would best fit to get account balances, order updates, and give the ability to execute/cancel orders. The ability to read or take actions will depend on the permission you have placed on your linked exchange accounts.

Authentication

API Keys

Authenticating to the Quadency Private API requires a valid API key and secret. In order to obtain a set of keys, please email support@quadency.com.

Creating a Signed Request

import axios from 'axios';
import CryptoJS from 'crypto-js';


const method = 'GET';
const timestamp = Date.now();
const apiPath = '/api/v1/private/balance';

const signature = CryptoJS.enc.Base64.stringify(CryptoJS.HmacSHA256(`${timestamp}${method}${apiPath}`, 'your api secret'));

const options = {
      method,
      url: `https://quadency.com${apiPath}`,
      headers: {
        'ACCESS-KEY': 'your api key',
        'ACCESS-SIGN': signature,
        'ACCESS-TIMESTAMP': timestamp,
        'Content-Type': 'application/json',
      },
    };

axios(options).then((response)=>{
  console.log(response.data);
});

The following parameters are required to make an authenticated request:

Name Description
api key quadency api key to make authenticated requests (required)
api secret quadency api secret to sign requests (required)
timestamp current epoch time in ms (required)
HTML method GET/POST/PUT/DELETE/PATH (required)

Accounts

List Accounts

import axios from 'axios';

// make sure to include signature headers (not shown below)
const options = {
  method: 'GET',
  url: 'https://quadency.com/api/v1/private/accounts',
};

axios(options).then((response)=>{
  console.log(response.data);
});
# make sure to include signature headers (not shown below)
curl https://quadency.com/api/v1/private/accounts

GET Accounts Example Response:

[
    {
        "apiKey": "3581g2*************************",
        "exchange_label": "Coinbase Pro",
        "id": "58",
        "label": "GDAX0",
        "name": "GDAX"
    },
    {
        "apiKey": "RFGuPw*************************",
        "exchange_label": "Binance",
        "id": "63",
        "label": "BINANCE",
        "name": "BINANCE"
    }
]

Get all linked accounts

HTTP Request

GET /api/v1/private/accounts

Example

GET /api/v1/private/accounts

Balances

List Balances

import axios from 'axios';

// make sure to include signature headers (not shown below)
const options = {
  method: 'GET',
  url: 'https://quadency.com/api/v1/private/balances?withCostBasis=true',
};

axios(options).then((response)=>{
  console.log(response.data);
});
# make sure to include signature headers (not shown below)
curl https://quadency.com/api/v1/private/balances?withCostBasis=true

GET Balances Example Response:

[
    {
        "accountId": "58",
        "asset": "USD",
        "costBasis": {
            "avgUnitCostUSD": "1.00000000",
            "btcUsdRefRate": 5023.468122098171,
            "totalCostUSD": "942161.03871303"
        },
        "exchange": "GDAX",
        "free": 3723722.23905054,
        "fullName": "USD",
        "total": 3724410.23905054,
        "used": 688
    },
    {
        "accountId": "58",
        "asset": "BTC",
        "costBasis": {
            "avgUnitCostUSD": "5366.92199326",
            "btcUsdRefRate": 4979.416435567243,
            "totalCostUSD": "14324.31480000"
        },
        "exchange": "GDAX",
        "free": 724104.35867657,
        "fullName": "Bitcoin",
        "total": 724105.35867657,
        "used": 1
    },
    {
        "accountId": "58",
        "asset": "USDC",
        "costBasis": {
            "avgUnitCostUSD": 0,
            "btcUsdRefRate": 0,
            "totalCostUSD": "0.00000000"
        },
        "exchange": "GDAX",
        "free": 1000000,
        "fullName": "USD Coin",
        "total": 1000000,
        "used": 0
    },
    ...
]

Get balances for all assets across all linked accounts

HTTP Request

GET /api/v1/private/balances

Example

GET /api/v1/private/balances?withCostBasis=true

Details

To learn more about how cost basis is calculated, go here

Query Parameters

Name Description
withCostBasis Include cost basis. Defaults to false

List Balances for Account

import axios from 'axios';

// make sure to include signature headers (not shown below)
const options = {
  method: 'GET',
  url: 'https://quadency.com/api/v1/private/balances/accounts/58',
};

axios(options).then((response)=>{
  console.log(response.data);
});
# make sure to include signature headers (not shown below)
curl https://quadency.com/api/v1/private/balances/accounts/58

GET Balances for Account Example Response:

[
    {
        "accountId": "58",
        "asset": "USD",
        "exchange": "GDAX",
        "free": 3723722.23905054,
        "fullName": "USD",
        "total": 3724410.23905054,
        "used": 688
    },
    {
        "accountId": "58",
        "asset": "BTC",
        "exchange": "GDAX",
        "free": 724104.35867657,
        "fullName": "Bitcoin",
        "total": 724105.35867657,
        "used": 1
    },
    {
        "accountId": "58",
        "asset": "USDC",
        "exchange": "GDAX",
        "free": 1000000,
        "fullName": "USD Coin",
        "total": 1000000,
        "used": 0
    },
    ...
]

Get balances for all assets on a particular account

HTTP Request

GET /api/v1/private/balances/accounts/:accountid

Example

GET /api/v1/private/balances/accounts/58

Query Parameters

Name Description
accountid ID of account

Orders

List Orders

import axios from 'axios';

// make sure to include signature headers (not shown below)
const options = {
  method: 'GET',
  url: 'https://quadency.com/api/v1/private/orders?status=CLOSED&limit=5',
};

axios(options).then((response)=>{
  console.log(response.data);
});
# make sure to include signature headers (not shown below)
curl https://quadency.com/api/v1/private/orders?status=CLOSED&limit=5

GET Orders Example Response:

[
    {
        "accountId": "63",
        "amount": "0.14386000",
        "e_orderId": "218156264",
        "e_timestamp": 1554179773387,
        "exchange": "BINANCE",
        "filled": "0.14386000",
        "pair": "ETH/USDT",
        "price": "144.390000000000000000",
        "side": "SELL",
        "status": "CLOSED",
        "type": "LIMIT"
    },
    {
        "accountId": "63",
        "amount": "33.00000000",
        "e_orderId": "33413135",
        "e_timestamp": 1552080267633,
        "exchange": "BINANCE",
        "filled": "33.00000000",
        "pair": "KNC/BTC",
        "price": "0.000056850000000000000000",
        "side": "BUY",
        "status": "CLOSED",
        "type": "LIMIT"
    },
    {
        "accountId": "63",
        "amount": "0.11500000",
        "e_orderId": "239517322",
        "e_timestamp": 1544228828647,
        "exchange": "BINANCE",
        "filled": "0.11500000",
        "pair": "ETH/BTC",
        "price": "0.02765200000000000000",
        "side": "BUY",
        "status": "CLOSED",
        "type": "LIMIT"
    },
    {
        "accountId": "63",
        "amount": "0.04000000",
        "e_orderId": "200466465",
        "e_timestamp": 1536036880320,
        "exchange": "BINANCE",
        "filled": "0.04000000",
        "pair": "ETH/BTC",
        "price": "0.03930900000000000000",
        "side": "SELL",
        "status": "CLOSED",
        "type": "MARKET"
    },
    {
        "accountId": "63",
        "amount": "0.04000000",
        "e_orderId": "198594168",
        "e_timestamp": 1535587904679,
        "exchange": "BINANCE",
        "filled": "0.04000000",
        "pair": "ETH/BTC",
        "price": "0.04103300000000000000",
        "side": "SELL",
        "status": "CLOSED",
        "type": "MARKET"
    }
]

Get all orders. You can filter the response by status, account, and pairs. You may also limit the number of orders returned

HTTP Request

GET /api/v1/private/orders

Example

GET /api/v1/private/orders?status=CLOSED&limit=5

Query Parameters

Name Description
status Status of order, Defaults to open
accountId Id of account
pairs Comma separated list of pairs
limit Maximum number of orders to be returned

Place Orders

import axios from 'axios';

// make sure to include signature headers (not shown below)
const options = {
  method: 'POST',
  data : { 
    "accountId": "3336", 
    "symbol": "BTC/USD", 
    "type": "MARKET", 
    "side": "BUY", 
    "amount": "1", 
    "price": "5214.55" 
    },
  url: 'https://quadency.com/api/v1/private/orders',
};

axios(options).then((response)=>{
  console.log(response.data);
});
# make sure to include signature headers (not shown below)
curl 'https://quadency.com/api/v1/private/orders/' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/plain, */*' \
--data-binary '{"accountId":"1","symbol":"ETH/BTC","type":"LIMIT","side":"SELL","amount":"1","price":"10","stopPrice":""}'

POST Orders Example Market Order Request:

{
  "accountId": "3336",
  "symbol": "BTC/USD",
  "type": "MARKET",
  "side": "BUY",
  "amount": "1",
  "price": "5214.55"
}

POST Orders Example Limit Order Request:

{
  "accountId": "3336",
  "symbol": "BTC/USD",
  "type": "LIMIT",
  "side": "BUY",
  "amount": "1",
  "price": "20000",
}

POST Orders Example Stop Limit Order Request:

{
  "accountId": "3336",
  "symbol": "BTC/USD",
  "type": "STOP_LOSS_LIMIT",
  "side": "BUY",
  "amount": "1",
  "price": "1999",
  "stopPrice": "2000"
}

POST Orders Example Response:

{
  "id": "8e3af156-5236-4ee0-be6c-23679e870be4",
  "ts": "1555525260596",
  "symbol": "BTC/USD",
  "type": "market",
  "side": "buy",
  "price": "",
  "amount": "1.00000000",
  "filled": "0.00000000",
  "status": "pending"
}

Three types of orders can be placed: limit, markets, and stop limits (depending if exchange supports them).

HTTP Request

POST /api/v1/private/orders

Body Parameters

Name Description
accountId exchange account to place the order (required)
symbol quote/market for the order (required)
type MARKET/LIMIT/STOP_LOSS_LIMIT (required)
side BUY/SELL (required)
amount amount of base asset to buy or sell
price price for order (required for LIMIT/STOP_LOSS_LIMIT)
stopPrice stop price (required for STOP_LOSS_LIMIT)

Response Parameters

Name Description
id order id
ts epoch timestamp in ms
symbol quote/market
type type of order placed
side order side
price price of order if LIMIT/STOP_LOSS_LIMIT
amount amount of base asset in order
filled amount of order filled
status current status of order (some exchanges will mark order in pending state before ultimately filling it even if market order)

Cancel Order

import axios from 'axios';

// make sure to include signature headers (not shown below)
const options = {
  method: 'DELETE',
  data : {
           "accountId": "3336",
           "e_orderId": "fb10f1cc-e22e-4d1e-84ba-93b9033fd323" //order id
         },
  url: 'https://quadency.com/api/v1/private/orders',
};

axios(options).then((response)=>{
  console.log(response.data);
});
# make sure to include signature headers (not shown below)
curl 'https://quadency.com/api/v1/private/orders/' -X DELETE \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/plain, */*' \
--data-binary '{"accountId":"1","e_orderId":"a411a636-2e8f-47ea-9620-fd5d7703af77"}'

DELETE Orders Example Request:

{
  "accountId": "3336",
  "e_orderId": "fb10f1cc-e22e-4d1e-84ba-93b9033fd323" //order id
}

DELETE Orders Example Response:

["fb10f1cc-e22e-4d1e-84ba-93b9033fd323"] // order id

Cancel a previously placed order.

HTTP Request

DELETE /api/v1/private/orders

Body Parameters

Name Description
accountId account id for linked account (required)
e_orderId exchange's order id (required)

Cancel All Orders

import axios from 'axios';

// make sure to include signature headers (not shown below)
const options = {
  method: 'DELETE',
  data : {
           "accountIds":["2019"],
           "pairs":["BTC/USD"],
         },
  url: 'https://quadency.com/api/v1/private/orders/all',
};

axios(options).then((response)=>{
  console.log(response.data);
});
# make sure to include signature headers (not shown below)
curl 'https://quadency.com/api/v1/private/orders/all' -X DELETE \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/plain, */*' \
--data-binary '{"accountIds":["1"],"pairs":["ETH/BTC"]}' --compressed

DELETE All Orders Example Request:

{
  "accountIds":["2019"],
  "pairs":["BTC/USD"],
}

Cancels all open order specified your linked account ids and pairs you would like to cancel. If none are provided, all your quadency accounts will be cancelled.

DELETE All Orders Example Response:


// array of single element arrays containing the exchange order id
[
  [
    "33a84cfb-06ec-43cf-8211-220565fdfeb2" // order id
  ],
  [
    "d0d5504a-6767-4f43-9e3a-34eba49c7699"
  ]  
]

HTTP Request

DELETE /api/v1/private/orders/all

Body Parameters

Name Description
accountIds array of account Id, you would like to cancel order for (required)
pairs array of pairs you want to cancel orders (required)

Trades

List Trades

import axios from 'axios';

// make sure to include signature headers (not shown below)
const options = {
  method: 'GET',
  url: 'https://quadency.com/api/v1/private/trades?limit=2',
};

axios(options).then((response)=>{
  console.log(response.data);
});
# make sure to include signature headers (not shown below)
curl https://quadency.com/api/v1/private/trades?limit=2

GET Trades Example Response:

[
    {
        "accountid": "58",
        "amount": "11.85700000",
        "e_timestamp": "2019-04-11T01:13:59.680Z",
        "exchange": "GDAX",
        "fee": {
            "cost": 0.00023714,
            "currency": "USD",
            "rate": 0.0025
        },
        "pair": "BTC/USD",
        "price": "0.010000000000000000",
        "side": "sell"
    },
    {
        "accountid": "58",
        "amount": "9999.85700000",
        "e_timestamp": "2019-04-11T01:13:58.908Z",
        "exchange": "GDAX",
        "fee": {
            "cost": 0.19999714,
            "currency": "USD",
            "rate": 0.0025
        },
        "pair": "BTC/USD",
        "price": "0.010000000000000000",
        "side": "sell"
    }
]

Get trade history for all linked accounts

HTTP Request

GET /api/v1/private/trades

Example

GET /api/v1/private/trades?limit=2

Details

Offset and limit parameters may be used to paginate the response

Query Parameters

Name Description
offset The number by which to offset the results
limit Maximum number of trades to return

List Trades for account

import axios from 'axios';

// make sure to include signature headers (not shown below)
const options = {
  method: 'GET',
  url: 'https://quadency.com/api/v1/private/trades/accounts/63',
};

axios(options).then((response)=>{
  console.log(response.data);
});
# make sure to include signature headers (not shown below)
curl https://quadency.com/api/v1/private/trades/accounts/63

GET Trades for Account Example Response:

[
    {
        "amount": "0.06406000",
        "e_timestamp": "2019-04-02T04:36:15.420Z",
        "fee": {
            "cost": 0.00924962,
            "currency": "USDT"
        },
        "pair": "ETH/USDT",
        "price": "144.390000000000000000",
        "side": "sell"
    },
    {
        "amount": "0.07980000",
        "e_timestamp": "2019-04-02T04:36:15.138Z",
        "fee": {
            "cost": 0.01152232,
            "currency": "USDT"
        },
        "pair": "ETH/USDT",
        "price": "144.390000000000000000",
        "side": "sell"
    }
]

Get trade history for specific account

HTTP Request

GET /api/v1/private/trades/accounts/:accountid

Example

GET /api/v1/private/trades/accounts/63

Query Parameters

Name Description
offset The number by which to offset the resultsavailable
limit Maximum number of trades to return
pairs Comma separated list of pairs

Private Websocket

Websocket Endpoint

/api/v1/private/ws

Subscribing and Unsubscribing

Like the public stream, to subscribe to or unsubscribe from a stream, send a json object with the following structure (as seen on right)

{
  "subscriptionType": "...",
  "eventType": "...",
  ...
}

Here, subscriptionType would be the stream you are attempting to subscribe to or unsubscribe from. eventType specifies whether to subscribe, or unsubscribe. Depending on the stream, additional properties may need to be included in the json object as well. If the websocket connection should close from the client side, your will automatically be unsubscribed.

User Order Stream

Real time order updates to users orders

Order Stream Example Subscribe/Unsubscribe Request:

{
  "subscriptionType": "orderStream",
  "eventType": "subscribe"
}

Order Stream Example Message

{
  "subscriptionType": "orderStream",
  "accountId": "1",
  "exchange": "GDAX",
  "pair": "ETH/BTC",
  "type": "LIMIT",
  "status": "OPEN",
  "side": "SELL",
  "price": "12.00000000",
  "amount": "1.00000000",
  "filled": "0",
  "e_orderId": "dcfa5530-0ad9-4fa7-942e-6b3bd9a6e592",
  "e_timestamp": 1555529245277,
  "ts": 1555529245387
}

Response Parameters

Name Description
subscriptionType subscription type
accountId account Id
pair pair for the order update (ie BTC/USDT)
type MARKET/LIMIT/STOP
status OPEN/CLOSED/CANCELED/REJECTED
side BUY/SELL
price price for order (if market, no price)
stopPrice stop price if stop order
amount amount of base bought or sold
filled amount order filled
e_orderId order id for order
e_timestamp timestamp given by exchange
ts timestamp of message

User Balance Stream

Real time balance updates to users balances

Order Stream Example Subscribe/Unsubscribe Request:

{
  "subscriptionType": "balanceStream",
  "eventType": "subscribe",
  "accountId": "1"
}

Balance Stream Example Message

{
  "subscriptionType": "balanceStream",
  "accountId": "1",
  "balances": [
    {
      "asset": "ETH",
      "used": "1.00000000",
      "free": "998887.00009980",
      "total": "998888.00009980"
    },
    {
      "asset": "BTC",
      "used": "998900.92449659",
      "free": "0.00500000",
      "total": "998900.92949659"
    },
    {
      "asset": "USDC",
      "used": "0.00000000",
      "free": "1000000.00000000",
      "total": "1000000.00000000"
    },
    {
      "asset": "USD",
      "used": "0.00000000",
      "free": "3868724.13622077",
      "total": "3868724.13622077"
    },
    {
      "asset": "GBP",
      "used": "0.00000000",
      "free": "1000000.00000000",
      "total": "1000000.00000000"
    },
    {
      "asset": "EUR",
      "used": "0.00000000",
      "free": "1000000.00000000",
      "total": "1000000.00000000"
    },
    {
      "asset": "BAT",
      "used": "0.00000000",
      "free": "1000000.00000000",
      "total": "1000000.00000000"
    }
  ],
  "ts": 1555529246176
}

Response Parameters

Name Description
subscriptionType subscription type
accountId account Id
balances array of balance object having: asset, free balance, total balance, used balance
ts timestamp of message