NAV
ruby

Introduction

API Version

The base URL for Quoinex production is https://api.liquid.com/. All responses are in JSON format with the following status codes:

HTTP 200: OK
  Response is correct. The body of the response will
  include the data requested.

HTTP 400: Bad Request
  There was an error with the request. The body of the response will have more info

HTTP 401: Unauthorized
  Token is invalid. If your API key is wrong a 401 will also be served,
  so check the response body, it might be that the API_KEY is invalid.

HTTP 422: Unprocessable Entity
  There was an error with the request. The body of the response will have more info. Some possible reasons:
  - Missing params
  - The format of data is wrong

HTTP 429: Too Many Requests
  This status indicates that the user has sent too many requests in a given amount of time

HTTP 503: Service Unavailable
  Many reasons, body will include details
  - An internal error on Authy.
  - Your application is accessing an API call you don't have access too.
  - API usage limit. If you reach API usage limits a 503 will be returned,
  please wait until you can do the call again.

The current API version is 2. Please include the following header in the request to get correct API behaviors.

Header Value
X-Quoine-API-Version 2

Rate Limiting

API users should not make more than 300 requests per 5 minute. Requests go beyond the limit will return with a 429 status

Authentication

require 'uri'
require 'net/http'
require 'time'
require 'jwt'

uri = URI.parse("https://api.liquid.com")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

token_id = 'YOUR_API_TOKEN_ID'
user_secret = 'YOUR_API_SECRET'
path = '/orders?product_id=1'

auth_payload = {
  path: path,
  nonce: DateTime.now.strftime('%Q'),
  token_id: token_id
}

signature = JWT.encode(auth_payload, user_secret, 'HS256')

request = Net::HTTP::Get.new(path)
request.add_field('X-Quoine-API-Version', '2')
request.add_field('X-Quoine-Auth', signature)
request.add_field('Content-Type', 'application/json')

response = http.request(request)

Authentication requires 2 parameters: API Token ID and API Secret. These parameters can be obtained from API Setting page

We use JSON Web Token open standard for Authentication:

First you need to build an auth payload, which includes the following parameters:

Auth Payload Parameters:

Parameters Optional? Description
path request path, e.g /orders?product_id=1
nonce a strictly increasing number, uniquely created for each request. We recommend using a millisecond timestamp at the time of making request, e.g 1459142524488
token_id Token ID

After constructing the auth payload, you need to sign it with your secret using HMAC-SHA256 (HS256).
JWT.encode(auth_payload, user_secret, 'HS256')
You can choose to manually sign by following JWT specs. But we highly recommend using a JWT library, which is available in a wide range of programming languages.

Request Header:

Parameters Optional? Description
X-Quoine-Auth Signature obtained from signing the Auth Payload

Types

Timestamps

1457974024 (for 2016-03-14T16:47:04 in ISO 8601)

Unless otherwise specified, all timestamps from API are returned in Unix Time.

Numbers

Errors

Due to legacy reason, there are 2 type of error responses:

Message

{
  "message": "missing parameters"
}

The message will be in the requester default language. For public api, please request with HTTP_ACCEPT_LANGUAGE header set to your preferred language

Code

Code with the following structure will be returned

{ “errors”: {“object”: [“errors list”]} }

{
  "errors": {"user":["not_enough_fund"]}
}

Pagination

{
    "models": [ "<json objects>" ],
    "current_page": "<current page>",
    "total_pages": "<number of pages>"
}

Unless otherwise specified, all API requesting lists will be paginated with the following format:

I. Public API

Products

Get Products

GET /products

[
  {
      "id": 5,
      "product_type": "CurrencyPair",
      "code": "CASH",
      "name": "CASH Trading",
      "market_ask": "48203.05",
      "market_bid": "48188.15",
      "indicator": -1,
      "currency": "JPY",
      "currency_pair_code": "BTCJPY",
      "symbol": "¥",
      "fiat_minimum_withdraw": "1500.0",
      "pusher_channel": "product_cash_btcjpy_5",
      "taker_fee": "0.0",
      "maker_fee": "0.0",
      "low_market_bid": "47630.99",
      "high_market_ask": "48396.71",
      "volume_24h": "2915.627366519999999998",
      "last_price_24h": "48217.2",
      "last_traded_price": "48203.05",
      "last_traded_quantity": "1.0",
      "quoted_currency": "JPY",
      "base_currency": "BTC",
      "exchange_rate": "0.009398151671149725"
  },
  ...
]

