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
- Decimal numbers are returned as strings to avoid floating precision errors.
- Integer numbers (including IDs) are unquoted.
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",
"timestamp": "1576739219.195353100"
},
...
]
Get the list of all available products.
Get Perpetual Products
GET /products?perpetual=1
[
{
"id": "603",
"product_type": "Perpetual",
"code": "CASH",
"name": null,
"market_ask": "1143900",
"market_bid": "1143250",
"currency": "JPY",
"currency_pair_code": "P-BTCJPY",
"pusher_channel": "product_cash_p-btcjpy_603",
"taker_fee": "0.0",
"maker_fee": "0.0",
"low_market_bid": "1124450.0",
"high_market_ask": "1151750.0",
"volume_24h": "0.1756",
"last_price_24h": "1129850.0",
"last_traded_price": "1144700.0",
"last_traded_quantity": "0.014",
"quoted_currency": "JPY",
"base_currency": "P-BTC",
"tick_size": "50.0",
"perpetual_enabled": true,
"index_price": "1142636.03935",
"mark_price": "1143522.18417",
"funding_rate": "0.00033",
"fair_price": "1143609.31009",
"timestamp": "1581558659.195353100",
},
...
]
Get the list of all available perpetual 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",
"timestamp": "1576739219.195353100"
}
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"], ...
],
"timestamp": "1576729943.772247300"
}
Parameters:
| Parameters | Optional? | Description |
|---|---|---|
| id | Product ID | |
| full | yes | 1 to get all price levels (default is 20 each side) |
Format
- Each price level follows: [
price,amount]
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×tamp=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
- Each level follows: [
rate,amount]
GET /ir_ladders/USD
{
"bids": [
[
"0.00020",
"23617.81698"
],
[
"0.00040",
"50050.42000"
],
[
"0.00050",
"100000.00000"
]
],
"asks": [],
"timestamp": "1576809175.294"
}
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 |
|
NO | Fee type |
| conditions | Hash
|
|
NO | Record matches if all conditions match |
| description | String | NO | Explain fee setting record | |
| charge_type | Enum |
|
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,
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",
"margin_type": null,
"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",
"client_order_id": null
}
POST /orders/
// market_with_range order
{
"order": {
"order_type": "market_with_range",
"product_id": 1,
"side": "sell",
"quantity": "0.01",
"price": "500.0"
}
}
// or
{
"order": {
"order_type": "market_with_range",
"product_id": 1,
"side": "sell",
"quantity": "0.01",
"price_range": "30.0"
}
}
Success Response:
{
"id": 2157474,
"order_type": "market_with_range",
"margin_type": null,
"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",
"client_order_id": null
}
Parameters
| Parameters | Optional? | Description |
|---|---|---|
| order_type | Supported values: limit, market, market_with_range, trailing_stop, limit_post_only, stop |
|
| trading_type | true | Only available if leverage_level is greater than 1. Supported values: margin, cfd, perpetual. |
| margin_type | true | Only available if leverage_level is greater than 1. Supported values: cross, isolated. Default value is cross. |
| product_id | Product ID | |
| side | Supported values: buy, sell |
|
| quantity | quantity to buy or sell | |
| price | price per unit of cryptocurrency Only required if order_type is limit, limit_post_only, market_with_range, stop |
|
| price_range | true | Only available if order_type is market_with_range. Using relative value of max deviation from best price on the market (slippage control). Will override price parameter. |
| trailing_stop_type | Only available if order_type is trailing_stop. Supported values: price, percentage. |
|
| trailing_stop_value | Only available if order_type is trailing_stop. The distance (by percent or price) that the order should trail the market price. |
|
| client_order_id | true | Custom unique identifying JSON string up to 36 bytes with any content (as long as it is unique). The system will only maintain the last 100 valid entries for client_order_id. |
| take_profit | true | Only available if leverage_level is greater than 1.If order side is buy the value of take_profit must be greater than the order’s price.If order side is sell the value of take_profit must be less than the order’s price.The same validation applies to orders that are executed at market. Take profit will be executed as a limit order |
| stop_loss | true | Only available if leverage_level is greater than 1.If order side is buy the value of stop_loss must be less than the order’s price.If order side is sell the value of stop_loss must be greater than the order’s price.The same validation applies to orders that are executed at market. Stop loss will be executed as a market 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 |
Without client_order_id
POST /orders/
{
"order": {
"order_type": "limit",
"product_id": 1,
"side": "sell",
"quantity": "0.01",
"price": "500.0"
}
}
Success Response:
{
"id": 2157474,
"order_type": "limit",
"margin_type": null,
"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",
"client_order_id": null
}
With client_order_id
POST /orders/
{
"order": {
"order_type": "limit",
"product_id": 1,
"side": "sell",
"quantity": "0.01",
"price": "500.0",
"client_order_id": "7b41d04a-1551-455a-939c-81c41c365ad9"
}
}
Success Response:
{
"id": 2157474,
"order_type": "limit",
"margin_type": null,
"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",
"client_order_id": "7b41d04a-1551-455a-939c-81c41c365ad9"
}
With invalid client_order_id
Requests with invalid client_order_id will be rejected
POST /orders/
{
"order": {
"order_type": "limit",
"product_id": 1,
"side": "sell",
"quantity": "0.01",
"price": "500.0",
"client_order_id": "more than 36 characters ............."
}
}
Response:
{
"errors": {
"client_order_id": ["invalid"]
}
}
With duplicated client_order_id
POST /orders/
{
"order": {
"order_type": "limit",
"product_id": 1,
"side": "sell",
"quantity": "0.01",
"price": "500.0",
"client_order_id": "7b41d04a-1551-455a-939c-81c41c365ad9"
}
}
Response:
{
"errors": {
"client_order_id": ["exists"]
}
}
Perpetual Orders
Parameters
| Parameters | Optional? | Description |
|---|---|---|
| product_id | Must be perpetual product | |
| leverage_level | Valid levels: 2, 4, 5, 10, 25, 50, 100. | |
| trading_type | Supported values: perpetual. |
POST /orders/
{
"order": {
"order_type": "limit",
"product_id": 603,
"side": "sell",
"quantity": "0.01",
"price": "500.0",
"leverage_level": 4,
"trading_type": "perpetual"
}
}
Success Response:
{
"id": 2157474,
"order_type": "limit",
"margin_type": "cross",
"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": 4,
"source_exchange": "QUOINE",
"product_id": 603,
"product_code": "CASH",
"funding_currency": "JPY",
"currency_pair_code": "P-BTCJPY",
"order_fee": "0.0",
"target": "open",
"client_order_id": null,
"trading_type": "perpetual"
}
The example of WS update for perpetual trading,
sent into private WS channel "user_account_${funding_currency}_orders":
{
"channel": "user_account_jpy_orders",
"event": "updated",
"data": {
"id": 2157474,
"order_type": "limit",
"margin_type": "cross",
"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": 4,
"source_exchange": "QUOINE",
"product_id": 603,
"product_code": "CASH",
"funding_currency": "JPY",
"currency_pair_code": "P-BTCJPY",
"order_fee": "0.0",
"target": "open",
"client_order_id": null,
"trading_type": "perpetual"
}
}
Orders
Get an Order
GET /orders/:id
Success Response
{
"id": 2157479,
"order_type": "limit",
"margin_type": "cross",
"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",
"client_order_id": null,
"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",
"margin_type": null,
"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 |
| limit | yes | The number of items returns in a page. The default value is 20. Please note that the maximum number of items we can return at a time is 100. |
| page | yes | The default value is 1 |
Cancel an Order
PUT /orders/:id/cancel
Success Response
{
"id": 2157474,
"order_type": "limit",
"margin_type": null,
"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",
"client_order_id": null
}
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",
"margin_type": null,
"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",
"client_order_id": null
}
Parameters:
| Parameters | Optional? | Description |
|---|---|---|
| id | Order ID |
Edit Stop loss and Take profit
PUT /orders/:id/update_tpsl
{
"take_profit": "500.0",
"stop_loss": "550.0"
}
Success Response:
{
"id": 2157474,
"order_type": "limit",
"margin_type": null,
"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": 4,
"source_exchange": "QUOINE",
"product_id": 1,
"product_code": "CASH",
"funding_currency": "USD",
"currency_pair_code": "BTCUSD",
"take_profit": "500.0",
"stop_loss": "550.0",
"client_order_id": null
}
Parameters
| Parameters | Optional? | Description |
|---|---|---|
| id | Order ID | |
| take_profit | true | Only available if leverage_level is greater than 1.If order side is buy the value of take_profit must be greater than the order’s price.If order side is sell the value of take_profit must be less than the order’s price.The same validation applies to orders that are executed at market. |
| stop_loss | true | Only available if leverage_level is greater than 1.If order side is buy the value of stop_loss must be less than the order’s price.If order side is sell the value of stop_loss must be greater than the order’s price.The same validation applies to orders that are executed at market. |
Get an Order’s Trades
GET /orders/:id/trades
Success Response:
[
{
"id": 57896,
"currency_pair_code": "BTCUSD",
"status": "closed",
"side": "short",
"margin_type": "cross",
"margin_used": "0.83588",
"liquidation_price": null,
"maintenance_margin": null,
"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,
"order_id": 2157474,
"client_order_id": "e77b5a4f-649d-422a-aca3-e02c40a65f55"
}
],
"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",
"reserved_balance": "0.0",
"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",
"reserved_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"
}
| Parameters | Optional? | Description |
|---|---|---|
| currency | Account Currency |
Get Crypto Accounts
GET /crypto_accounts
Success Response
[
{
"id": 4668,
"balance": "4.99",
"reserved_balance": "0.0",
"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"
}
]
Create a Crypto Account
POST /crypto_accounts
{
"currency": "BTC"
}
Success Response
{
"id": 4668,
"balance": "4.99",
"reserved_balance": "0.0",
"address": null,
"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"
}
Parameters:
| Parameters | Optional? | Description |
|---|---|---|
| currency | Account Currency |
Create Deposit Address
Request a deposit address for your crypto account if it does not have one. Response is a crypto account with address initialized
POST /crypto_accounts/:id/init_adress
Success Response
{
"id": 4668,
"balance": "4.99",
"reserved_balance": "0.0",
"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"
}
Parameters:
| Parameters | Optional? | Description |
|---|---|---|
| id | Account ID |
Get all Account Balances
GET /accounts/balance
Success Response
[
{
"currency": "BTC",
"balance": "0.04925688"
},
{
"currency": "USD",
"balance": "7.17696"
},
{
"currency": "JPY",
"balance": "356.01377"
}
]
Get an Account Details
GET /accounts/:currency
Success Response
{
"id": 5595,
"currency": "USD",
"balance": "0.0",
"free_balance": "0.0",
"reserved_balance": "0.0",
"pnl": "0.0",
"margin": "0.0",
"maintenance_margin": "0.0"
}
Parameters:
| Parameters | Optional? | Description |
|---|---|---|
| currency | Account currency |
Get Reserved Balance Details
GET /accounts/:currency/reserved_balance_details
Success Response
[
{"object_type": "Order", "object_id": 1, "amount": "4004.0"},
{"object_type": "LoanBid", "object_id": 2, "amount": "1000.0"},
{"object_type": "Trade", "object_id": 3, "amount": "200.0"},
{"object_type": "Trade", "object_id": 4, "amount": "800.0"}
]
Parameters:
| Parameters | Optional? | Description |
|---|---|---|
| currency | Account currency |
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_type": "cross",
"margin_used": "0.83588",
"liquidation_price": null,
"maintenance_margin": null,
"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 |
|---|---|---|
| product_id | yes | get trades of a particular product |
| funding_currency | yes | get trades of a particular funding currency |
| status | yes | Supported values: open, closed |
| side | yes | Supported values: long, short |
| trading_type | yes | Supported values: margin, cfd, perpetual |
Close a trade
PUT /trades/:id/close
Success Response:
{
"id": 57896,
"currency_pair_code": "BTCUSD",
"status": "closed",
"side": "short",
"margin_type": "cross",
"margin_used": "0.83588",
"liquidation_price": null,
"maintenance_margin": null,
"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 |
Claim a trade
PUT /trades/:id/claim
Success Response:
{
"id": 57896,
"currency_pair_code": "BTCUSD",
"status": "closed",
"side": "short",
"margin_type": "cross",
"margin_used": "0.83588",
"liquidation_price": null,
"maintenance_margin": null,
"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 |
Close all trade
PUT /trades/close_all
{
"side": "short"
}
Success Response:
[
{
"id": 57896,
"currency_pair_code": "BTCUSD",
"status": "closed",
"side": "short",
"margin_type": "cross",
"margin_used": "0.83588",
"liquidation_price": null,
"maintenance_margin": null,
"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_type": "cross",
"margin_used": "0.83588",
"liquidation_price": null,
"maintenance_margin": null,
"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 |
Adjust a Trade’s Allocated Margin
PUT /trades/:id/adjust_margin
{
"amount": "10.0"
}
Success Response:
{
"id": 12345,
"currency_pair_code": "BTCUSD",
"status": "open",
"side": "long",
"margin_type": "isolated",
"margin_used": "60.0", // increase from 50 to 60
"liquidation_price": "3250.0", // decrease from 4,975 to 4,965
"maintenance_margin": "25.0",
"open_quantity": "1.0",
"close_quantity": "0.0",
"quantity": "1.0",
"leverage_level": 100,
"product_code": "CASH",
"product_id": 1,
"open_price": "5000.0",
"close_price": "0.0",
"open_pnl": "-20.0", // market price is 4,980
"close_pnl": "0.0",
"pnl": "-20.0",
"funding_currency": "USD",
"created_at": 1456250726,
"updated_at": 1456251837
}
| Parameters | Type | Optional? | Condition | Description |
|---|---|---|---|---|
| amount | Decimal (String) |
|
|
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 |
Get fiat deposits history
GET /transactions?transaction_type=funding¤cy=:currency&page=:page
Success response:
{
"models": [
{
"id": 1,
"transaction_type": "funding",
"from_fiat_account_id": null,
"to_fiat_account_id": 4,
"from_role": null,
"to_role": null,
"currency": "USD",
"gross_amount": "0.00015",
"net_amount": "0.00015",
"fee": "0.0",
"notes": "",
"fx_rate": null,
"loan": null,
"created_at": 1581932354
}
],
"current_page": 1,
"total_pages": 1
}
Parameters
| Parameters | Optional? | Description |
|---|---|---|
| currency | filter currency | |
| page | true | pagination |
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 | Optional? | Description |
|---|---|---|
| currency | Filter by currency | |
| state | true | Filter by state. pending processed cancelled reverted declined |
Create fiat withdrawal
POST /withdrawals
Request body
{
"auth_code": "0000",
"withdrawal": {
"currency": "USD",
"amount": "1000",
"bank_account_id": "53724"
}
}
Parameters
| Parameters | Optional? | Description |
|---|---|---|
| auth_code | Yes | Two-factor authentication code |
| currency | Withdrawal currency | |
| amount | Withdrawal amount | |
| bank_account_id | ID of bank account to which withdrawal will be make. Bank account can only be created via Wallet page . |
No-touch mode
Creating a fiat withdrawal requires user to interactively input 2FA code. This might get in the way if user is trying to build a fully automated system.
No-touch mode allows human interaction (auth token and email confirmation) to be omitted. No-touch mode can be enabled by adding at least one confirmed Whitelist IP.
Success response
{
"id": 60142,
"currency": "USD",
"amount": "1000.0",
"state": "pending",
"created_at": 1568692166,
"bank_account": {
"id": 53724,
"acc_name": "Quoine Ltd",
"bank_branch": "Tokyo",
"acc_number": "123456789",
"address": ".",
"swift": "123",
"bank_statement": {
"bank_statement": {
"url": "https://quoine.s3.amazonaws.com/uploads/bank_account/bank_statement/53724/Screen_Shot_2019-09-17_at_10.48.37_AM.png?X-Amz-Expires=600&X-Amz-Date=20190917T034926Z&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJZFLHXYSOGOI6ZJA/20190917/us-east-1/s3/aws4_request&X-Amz-SignedHeaders=host&X-Amz-Signature=3b3cdf5f1b656f69718347672d3cdc1f842fb84dd92d443f11a77a7d59c248c9",
"thumb": {
"url": "https://quoine.s3.amazonaws.com/uploads/bank_account/bank_statement/53724/thumb_Screen_Shot_2019-09-17_at_10.48.37_AM.png?X-Amz-Expires=600&X-Amz-Date=20190917T034926Z&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJZFLHXYSOGOI6ZJA/20190917/us-east-1/s3/aws4_request&X-Amz-SignedHeaders=host&X-Amz-Signature=aec255c0b6fbc325866d203797ce8b965755175cc8b5736e9323fd44d7a4a0ff"
},
"for_post": {
"url": "https://quoine.s3.amazonaws.com/uploads/bank_account/bank_statement/53724/for_post_Screen_Shot_2019-09-17_at_10.48.37_AM.png?X-Amz-Expires=600&X-Amz-Date=20190917T034926Z&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJZFLHXYSOGOI6ZJA/20190917/us-east-1/s3/aws4_request&X-Amz-SignedHeaders=host&X-Amz-Signature=2539cfae252adcafb552820c6061d79bcf8504aa3abb9fc73e1daaa797bafce1"
},
"for_logo": {
"url": "https://quoine.s3.amazonaws.com/uploads/bank_account/bank_statement/53724/for_logo_Screen_Shot_2019-09-17_at_10.48.37_AM.png?X-Amz-Expires=600&X-Amz-Date=20190917T034926Z&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJZFLHXYSOGOI6ZJA/20190917/us-east-1/s3/aws4_request&X-Amz-SignedHeaders=host&X-Amz-Signature=598d7f5270e4ff7b390f6d8e55062a1fffc3200e868cedb3c67a33a5f7f7a4e8"
}
}
},
"status": "pending",
"bank": "Bank of Japan",
"country": "JA",
"bank_statement_filename": "Screen_Shot_2019-09-17_at_10.48.37_AM.png",
"reason_new_or_amendment": ".",
"joint_acc_name": null,
"joint_address": null,
"joint_country": null,
"joint_city": null,
"id_document": {
"id_document": {
"url": "no-avatar.png",
"thumb": {
"url": "no-avatar.png"
},
"for_post": {
"url": "no-avatar.png"
},
"for_logo": {
"url": "no-avatar.png"
}
}
},
"id_document_filename": null,
"proof_address": {
"proof_address": {
"url": "no-avatar.png",
"thumb": {
"url": "no-avatar.png"
},
"for_post": {
"url": "no-avatar.png"
},
"for_logo": {
"url": "no-avatar.png"
}
}
},
"proof_address_filename": null
}
}
Cancel fiat withdrawal
PUT /withdrawals/:id/cancel
Success response
200 OK
Parameters
| Parameters | Optional? | Description |
|---|---|---|
| id | Fiat withdrawal ID |
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 | Optional? | Description |
|---|---|---|
| currency | Filter by currency | |
| state | true | Filter by state. pending filed cancelled processing processed reverted to_be_reviewed declined broadcasted |
Create crypto withdrawal
POST /crypto_withdrawals
Request body
{
"auth_code":"0000",
"crypto_withdrawal":{
"currency":"BTC",
"amount":"1",
"address":"1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2",
"payment_id": null,
"memo_type": null,
"memo_value": null
}
}
Parameters
| Parameters | Optional? | Description |
|---|---|---|
| auth_code | Yes | Two-factor authentication code |
| currency | Withdrawal currency | |
| amount | Withdrawal amount | |
| address | Withdrawal address. Address must be registered and confirmed before using. | |
| payment_id | For XRP only. | |
| memo_type | [text, id, hash]. For XLM only | |
| memo_value | For XLM only |
No-touch mode
Creating a crypto withdrawal requires user to interactively input 2FA code and confirm via email. This can be a problem if user is trying to build a fully automated system.
No-touch mode allows human interaction (auth token and email confirmation) to be omitted. No-touch mode can be enabled by adding at least one confirmed Whitelist IP.
Success response
{
"id": 1353,
"address": "1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2",
"amount": 1.0,
"state": "pending",
"currency": "BTC",
"withdrawal_fee": 0.0,
"created_at": 1568016450,
"updated_at": 1568016450,
"payment_id": null
}
Cancel crypto withdrawal
PUT /crypto_withdrawal/:id/cancel
Success response
200 OK
Parameters
| Parameters | Optional? | Description |
|---|---|---|
| id | Crypto withdrawal ID |
III. Liquid Tap WebSocket
Liquid Tap
Liquid Tap is a WebSocket service offered by Quoine for accessing streaming real-time data. You may use one of our Liquid Tap client libraries which already implement the Liquid API authentication scheme.
Liquid Tap can be optionally authenticated using the same scheme as Liquid API.
Authentication
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.
Authentication is only required once, as long as the connection remains.
Further information about authenticating through the dedicated library can be found here
Public Channels
/* javascript - using dedicated library */
const { TapClient } = require("liquid-tap");
const tap = new TapClient();
const public_channel = tap.subscribe("product_cash_btcsgd_7");
public_channel.bind("updated", function(data) {
console.log("product_cash_btcsgd_7 has been updated", data);
});
const product_channel = tap.subscribe("product_cash_btcusd_1");
const orderbook_channel = tap.subscribe("price_ladders_cash_btcjpy_sell");
const executions_channel = tap.subscribe("executions_cash_btcjpy");
const executions_detail_channel = tap.subscribe("execution_details_cash_btcusd");
/* javascript - using raw websockets */
const ws = new WebSocket('wss://tap.liquid.com/app/LiquidTapClient');
ws.onmessage = (message) => {
const wsEvent = JSON.parse(message.data);
switch(wsEvent.event){
case 'pusher:connection_established':
console.log('Connected!');
ws.send(JSON.stringify({"event":"pusher:subscribe","data":{"channel":"some_public_channel"}}));
break;
case 'pusher_internal:subscription_succeeded':
console.log('Subscribed: ' + wsEvent.channel);
case 'updated':
console.log('Updated: ' + wsEvent.data);
}
}
The following channels do not require authentication, however benefit from optimisations allowing a faster and lower latency data feed.
| Data | Channel | Event | Event Details |
|---|---|---|---|
| Get Products | product_cash_${currency_pair_code}_${product_id} |
updated |
|
| Order Book | price_ladders_cash_${currency_pair_code}_${side} |
updated |
|
| Executions | executions_cash_${currency_pair_code} |
updated |
|
| Executions Detail | execution_details_cash_${currency_pair_code} |
updated |
|
Private Channels
/* javascript - using dedicated library */
const { TapClient } = require("liquid-tap");
var tap = new TapClient({
auth: { tokenId: token_id, tokenSecret: token_secret }
});
var protected_channel = tap.subscribe("user_account_usd_trades");
rotected_channel.bind("updated", function(data) {
console.log("Trades Updated: ", data);
});
const pricebook_channel = tap.subscribe("price_ladders_cash_btcjpy");
const orders_channel = tap.subscribe("user_account_jpy_orders");
const trades_channel = tap.subscribe("user_account_usd_trades");
const executions_channel = tap.subscribe("user_executions_cash_btcjpy");
/* javascript - using raw websockets */
const jwt = require('jwt-simple');
var authPayload = {
token_id: 1234,
path: '/realtime',
nonce: Date.now()
};
var tokenSecret = '<token_secret>';
const authRequest = {
headers: {
'X-Quoine-Auth': jwt.encode(authPayload, tokenSecret)
},
path: '/realtime'
}
const ws = new WebSocket('wss://tap.liquid.com/app/LiquidTapClient');
ws.onmessage = (message) => {
const wsEvent = JSON.parse(message.data);
switch(wsEvent.event){
case 'pusher:connection_established':
console.log('Connected');
ws.send(JSON.stringify({ "event":"quoine:auth_request", "data": authRequest }));
break;
case 'quoine:auth_success':
console.log('Authenticated');
ws.send(JSON.stringify({"event":"pusher:subscribe","data":{"channel":"user_account_usd_trades"}}));
break;
case 'quoine:auth_failure':
console.log('Auth failed');
break;
case 'pusher_internal:subscription_succeeded':
console.log('Subscribed: ' + wsEvent.channel);
case 'updated':
console.log('Trades Updated: ', wsEvent.data);
}
}
Authentication is required for the following channels.
| Data | Channel | Event | Event Details |
|---|---|---|---|
| Price Book | price_ladders_${code}_${currency_pair_code} |
updated |
*Displays both bid and ask prices of the selected market. |
| Orders | user_account_${funding_currency}_orders |
updated |
|
| Trades | user_account_${funding_currency}_trades |
updated |
|
| Executions | user_executions_cash_${currency_pair_code} |
created |
|
Ping / Pong
It is the responsibility of the client to initiate the ping/pong event. The server will never ping the client.
const ws = new WebSocket('wss://tap.liquid.com/app/LiquidTapClient');
const tapPing = {
event: "pusher:ping",
data: { }
}
const tapPingPayload = JSON.stringify(tapPing);
setInterval(
() => (ws.send(tapPingPayload)),
60000
);
Note: When using the provided JS this section can be ignored.
LiquidTap requires some activity on the websocket every 120 seconds or it will forcibly close the connection. To ensure the connection doesn’t get closed, it is advisable to send a ping every 60 seconds. In the provided JS library this is taken care of through a local interval timer. However, when building a custom integration this will need to be taken into account.
Ping (Send every 60 seconds)
{"event":"pusher:ping","data":{}}
Pong (Server response)
{"event":"pusher:pong","data":{}}