Get the list of all available products.

Get a Product

GET /products/:id

{
    "id": 5,
    "product_type": "CurrencyPair",
    "code": "CASH",
    "name": "CASH Trading",
    "market_ask": "48203.05",
    "market_bid": "48188.15",
    "indicator": -1,
    "currency": "JPY",
    "currency_pair_code": "BTCJPY",
    "symbol": "¥",
    "fiat_minimum_withdraw": "1500.0",
    "pusher_channel": "product_cash_btcjpy_5",
    "taker_fee": "0.0",
    "maker_fee": "0.0",
    "low_market_bid": "47630.99",
    "high_market_ask": "48396.71",
    "volume_24h": "2915.62736652",
    "last_price_24h": "48217.2",
    "last_traded_price": "48203.05",
    "last_traded_quantity": "1.0",
    "quoted_currency": "JPY",
    "base_currency": "BTC",
    "exchange_rate": "0.009398151671149725"
}

Parameters:

Parameters Optional? Description
id Product ID

Get Order Book

GET /products/:id/price_levels

{
  "buy_price_levels": [
    ["416.23000", "1.75000"],   ...
  ],
  "sell_price_levels": [
    ["416.47000", "0.28675"],   ...
  ]
}

Parameters:

Parameters Optional? Description
id Product ID
full yes 1 to get all price levels (default is 20 each side)

Format

Executions

Get Executions

GET /executions?product_id=1&limit=2&page=2

Success Response:
{
  "models": [
    {
      "id": 1011880,
      "quantity": "6.118954",
      "price": "409.78",
      "taker_side": "sell",
      "created_at": 1457370745
    },
    {
      "id": 1011791,
      "quantity": "1.15",
      "price": "409.12",
      "taker_side": "sell",
      "created_at": 1457365585
    }
  ],
  "current_page": 2,
  "total_pages": 1686
}

Get a list of recent executions from a product (Executions are sorted in DESCENDING order - Latest first)

Parameters Optional? Description
product_id Product ID
limit yes How many executions should be returned. Must be <= 1000. Default is 20
page yes From what page the executions should be returned, e.g if limit=20 and page=2, the response would start from the 21st execution. Default is 1

Get Executions by Timestamp

GET /executions?product_id=1&timestamp=1430630863&limit=2

Success Response:
[
  {
    "id": 960598,
    "quantity": "5.6",
    "price": "431.89",
    "taker_side": "buy",
    "created_at": 1456705487
  },
  {
    "id": 960603,
    "quantity": "0.06",
    "price": "431.74",
    "taker_side": "buy",
    "created_at": 1456705564
  }
]

Get a list of executions after a particular time (Executions are sorted in ASCENDING order)

Parameters Optional? Description
currency_pair_code e.g. BTCJPY
timestamp Only show executions at or after this timestamp (Unix timestamps in seconds)
limit yes How many executions should be returned. Must be <= 1000. Default is 20

Interest Rates

Get Interest Rate Ladder for a currency

Format

GET /ir_ladders/USD

{
  "bids": [
    [
      "0.00020",
      "23617.81698"
    ],
    [
      "0.00040",
      "50050.42000"
    ],
    [
      "0.00050",
      "100000.00000"
    ]
  ],
  "asks": []
}

Fee structure

Attributes

Attribute Type Options Nullable? Description
priority Integer NO Fee setting has highest priority and matches conditions will be applied
fee_type Enum
  • trade_fee
  • additional_liquidation_trade_fee
  • trade_fee_discount
NO Fee type
conditions Hash
  • key: String
  • value: Array of String
  • trade_fee
    • maker_taker: maker, taker
    • currency_pair_code: BTCUSD, BTCJPY …
  • additional_liquidation_trade_fee: <no conditions>
  • trade_fee_discount
    • fee_currency: USD, BTC, QASH…
NO Record matches if all conditions match
description String NO Explain fee setting record
charge_type Enum
  • percentage
  • fixed_amount
NO Fee type
charge_value Decimal NO Fee rate

Trade fee

GET /fees?fee_type=trade_fee

[
  {
    "id":1,
    "fee_type":"trade_fee",
    "priority":500,
    "conditions":{},
    "description":"0.10% trade fee for Liquid Global",
    "charge_type":"percentage",
    "charge_value":"0.001"
  }
]

Additional liquidation trade fee

GET /fees?fee_type=additional_liquidation_trade_fee

[
  {
    "id":7,
    "fee_type":"additional_liquidation_trade_fee",
    "priority":500,
    "conditions":{},
    "description":"0.20% additional liquidation trade fee for Liquid Global",
    "charge_type":"percentage",
    "charge_value":"0.002"
  }
]

Trade fee discount

GET /fees?fee_type=trade_fee_discount

[
  {
    "id":9,
    "fee_type":"trade_fee_discount",
    "priority":0,
    "conditions":{"fee_currency":"QASH"},
    "description":"Use QASH to pay trade fee, to get 50% discount",
    "charge_type":"percentage","charge_value":"0.5"
  }
]

II. Authenticated API

All requests to Authenticated endpoints must be properly signed as shown in Authentication,

Orders

Create an Order

POST /orders/


{
  "order": {
    "order_type": "limit",
    "product_id": 1,
    "side": "sell",
    "quantity": "0.01",
    "price": "500.0"
  }
}
Success Response:
{
  "id": 2157474,
  "order_type": "limit",
  "quantity": "0.01",
  "disc_quantity": "0.0",
  "iceberg_total_quantity": "0.0",
  "side": "sell",
  "filled_quantity": "0.0",
  "price": "500.0",
  "created_at": 1462123639,
  "updated_at": 1462123639,
  "status": "live",
  "leverage_level": 1,
  "source_exchange": "QUOINE",
  "product_id": 1,
  "product_code": "CASH",
  "funding_currency": "USD",
  "currency_pair_code": "BTCUSD",
  "order_fee": "0.0"
}

Parameters

Parameters Optional? Description
order_type limit, market or market_with_range
trading_type true margin or cfd, only available if leverage_level > 1
product_id Product ID
side buy or sell
quantity quantity to buy or sell
price price per unit of cryptocurrency
price_range true For order_type of market_with_range only, slippage of the order.

Margin Order Parameters

Parameters Optional? Description
leverage_level Valid levels: 2, 4, 5, 10, 25.
50 and 100 for trading_type of cfd only.
funding_currency Currency used to fund the trade with. Default is quoted currency (e.g a trade in BTCUSD product will use USD as the funding currency as default)
order_direction true one_direction, two_direction, netout

Response Parameters

Parameters Optional? Description
status live, filled, partially_filled, cancelled
filled_quantity the amount that has been filled

Get an Order

GET /orders/:id

Success Response
{
  "id": 2157479,
  "order_type": "limit",
  "quantity": "0.01",
  "disc_quantity": "0.0",
  "iceberg_total_quantity": "0.0",
  "side": "sell",
  "filled_quantity": "0.01",
  "price": "500.0",
  "created_at": 1462123639,
  "updated_at": 1462123639,
  "status": "filled",
  "leverage_level": 2,
  "source_exchange": "QUOINE",
  "product_id": 1,
  "product_code": "CASH",
  "funding_currency": "USD",
  "currency_pair_code": "BTCUSD",
  "order_fee": "0.0",
  "executions": [
    {
      "id": 4566133,
      "quantity": "0.01",
      "price": "500.0",
      "taker_side": "buy",
      "my_side": "sell",
      "created_at": 1465396785
    }
  ]
}

Parameters:

Parameters Optional? Description
id Order ID

Get Orders

GET /orders?funding_currency=:currency&product_id=:product_id&status=:status&with_details=1

Success Response
{
  "models": [
    {
      "id": 2157474,
      "order_type": "limit",
      "quantity": "0.01",
      "disc_quantity": "0.0",
      "iceberg_total_quantity": "0.0",
      "side": "sell",
      "filled_quantity": "0.0",
      "price": "500.0",
      "created_at": 1462123639,
      "updated_at": 1462123639,
      "status": "live",
      "leverage_level": 1,
      "source_exchange": "QUOINE",
      "product_id": 1,
      "product_code": "CASH",
      "funding_currency": "USD",
      "currency_pair_code": "BTCUSD",
      "order_fee": "0.0",
      *
      "executions": []
      *
    }
  ],
  "current_page": 1,
  "total_pages": 1
}

Parameters:

Parameters Optional? Description
funding_currency yes filter orders based on funding currency
product_id yes filter orders based on product
status yes filter orders based on status
trading_type yes spot, margin or cfd
with_details yes return full order details (attributes between *) including executions if set to 1

Cancel an Order

PUT /orders/:id/cancel

Success Response
{
  "id": 2157474,
  "order_type": "limit",
  "quantity": "0.01",
  "disc_quantity": "0.0",
  "iceberg_total_quantity": "0.0",
  "side": "sell",
  "filled_quantity": "0.0",
  "price": "500.0",
  "created_at": 1462123639,
  "updated_at": 1462123639,
  "status": "cancelled",
  "leverage_level": 1,
  "source_exchange": "QUOINE",
  "product_id": 1,
  "product_code": "CASH",
  "funding_currency": "USD",
  "currency_pair_code": "BTCUSD"
}

Parameters:

Parameters Optional? Description
id Order ID

Edit a Live Order

PUT /orders/:id

{
  "order": {
    "quantity": "0.02",
    "price": "520.0"
  }
}
Success Response:
{
  "id": 2157474,
  "order_type": "limit",
  "quantity": "0.02",
  "disc_quantity": "0.0",
  "iceberg_total_quantity": "0.0",
  "side": "sell",
  "filled_quantity": "0.0",
  "price": "520.0",
  "created_at": 1462123639,
  "updated_at": 1462123639,
  "status": "live",
  "leverage_level": 1,
  "source_exchange": "QUOINE",
  "product_id": 1,
  "product_code": "CASH",
  "funding_currency": "USD",
  "currency_pair_code": "BTCUSD"
}

Parameters:

Parameters Optional? Description
id Order ID

Get an Order’s Trades

GET /orders/:id/trades

Success Response:
[
  {
    "id": 57896,
    "currency_pair_code": "BTCUSD",
    "status": "closed",
    "side": "short",
    "margin_used": "0.83588",
    "open_quantity": "0.01",
    "close_quantity": "0.0",
    "quantity": "0.01",
    "leverage_level": 5,
    "product_code": "CASH",
    "product_id": 1,
    "open_price": "417.65",
    "close_price": "417.0",
    "trader_id": 3020,
    "open_pnl": "0.0",
    "close_pnl": "0.0065",
    "pnl": "0.0065",
    "stop_loss": "0.0",
    "take_profit": "0.0",
    "funding_currency": "USD",
    "created_at": 1456250726,
    "updated_at": 1456251837,
    "close_fee": "0.0",
    "total_interest": "0.02",
    "daily_interest": "0.02"
  }
]

Parameters:

Parameters Optional? Description
id Order ID

Executions

Get Your Executions

GET /executions/me?product_id=:product_id

Success Response
{
  "models": [
    {
      "id": 1001232,
      "quantity": "0.37153179",
      "price": "390.0",
      "taker_side": "sell",
      "my_side": "sell",
      "created_at": 1457193798
    }
  ],
  "current_page": 1,
  "total_pages": 2
}

Parameters:

Parameters Optional? Description
product_id Product ID

Accounts

Get Fiat Accounts

GET /fiat_accounts

Success Response
[
  {
    "id": 4695,
    "currency": "USD",
    "currency_symbol": "$",
    "balance": "10000.1773",
    "pusher_channel": "user_3020_account_usd",
    "lowest_offer_interest_rate": "0.00020",
    "highest_offer_interest_rate": "0.00060",
    "exchange_rate": "1.0",
    "currency_type": "fiat"
  }
]

Create a Fiat Account

POST /fiat_accounts

{
  "currency": "USD"
}
Success Response
{
  "id": 5595,
  "currency": "USD",
  "currency_symbol": "$",
  "balance": "0.0",
  "pusher_channel": "user_3122_account_usd",
  "lowest_offer_interest_rate": "0.00020",
  "highest_offer_interest_rate": "0.00060",
  "exchange_rate": "1.0",
  "currency_type": "fiat"
}

Get Crypto Accounts

GET /crypto_accounts

Success Response
[
  {
    "id": 4668,
    "balance": "4.99",
    "address": "1F25zWAQ1BAAmppNxLV3KtK6aTNhxNg5Hg",
    "currency": "BTC",
    "currency_symbol": "฿",
    "pusher_channel": "user_3020_account_btc",
    "minimum_withdraw": 0.02,
    "lowest_offer_interest_rate": "0.00049",
    "highest_offer_interest_rate": "0.05000",
    "currency_type": "crypto"
  }
]

Get all Account Balances

GET /accounts/balance

Success Response
[
    {
        "currency": "BTC",
        "balance": "0.04925688"
    },
    {
        "currency": "USD",
        "balance": "7.17696"
    },
    {
        "currency": "JPY",
        "balance": "356.01377"
    }
]

Assets Lending

Create a loan bid

POST /loan_bids

{
  "loan_bid": {
    "quantity": "50",
    "currency": "USD",
    "rate": "0.0002"
  }
}
Success Response
{
  "id": 3580,
  "bidask_type": "limit",
  "quantity": "50.0",
  "currency": "USD",
  "side": "bid",
  "filled_quantity": "0.0",
  "status": "live",
  "rate": "0.0002",
  "user_id": 3020
}

Parameters:

Parameters Optional? Description
rate daily interest rate, e.g 0.0002 (0.02%), must be <= 0.07%
quantity amount to lend
currency lending currency (all available in the system except JPY)

Get loan bids

GET /loan_bids?currency=:currency

Success Response
{
  "models": [
    {
      "id": 3580,
      "bidask_type": "limit",
      "quantity": "50.0",
      "currency": "USD",
      "side": "bid",
      "filled_quantity": "0.0",
      "status": "live",
      "rate": "0.0007",
      "user_id": 3020
    }  
  ],
  "current_page": 1,
  "total_pages": 1
}

Parameters:

Parameters Optional? Description
currency yes filter loan bids by lending currency

Close loan bid

PUT /loan_bids/:id/close

Success Response:
{
  "id": 3580,
  "bidask_type": "limit",
  "quantity": "50.0",
  "currency": "USD",
  "side": "bid",
  "filled_quantity": "0.0",
  "status": "closed",
  "rate": "0.0007",
  "user_id": 3020
}  
Parameters Optional? Description
id loan bid ID

Get Loans

GET /loans?currency=JPY

Success Response
{
  "models": [
    {
      "id": 144825,
      "quantity": "495.1048",
      "rate": "0.0005",
      "created_at": 1464168246,
      "lender_id": 312,
      "borrower_id": 5712,
      "status": "open",
      "currency": "JPY",
      "fund_reloaned": true
    }
  ],
  "current_page": 1,
  "total_pages": 1
}

Update a Loan

PUT /loans/144825

{
  "loan": {
    "fund_reloaned": false
  }
}
Success Response
{
  "id": 144825,
  "quantity": "495.1048",
  "rate": "0.0005",
  "created_at": 1464168246,
  "lender_id": 312,
  "borrower_id": 5712,
  "status": "open",
  "currency": "JPY",
  "fund_reloaned": false
}

Trading Accounts

Get Trading Accounts

GET /trading_accounts

Success Response
[
  {
    "id": 1759,
    "leverage_level": 10,
    "max_leverage_level": 10,
    "pnl": "0.0",
    "equity": "10000.1773",
    "margin": "4.2302",
    "free_margin": "9995.9471",
    "trader_id": 4807,
    "status": "active",
    "product_code": "CASH",
    "currency_pair_code": "BTCUSD",
    "position": "0.1",
    "balance": "10000.1773",
    "created_at": 1421992165,
    "updated_at": 1457242996,
    "pusher_channel": "trading_account_1759",
    "margin_percent": "0.1",
    "product_id": 1,
    "funding_currency": "USD"
  },  
...
]

Get a Trading Account

GET /trading_accounts/:id

Success Response

{
  "id": 1759,
  "leverage_level": 10,
  "max_leverage_level": 10,
  "pnl": "0.0",
  "equity": "10000.1773",
  "margin": "4.2302",
  "free_margin": "9995.9471",
  "trader_id": 4807,
  "status": "active",
  "product_code": "CASH",
  "currency_pair_code": "BTCUSD",
  "position": "0.1",
  "balance": "10000.1773",
  "created_at": 1421992165,
  "updated_at": 1457242996,
  "pusher_channel": "trading_account_1759",
  "margin_percent": "0.1",
  "product_id": 1,
  "funding_currency": "USD"
}

Parameters:

Parameters Optional? Description
id Trading Account ID

Trades

Get Trades

GET /trades?funding_currency=:funding_currency&status=:status

Success Response
{
  "models": [
    {
      "id": 57896,
      "currency_pair_code": "BTCUSD",
      "status": "open",
      "side": "short",
      "margin_used": "0.83588",
      "open_quantity": "0.01",
      "close_quantity": "0.0",
      "quantity": "0.01",
      "leverage_level": 5,
      "product_code": "CASH",
      "product_id": 1,
      "open_price": "417.65",
      "close_price": "417.0",
      "trader_id": 3020,
      "open_pnl": "0.0",
      "close_pnl": "0.0",
      "pnl": "0.0065",
      "stop_loss": "0.0",
      "take_profit": "0.0",
      "funding_currency": "USD",
      "created_at": 1456250726,
      "updated_at": 1456251837,
      "total_interest": "0.02"
    },
    ...
  ],
  "current_page": 1,
  "total_pages": 1
}

Parameters:

Parameters Optional? Description
funding_currency yes get trades of a particular funding currency
status yes open or closed
trading_type yes margin or cfd

Close a trade

PUT /trades/:id/close

Success Response:
{
  "id": 57896,
  "currency_pair_code": "BTCUSD",
  "status": "closed",
  "side": "short",
  "margin_used": "0.83588",
  "open_quantity": "0.01",
  "close_quantity": "0.0",
  "quantity": "0.01",
  "leverage_level": 5,
  "product_code": "CASH",
  "product_id": 1,
  "open_price": "417.65",
  "close_price": "417.0",
  "trader_id": 3020,
  "open_pnl": "0.0",
  "close_pnl": "0.0065",
  "pnl": "0.0065",
  "stop_loss": "0.0",
  "take_profit": "0.0",
  "funding_currency": "USD",
  "created_at": 1456250726,
  "updated_at": 1456251837,
  "total_interest": "0.02"
}

Parameters:

Parameters Optional? Description
id Trade ID
closed_quantity yes The quantity you want to close

Close all trade

PUT /trades/close_all

{
  "side": "short"
}
Success Response:
[
  {
    "id": 57896,
    "currency_pair_code": "BTCUSD",
    "status": "closed",
    "side": "short",
    "margin_used": "0.83588",
    "open_quantity": "0.01",
    "close_quantity": "0.0",
    "quantity": "0.01",
    "leverage_level": 5,
    "product_code": "CASH",
    "product_id": 1,
    "open_price": "417.65",
    "close_price": "417.0",
    "trader_id": 3020,
    "open_pnl": "0.0",
    "close_pnl": "0.0065",
    "pnl": "0.0065",
    "stop_loss": "0.0",
    "take_profit": "0.0",
    "funding_currency": "USD",
    "created_at": 1456250726,
    "updated_at": 1456251837,
    "total_interest": "0.02"
  }
]

Parameters:

Parameters Optional? Description
side yes Close all trades of this side. Close trades of both side if left blank

Update a trade

PUT /trades/:id

{
  "trade": {
    "stop_loss": "300",
    "take_profit": "600"
  }
}
Success Response:
{
  "id": 57897,
  "currency_pair_code": "BTCUSD",
  "status": "open",
  "side": "short",
  "margin_used": "0.83588",
  "open_quantity": "0.01",
  "close_quantity": "0.0",
  "quantity": "0.01",
  "leverage_level": 5,
  "product_code": "CASH",
  "product_id": 1,
  "open_price": "417.65",
  "close_price": "0",
  "trader_id": 3020,
  "open_pnl": "0.0",
  "close_pnl": "0.0065",
  "pnl": "0.0065",
  "stop_loss": "300.0",
  "take_profit": "600.0",
  "funding_currency": "USD",
  "created_at": 1456250726,
  "updated_at": 1456251837,
  "total_interest": "0.02"
}
Parameters Optional? Description
id Trade ID
stop_loss Stop Loss price
take_profit Take Profit price

Get a trade’s loans

GET /trades/:id/loans

Success Response:
[
  {
    "id": 103520,
    "quantity": "42.302",
    "rate": "0.0002",
    "created_at": 1461998432,
    "lender_id": 100,
    "borrower_id": 3020,
    "status": "open",
    "currency": "USD",
    "fund_reloaned": true
  }
]
Parameters Optional? Description
id Trade ID

Fiat Deposits

Get fiat deposits

GET /fund_infos?currency=:currency&page=:page

Success response:
{
    "models": [
        {
            "id": 1,
            "user_id": 4,
            "amount": 1000,
            "bank_name": "Test Bank",
            "created_at": 1551167985,
            "currency": "USD",
            "status": "pending",
            "notes": "this is a note"
        }
    ],
    "current_page": 1,
    "total_pages": 1
}

Parameters

Parameters Optional? Description
currency filter currency
page true pagination

Response parameters

Parameters Description
status pending cancelled approved

Create fiat deposits

POST /fund_infos

{
    "fund_info": {
        "amount":"1000.99",
        "currency":"USD",
        "bank_name":"Test Bank",
        "notes":"this is a note"
    }
}
Success response
{
    "fund_info": {
        "id": 1,
        "user_id": 4,
        "amount": 1000,
        "bank_name": "Test Bank",
        "created_at": 1551251113,
        "currency": "USD",
        "status": "pending",
        "notes": "this is a note"
    }
}

Parameters

Parameters Optional? Description
amount Amount to be deposit
currency Currency of the deposit. Should be upcase
bank_name Name of source bank. Bank can be created first via UI here
notes true Additional note

Fiat Withdrawals

Get fiat withdrawals

GET /withdrawals?currency=:currency&state=:state&page=:page

Success response
{
    "models": [
        {
            "id": 1,
            "currency": "USD",
            "amount": 100,
            "state": "pending",
            "created_at": 1551256363,
            "bank_account": {
                "id": 2,
                "acc_name": "Nestor Toy",
                "bank_branch": "Omnis omnis optio eius.",
                "acc_number": "305295372929295",
                "address": "9037 Gleason Isle",
                "swift": "Vel non eum magnam.",
                "bank_statement": {
                    "bank_statement": {
                        "url": "/uploads/bank_account/bank_statement/2/sample.pdf",
                        "thumb": {
                            "url": "/uploads/bank_account/bank_statement/2/thumb_sample.pdf"
                        },
                        "for_post": {
                            "url": "/uploads/bank_account/bank_statement/2/for_post_sample.pdf"
                        },
                        "for_logo": {
                            "url": "/uploads/bank_account/bank_statement/2/for_logo_sample.pdf"
                        }
                    }
                },
                "status": "pending",
                "bank": "Isidro VonRueden",
                "country": null,
                "bank_statement_filename": "sample.pdf",
                "reason_new_or_amendment": "Et molestiae odio iure.",
                "joint_acc_name": "",
                "joint_address": null,
                "joint_country": "Suriname",
                "joint_city": null,
                "id_document": {
                    "id_document": {
                        "url": "/uploads/bank_account/id_document/2/sample.pdf",
                        "thumb": {
                            "url": "/uploads/bank_account/id_document/2/thumb_sample.pdf"
                        },
                        "for_post": {
                            "url": "/uploads/bank_account/id_document/2/for_post_sample.pdf"
                        },
                        "for_logo": {
                            "url": "/uploads/bank_account/id_document/2/for_logo_sample.pdf"
                        }
                    }
                },
                "id_document_filename": "sample.pdf",
                "proof_address": {
                    "proof_address": {
                        "url": "/uploads/bank_account/proof_address/2/sample.pdf",
                        "thumb": {
                            "url": "/uploads/bank_account/proof_address/2/thumb_sample.pdf"
                        },
                        "for_post": {
                            "url": "/uploads/bank_account/proof_address/2/for_post_sample.pdf"
                        },
                        "for_logo": {
                            "url": "/uploads/bank_account/proof_address/2/for_logo_sample.pdf"
                        }
                    }
                },
                "proof_address_filename": "sample.pdf"
            }
        }
    ],
    "current_page": 1,
    "total_pages": 1
}

Parameters

Parameters Optionnal? Description
currency Filter by currency
state true Filter by state. pending processed cancelled reverted declined

Crypto Withdrawals

Get crypto withdrawals

GET /crypto_withdrawals?currency=:currency&state=:state&page=:page

Success response
{
    "models": [
        {
            "id": 1,
            "address": "1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2",
            "amount": 1.5,
            "state": "awaiting_confirmation",
            "currency": "BTC",
            "withdrawal_fee": 0,
            "created_at": 1551264711,
            "updated_at": 1551264711,
            "payment_id": null
        }
    ],
    "current_page": 1,
    "total_pages": 100000
}

Parameters

Parameters Optionnal? Description
currency Filter by currency
state true Filter by state. pending filed cancelled processing processed reverted to_be_reviewed declined broadcasted

III. Streaming API

Liquid Tap is a websocket service offered by Quoine for accessing streaming real-time data. It is compatible with Pusher and is optionally authenticated using the same scheme as Liquid API.

Liquid Tap

Public

For unauthenticated use, moving from Pusher to Liquid Tap is as simple as specifying the host in the Pusher configuration.

/* javascript */

/////////////////////////////////////////////
// using Liquid Tap with Pusher library
var pusherKey = 'LIQUID'
var pusherChannel = 'price_ladders_cash_btcusd_sell'
var pusherEvent = 'updated'
var pusherTapHost = 'tap.liquid.com'

const tapSocket = new Pusher(pusherKey, {
  wsHost: pusherTapHost
});

var channel = tapSocket.subscribe(pusherChannel);
channel.bind(pusherEvent, function (data, metadata) {
  console.log("message from Liquid Tap: " + data);
});

/////////////////////////////////////////////
// Legacy method - deprecated
var pusherKey = '2ff981bb060680b5ce97'
var pusherChannel = 'price_ladders_cash_btcusd_sell'
var pusherEvent = 'updated'

const pusherSocket = new Pusher(pusherKey, {
  // any aditional config
});

var channel = pusherSocket.subscribe(pusherChannel);
channel.bind(pusherEvent, function (data, metadata) {
  console.log("message from Pusher: " + data);
});

Authenticated

In order to enjoy the benefits of an authenticated Liquid Tap session, the user must send a quoine:auth_request event containing a JSON Web Token, constructed in the same manner as for access to the Quoine Liquid API. The path parameter should be set to /realtime.

/* javascript */

// generate the JWT somehow
var authSignature = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJwYXRoIjoiL3JlYWx0aW1lIiwidG9rZW5faWQiOjE2MTgwfQ.R8RtlxMiehIwvJ_TLX_aitAb2-5rkQBx5C4JzCbUngI"
var pusherKey = 'LIQUID'
var pusherChannel = 'price_ladders_cash_btcusd_sell'
var pusherEvent = 'updated'
var pusherTapHost = 'tap.liquid.com'

const tapSocket = new Pusher(pusherKey, {
  wsHost: pusherTapHost
});

tapSocket.connection.bind('connected', function () {
    // connection established
    auth_payload = {
          path: "/realtime",
          headers: {
            "X-Quoine-Auth": authSignature
          }
    }

    // send request for authentication
    tapSocket.send_event("quoine:auth_request", auth_payload)

    tapSocket.bind('quoine:auth_success', function() {
        // successfully authenticated
        var channel = tapSocket.subscribe(pusherChannel);
        channel.bind(pusherEvent, function (data, metadata) {
            console.log("message from Liquid Tap: " + data);
        });
    });
});

// Later in application
var channel = tapSocket.subscribe('other_private_channel_without_authenticating_again');

Authentication is only required once, as long as the connection remains.

Liquid Tap client library

You may also use one of our client libraries which already implement the Liquid API authentication scheme.

Please check Pusher documentation for using the Pusher library.

Public channels

The following channels do not require authentication, however benefit from optimisations allowing a faster and lower latency data feed.

Data Channel Example Event
All products products products updated
Specific product product_cash_${currency_pair_code}_${product_id} product_cash_btcusd_1 updated
Order book price_ladders_cash_${currency_pair_code}_${side} price_ladders_cash_btcjpy_sell updated
Executions executions_cash_${currency_pair_code} executions_cash_btcjpy created
Executions detail execution_details_cash_${currency pair code} execution_details_cash_btcusd created

Private channels

Authentication is required for the following channels.

Data Channel Example Event
Orders user_account_${funding_currency}_orders user_account_jpy_orders updated
Trades user_account_${funding_currency}_trades user_account_usd_trades updated
Executions user_executions_cash_${currency_pair_code} user_executions_cash_btcjpy created