NAV
javascript

About VccExchange API

VccExchange REST & Socket API version 3.0 provides programmatic access to Vcc Exchange’s next generation trading engine.

By using VccExchange API you confirm that you have read and accept API License Agreement

Development Guide

API URLs

Environment REST
PROD https://api.vcc.exchange/v3

Number Format

All finance data, i.e. price, quantity, fee etc., should be arbitrary precision numbers and string representation. Example: "0.000008".

Pagination

Parameters:

Parameter Description
page No The current page, default is page 1
limit The number of results per page, max is 1000
sort Sort direction. Accepted values: asc, desc. Default desc
start_date Filter by timestamp
end_date Filter by timestamp

HTTP Status codes

Code Meaning
200 OK Successful request
400 Bad Request. Returns JSON with the error message
401 Unauthorized. Authorisation required or failed
403 Forbidden. Action is forbidden for API key
422 Unprocessable Entity. Missing or wrong query parameters.
429 Too Many Requests. Your connection is being rate limited
500 Internal Server Error. It is important to NOT treat this as a failure operation; the execution status is UNKNOWN and could have been a success.
503 Service Unavailable. Service is down for maintenance
504 Gateway Timeout. Request timeout expired

Success response

{
    "message": "A localized message",
    "dataVersion":"6d72fb82a9c613c8166581a887e1723ce5a937ff",
    "data": {}
}
Name Type Description
message String Optional. Can be a meaningful localized message if needed
dataVersion String The current data version. You're supposed to cache this number in your end. If we change any settings such as fee, precision, ..., we will update this data version. Therefore, if your cached data version is outdated, you should fetch the settings again.
data JSON A JSON object or array representing the data

Error response

{
    "message": "The given data was invalid.",
    "errors": {
        "ticker_size": [
            "The ticker_size field is required."
        ]
    }
}
Name Type Description
message String A meaningful localized message describing the error
errors JSON Optional. A JSON object containing all errors

DateTime Format

All time and timestamp related fields, if not explicitly mentioned, are in milliseconds.

Best Practices

The VccExchange API development team strives to bring the best trading experience for our API users. Here is a set of best practices of using the API as efficiently as possible.

HTTP Persistent Connection

It keeps the underlying TCP connection active for multiple requests/responses. Subsequent requests will result in reduced latency as the TCP handshaking process is no longer required.

If you are using an HTTP 1.0 client, please ensure it supports the keep-alive directive and submit the header Connection: Keep-Alive with your request.

Keep-Alive is a part of the protocol in HTTP 1.1 and enabled by default on compliant clients. However, you will have to ensure your implementation does not set the connection header to other values.

Retrieving and updating account state

Use Socket API for real time updates of your orders and trades and any transactions changes.

Localization

We support multiple localization for response data, messages and errors. The default localization is Vietnamese, but you can change to English by appending a parameter lang=en to your query string or request body.

Market data

Summary

{
    "dataVersion": "6d72fb82a9c613c8166581a887e1723ce5a937ff",
    "data": {
        "eth_btc":{
            "last":"0.0218982400",
            "percentChange":"-0.15374823",
            "baseVolume":"4049.2067884300",
            "quoteVolume":"88.1722953402",
            "isFrozen":0,
            "high24hr":"0.0219552400",
            "low24hr":"0.0214194400",
            "lowestAsk":0.021867,
            "lowestAskQuantity": 1,
            "highestBid":0.021866,
            "highestBidQuantity": 1
        },
        "bch_btc":{
            "last":"0.0277999800",
            "percentChange":"-0.3432425",
            "baseVolume":"127.2833826800",
            "quoteVolume":"3.5654878326",
            "isFrozen":0,
            "high24hr":"0.0279250100",
            "low24hr":"0.0276800500",
            "lowestAsk":0.027795,
            "lowestAskQuantity": 1,
            "highestBid":0.027775,
            "highestBidQuantity": 1
        },
    }
}

GET /v3/summary

Overview of market data for all tickers

Response:

Name Type Description
last Number The last price
percentChange Number The changed percent compared to the last 24h price
baseVolume Number The volume of base currency
quoteVolume Number The volume of quote currency
isFrozen Number The trading status of this market pair, 0 means normal
high24hr Number The highest price in the last 24 hours
low24hr Number The lowest price in the last 24 hours
lowestAsk Number The lowest ask price in the current orderbook
lowestAskQuantity Number The order size of base currency at the lowest ask price
highestBid Number The lowest bid price in the current orderbook
highestBidQuantity Number The order size of base currency at the highest bid price

Assets

{
    "dataVersion": "6d72fb82a9c613c8166581a887e1723ce5a937ff",
    "data": {
        "BTC":{
            "name":"Bitcoin",
            "unified_cryptoasset_id":1,
            "can_withdraw":true,
            "can_deposit":true,
            "min_withdraw":"0.0020000000",
            "max_withdraw":"100.0000000000",
            "maker_fee":"0.002",
            "taker_fee":"0.002"
        },
        "ETH":{
            "name":"Ethereum",
            "unified_cryptoasset_id":1027,
            "can_withdraw":true,
            "can_deposit":true,
            "min_withdraw":"0.0400000000",
            "max_withdraw":"10000000.0000000000",
            "maker_fee":"0.002",
            "taker_fee":"0.002"
        },
    }
}

GET /v3/assets

The assets endpoint is to provide a detailed summary for each currency available on the exchange.

Response:

Name Type Description
name string Name of cryptocurrency.
unified_cryptoasset_id integer Unique ID of cryptocurrency assigned by Unified Cryptoasset ID.
can_withdraw boolean Identifies whether withdraws are enabled or disabled.
can_deposit boolean Identifies whether deposits are enabled or disabled.
min_withdraw decimal Identifies the single minimum withdraw amount of a cryptocurrency.
max_withdraw decimal Identifies the single maximum withdraw amount of a cryptocurrency.
maker_fee decimal Fees applied when liquidity is added to the order book.
taker_fee decimal Fees applied when liquidity is removed from the order book.

24hr ticker

{
    "dataVersion": "6d72fb82a9c613c8166581a887e1723ce5a937ff",
    "data": {
        "ETH_BTC":{
            "base_id":1027,
            "quote_id":1,
            "last_price":"0.0218771300",
            "base_volume":"4042.2638948900",
            "quote_volume":"87.9219942331",
            "isFrozen":0
        },
        "BCH_BTC":{
            "base_id":1831,
            "quote_id":1,
            "last_price":"0.0277999800",
            "base_volume":"125.8304726700",
            "quote_volume":"3.5022920492",
            "isFrozen":0
        },
    }
}

GET /v3/ticker

24-hour rolling window price change statistics for all markets.

Response:

Name Type Description
base_id integer The quote pair Unified Cryptoasset ID
quote_id integer The base pair Unified Cryptoasset ID
last_price decimal The price of the last executed order
base_volume decimal 24 hour trading volume in base pair volume
quote_volume decimal 24 hour trading volume in quote pair volume
isFrozen integer Indicates if the market is currently enabled (1) or disabled (0)

Orderbook

{
    "dataVersion":"6d72fb82a9c613c8166581a887e1723ce5a937ff",
    "data":{
        "bids": [
            [
                "7.1659000000",
                "150972000.0000000000"
            ]
          ],
          "asks": [
            [
                "9.1539000000",
                "150811000.0000000000"
            ]
          ],
          "timestamp": "1567495444451"
    }
}

GET /v3/orderbook/market_pair

The order book endpoint is to provide a complete level 2 order book (arranged by best asks/bids) with full depth returned for a given market pair. Example: GET /v3/orderbook/LTC_BTC

Parameters:

Name Mandatory Description
market_pair Yes A pair such as "LTC_BTC"
depth No Orders depth quantity:[0,5,10,20,50,100,500]. Not defined or 0 = full order book
level No Level 1 – Only the best bid and ask. Level 2 – Arranged by best bids and asks. Level 3 – Complete order book, no aggregation

Response:

Name Type Description
timestamp timestamp Unix timestamp in milliseconds for when the last updated time occurred
bids array An array containing 2 elements. The offer price and quantity for each bid order.
asks array An array containing 2 elements. The ask price and quantity for each ask order.

Recent Trades

{
    "dataVersion":"6d72fb82a9c613c8166581a887e1723ce5a937ff",
    "data":[
        {
            "trade_id":9073252,
            "price":"7987.1700000000",
            "base_volume":"0.0012402100",
            "quote_volume":"9.9057681057",
            "trade_timestamp":1570449570716,
            "type":"sell"
        },
        {
            "trade_id":9073209,
            "price":"7989.9881310500",
            "base_volume":"0.0097050000",
            "quote_volume":"77.5428348118",
            "trade_timestamp":1570449396865,
            "type":"buy"
        },
    ]
}

GET /v3/trades/market_pair

The trades endpoint is to return data on all recently completed trades for a given market pair.

Parameters:

Name Mandatory Description
market_pair Yes A pair such as LTC_BTC
type No Query buy side or sell side only.
count No Limit the number of trades to be returned. Default is 500, max is 1000

Response:

Name Type Description
trade_id integer A unique ID associated with the trade for the currency pair transaction. Note: Unix timestamp does not qualify as trade_id.
price decimal Transaction price in base pair volume.
base_volume decimal Transaction amount in base pair volume.
quote_volume decimal Transaction amount in quote pair volume.
trade_timestamp timestamp Unix timestamp in milliseconds for when the transaction occurred.
type string Used to determine whether or not the transaction originated as a buy or sell. Buy – Identifies an ask was removed from the order book. Sell – Identifies a bid was removed from the order book.

Tick Sizes

{
    "dataVersion":"6d72fb82a9c613c8166581a887e1723ce5a937ff",
    "data":[
        {
            "coin": "btc",
            "currency": "vnd",
            "value": "100.0000000000",
            "unit": "M"
        },
        {
            "coin": "btc",
            "currency": "vnd",
            "value": "1000.0000000000",
            "unit": "M"
        },
        {
            "coin": "xrp",
            "currency": "btc",
            "value": "0.0000100000",
            "unit": "N/A"
        },
        {
            "coin": "xrp",
            "currency": "btc",
            "value": "0.0000010000",
            "unit": "N/A"
        }
    ]
}

GET /v3/tick_sizes

Return tick sizes for grouping the orderbook.

Response:

Name Type Description
coin String The base currency
currency String The quote currency
value String The intervals that a price can be increased/decreased by
unit String Can be N/A, M or K. It is the unit of the price to be displayed in orderbook. N/A can be ignored, K for thousands, M for millions.

Authentication

Public market data available without authentication, for other requests authentication is required.

API Key

curl -H "Authorization: Bearer <API_KEY>" https://api.vcc.exchange/v3/authenticated-endpoint

You should create API keys on VccExchange API Setting page. Then, you will receive a secret key and an api key. Your application's API consumers should specify the api key as a Bearer token in the Authorization header of their request.

API Timestamp

var timestamp = new Date().getTime();

You should add a header named timestamp with the current time as a UNIX timestamp, in epoch-millisecond format. Example: timestamp: 1542323450014

Generate Signature (HMAC SHA256)

var payload = 'GET v3/authenticated-endpoint?a=1&b[0]=foo';
var signature = CryptoJS.HmacSHA256(payload, apiSecret).toString(CryptoJS.enc.Hex);

Each request should add a header parameter named signature. It is a SHA256 hash of the request contents, Hex-encoded of secret key and payload. Where payload is a string formed from the following items and concatenating them together:

Once you have created this payload string, sign it via HmacSHA256, using your api secret as the signing secret. Hex-encode the result of this operation and add a parameter named signature to your request's header.

curl -H "Authorization: Bearer <API_KEY>" \
     -H "timestamp: 1542323450014" \
     -H "signature: 2ee2595b5f72e2e591ac3dbe95daf65c0d4acb6bb61d79d3316fd54576ec0669" \
     "https://api.vcc.exchange/v3/authenticated-endpoint?a=1&b[0]=foo"

Finally, your request would look something like this

Get current user

GET /v3/user (HMAC SHA256)

Retrieve information of current logged in user.

{  
   "dataVersion":"1270c22bb030d271529e5f1745413c9d2c8df5ff",
   "data": {  
      "id": 1,
      "name": "Tommy",
      "email": "[email protected]",
      "status": "active",
      "created_at": 1562145127794,
      "updated_at": 1562145127794
   }
}

Response:

Name Type Description
id Number The unique user id
name String The user name
email String The valid user email
status String The account status which can be active or inactive
created_at Number The UNIX timestamp this order is created in epoch-millisecond format.
updated_at Number The UNIX timestamp this order is updated in epoch-millisecond format.

Trading

Exchange information

Current exchange trading rules and symbol information

{
    "dataVersion": "6d72fb82a9c613c8166581a887e1723ce5a937ff",
    "data": [
        {
            "coin": "trx",
            "currency": "eth",
            "base_precision": "1.0000000000",
            "quote_precision": "0.0000000100",
            "minimum_quantity": "30.0000000000",
            "minimum_amount": "0.0200000000"
        },
        {
            "coin": "xmr",
            "currency": "eth",
            "base_precision": "0.0010000000",
            "quote_precision": "0.0000000100",
            "minimum_quantity": "0.0150000000",
            "minimum_amount": "0.0200000000"
        }
    ]
}

GET /v3/exchange_info

Current exchange trading rules and symbol information.

Response:

Name Type Description
coin String The base currency
currency String The quote currency
base_precision Number The precision of base currency
quote_precision Number The precision of quote currency
minimum_quantity Number The minimum quantity for a order
minimum_amount Number The minimum amount of the total order size

Create a new order

{
    "trade_type":"sell",
    "type":"limit",
    "quantity":"1",
    "price":"14.99",
    "currency":"usdt",
    "coin":"neo",
    "is_stop": "1",
    "stop_price": "13",
    "stop_condition": "ge"
}

POST /v3/orders (HMAC SHA256)

You should checkout the exchange info api to know about the conditions required for making new order.

Parameters:

Name Mandatory Description
trade_type Yes Trade side which is buy or sell
type Yes Order type which is limit or market or ceiling_market. Buy market order is only supported for VND pairs.
quantity No Required if the type is market or limit, not required if the type is ceiling_market. Quantity of base currency.
ceiling No Required if the type is ceiling_market, not required if the type is market or limit. This is the amount of quote currency that you wanna use for your order. For example, I wanna use 100 USDT to buy ETH with market price. At this moment, we only support ceiling market order for buying crypto-crypto pairs.
price No Price of order. Required for limit order
currency Yes Quote currency
coin Yes Base currency
is_stop No 1 if this is a stop order, 0 otherwise
stop_price No The trigger price. Required for stop order
stop_condition No Required for stop order, can be ge (greater than or equal) or le (less than or equal)
{
    "dataVersion":"d9b1159d2bcefa2388be156e32ddc7cc324400ee",
    "data":{
        "id":41230,
        "trade_type":"sell",
        "type":"limit",
        "quantity":"1",
        "price":"14.99",
        "currency":"usdt",
        "coin":"neo",
        "status":"pending",
        "is_stop": "1",
        "stop_price": "13",
        "stop_condition": "ge",
        "fee":0,
        "created_at":1560244052168,
        "updated_at":1560244052168
    }
}

Response:

Name Type Description
id Number The order unique id
trade_type String Trade side which is buy or sell
type String limit or market
quantity Number The quantity of base currency
price Number Price of order
currency String The quote currency
coin String The base currency
status String The current order status which can be pending, executing, executed or canceled
fee Number The commission of this order has been executed so far. Fee is always calculated in quote currency
is_stop Number 1 if this is a stop order, 0 otherwise
stop_price Number The trigger price
stop_condition String The trigger condition which is ge or le
created_at Number The UNIX timestamp this order is created in epoch-millisecond format.
updated_at Number The UNIX timestamp this order is updated in epoch-millisecond format.

Get an order

GET /v3/orders/{order_id} (HMAC SHA256)

Retrieve information on a specific order.

Parameters:

Name Mandatory Description
order_id Yes The unique id of order which was returned during creation
{
    "dataVersion":"d9b1159d2bcefa2388be156e32ddc7cc324400ee",
    "data":{
        "id":410,
        "trade_type":"sell",
        "currency":"usdt",
        "coin":"neo",
        "type":"limit",
        "quantity":"1.0000000000",
        "price":"14.9900000000",
        "executed_quantity":"0.0000000000",
        "executed_price":"0.0000000000",
        "is_stop": "1",
        "stop_price": "13",
        "stop_condition": "ge",
        "fee":"0.0000000000",
        "status":"pending",
        "created_at":1560244052168,
        "updated_at":1560244052168
    }
}

Response:

Name Type Description
id Number The order unique id
trade_type String Trade side which is buy or sell
type String At this moment, only limit order is supported
quantity Number The quantity of base currency
price Number Price of order
currency String The quote currency
coin String The base currency
executed_quantity Number The amount of base currency that was executed so far
executed_price String The actually executed price
status String The current order status which can be pending, executing, executed or canceled
is_stop Number 1 if this is a stop order, 0 otherwise
stop_price Number The trigger price
stop_condition String The trigger condition which is ge or le
fee Number The commission of this order has been executed so far. Fee is always calculated in quote currency
created_at Number The UNIX timestamp this order is created in epoch-millisecond format.
updated_at Number The UNIX timestamp this order is updated in epoch-millisecond format.

Get open orders

{
    "trade_type":"sell",
    "start_date":1556643600000,
    "end_date":1560358799999,
    "currency":"usdt",
    "page":1,
    "limit": 10
}

GET /v3/orders/open (HMAC SHA256)

Return the list of open orders with pagination

Parameters:

Name Mandatory Description
page No The current page, default is page 1
limit No The number of results per page, max is 1000
start_date No To filter orders created after this epoch-millisecond timestamp
end_date No To filter orders created before this timestamp
currency No Quote currency
coin No Base currency
trade_type No Trade side which is buy or sell
{
    "dataVersion":"6d72fb82a9c613c8166581a887e1723ce5a937ff",
    "data":{
        "current_page":1,
        "data":[
            {
                "id":410,
                "trade_type":"sell",
                "currency":"usdt",
                "coin":"neo",
                "type":"limit",
                "quantity":"1.0000000000",
                "price":"14.9900000000",
                "executed_quantity":"0.0000000000",
                "executed_price":"0.0000000000",
                "fee":"0.0000000000",
                "status":"pending",
                "created_at":1560244052168,
                "updated_at":1560244052168
            }
        ],
        "first_page_url":"https:\/\/api.vcc.exchange\/v3\/orders\/pending?page=1",
        "from":1,
        "last_page":1,
        "last_page_url":"https:\/\/api.vcc.exchange\/v3\/orders\/pending?page=1",
        "next_page_url":null,
        "path":"https:\/\/api.vcc.exchange\/v3\/orders\/pending",
        "per_page":"10",
        "prev_page_url":null,
        "to":1,
        "total":1
    }
}

Response: An array of orders with pagination information

Cancel an order

{
    "dataVersion":"d9b1159d2bcefa2388be156e32ddc7cc324400ee",
    "data":{
        "id":410,
        "trade_type":"sell",
        "currency":"usdt",
        "coin":"neo",
        "type":"limit",
        "quantity":"1.0000000000",
        "price":"14.9900000000",
        "executed_quantity":"0.0000000000",
        "executed_price":"0.0000000000",
        "fee":"0.0000000000",
        "status":"canceled",
        "created_at":1560244052168,
        "updated_at":1560244052168
    }
}

PUT /v3/orders/{order_id}/cancel (HMAC SHA256)

Cancel an open order.

Name Mandatory Description
order_id Yes The unique id of order which was returned during creation

Response: The canceled order

{
    "message": "Order has been filled"
}

Error: If the order is not open, (executed or canceled), you will get an error with HTTP status code 400

Cancel multiple orders

{
    "type" : "limit"
}

Cancel open orders by type

PUT /v3/orders/cancel-by-type (HMAC SHA256)

Name Mandatory Description
type Yes The order type you want to be canceled. Supported type: limit, stop_limit
{
    "dataVersion":"6d72fb82a9c613c8166581a887e1723ce5a937ff",
    "data":{
        "data":[
            {
                "id":410,
                "trade_type":"sell",
                "currency":"usdt",
                "coin":"neo",
                "type":"limit",
                "quantity":"1.0000000000",
                "price":"14.9900000000",
                "executed_quantity":"0.0000000000",
                "executed_price":"0.0000000000",
                "fee":"0.0000000000",
                "status":"canceled",
                "created_at":1560244052168,
                "updated_at":1560244052168
            }
        ]
    }
}

Cancel all open orders

PUT /v3/orders/cancel-all (HMAC SHA256)

Response: Both of the above requests will response an array of canceled orders. In case there is no open order, an empty array will be returned.

Order history

{
    "trade_type":"sell",
    "start_date":1556643600000,
    "end_date":1560358799999,
    "currency":"usdt",
    "page":1,
    "limit": 10
}

GET /v3/orders (HMAC SHA256)

Get non-open orders including executed, executing (partially filled) and canceled with pagination. This end point doesn't include the open orders.

Parameters:

Name Mandatory Description
page No The current page, default is page 1
limit No The number of results per page, max is 1000
start_date No To filter orders updated_at after this epoch-millisecond timestamp
end_date No To filter orders updated_at before this timestamp. start_date and end_date must be submitted together
currency No Quote currency
coin No Base currency
trade_type No Trade side which is buy or sell
hide_canceled No Set it to 1 to exclude canceled orders.
{
    "dataVersion":"6d72fb82a9c613c8166581a887e1723ce5a937ff",
    "data":{
        "current_page":1,
        "data":[
            {
                "id":410,
                "trade_type":"sell",
                "currency":"usdt",
                "coin":"neo",
                "type":"limit",
                "quantity":"1.0000000000",
                "price":"14.9900000000",
                "executed_quantity":"0.0000000000",
                "executed_price":"0.0000000000",
                "fee":"0.0000000000",
                "status":"canceled",
                "created_at":1560244052168,
                "updated_at":1560244052168
            }
        ],
        "first_page_url":"https:\/\/api.vcc.exchange\/v3\/orders?page=1",
        "from":1,
        "last_page":1,
        "last_page_url":"https:\/\/api.vcc.exchange\/v3\/orders?page=1",
        "next_page_url":null,
        "path":"https:\/\/api.vcc.exchange\/v3\/orders",
        "per_page":"10",
        "prev_page_url":null,
        "to":1,
        "total":1
    }
}

Response: An array of orders with pagination information

User Trades History

{
    "trade_type":"sell",
    "start_date":1556643600000,
    "end_date":1560358799999,
    "currency":"usdt",
    "page":1,
    "limit": 10
}

GET /v3/orders/trades (HMAC SHA256)

Return trades history

Parameters:

Name Mandatory Description
page No The current page, default is page 1
limit No The number of results per page, max is 1000
start_date No To filter orders created_at after this epoch-millisecond timestamp
end_date No To filter orders created_at before this timestamp
currency No Quote currency
coin No Base currency
trade_type No Trade side which is buy or sell
{
    "dataVersion":"7ee12aeac98264ea7f4a731bf38741e0b38aea93",
    "data":{
    "current_page":1,
    "data":[
            {
                "trade_type":"sell",
                "fee":"0.0284700000",
                "created_at":1557625985566,
                "currency":"usdt",
                "coin":"neo",
                "price":"9.4900000000",
                "quantity":"1.0000000000",
                "amount":"9.4900000000"
            }
        ],
        "first_page_url":"https:\/\/api.vcc.exchange\/v3\/orders\/trades?page=1",
        "from":1,
        "last_page":1,
        "last_page_url":"https:\/\/api.vcc.exchange\/v3\/orders\/trades?page=1",
        "next_page_url":null,
        "path":"https:\/\/api.vcc.exchange\/v3\/orders\/trades",
        "per_page":"10",
        "prev_page_url":null,
        "to":1,
        "total":1
    }
}

Response:

Name Type Description
trade_type String Trade side which is buy or sell
quantity Number The quantity of base currency
price Number Price of trade
currency String The quote currency
coin String The base currency
fee Number The commission of this trade. Fee is always calculated in quote currency
created_at Number The UNIX timestamp this trade is executed in epoch-millisecond format

Wallets

Deposit Address

{
    "dataVersion":"6d72fb82a9c613c8166581a887e1723ce5a937ff",
    "data":{
        "status": "REQUESTED",
        "blockchain_address": "",
        "currency": "btc"
    }
}
{
    "dataVersion":"6d72fb82a9c613c8166581a887e1723ce5a937ff",
    "data":{
        "status": "PROVISIONED",
        "blockchain_address": "rPVMhWBsfF9iMXYj3aAzJVkPDTFNSyWdKy",
        "blockchain_tag": "920396135",
        "currency": "xrp"
    }
}

GET /v3/deposit-address (HMAC SHA256)

Return deposit address for given crypto assest. Some addresses takes a while to generate, so on the first call you may get an empty address with REQUESTED status. After the address generation process completed, a call to this endpoint will return the correct address with "PROVISIONED" status. The blockchain_tag is not always available.

Responses:

Name Description
status String REQUESTED or PROVISIONED
blockchain_address String Deposit address if provisioned
blockchain_tag String The address tag/memo/info, only available for certain blockchains
currency String the requested currency

Balance

{
    "dataVersion":"6d72fb82a9c613c8166581a887e1723ce5a937ff",
    "data":{
        "btc":{
            "balance":"97.7898000000",
            "available_balance":"89.7898000000"
        },
        "eth":{
            "balance":"0.0000000000",
            "available_balance":"0.0000000000"
        },
        "usdt":{
            "balance":"9.4615300000",
            "available_balance":"0.0087966200"
        }
    }
}

GET /v3/balance (HMAC SHA256)

Return wallet balances. It's not in the form of an array, but actually a dictionary (JSON object) with key is the coin name.

Responses:

Name Description
balance Number Total balance
available_balance Number Avaiable balance

Deposit and withdrawal history

GET /v3/transactions (HMAC SHA256)

Return deposit/withdrawal history.

Parameters:

Name Mandatory Description
type Yes Can be deposit or withdraw
currency String Filter only transaction of certain coin
start Number Start timestamp
end Number End timestamp

Deposit History

{
    "dataVersion":"6d72fb82a9c613c8166581a887e1723ce5a937ff",
    "data":{
        "current_page":1,
        "data":[
            {
                "id":1,
                "transaction_id":"0x02bf975ed9048f0167dbf0a23e8ce5c23927ac57c2d792d229ec172bcc79fda9",
                "currency":"neo",
                "amount":"4.0000000000",
                "fee":"0.0000000000",
                "confirmation":16,
                "status":"success",
                "blockchain_address":"APoCB8RKphD7G61V5dt2WGGx9NNo9ZCT19",
                "destination_tag":null,
                "error_detail":null,
                "created_at":1557134402735,
                "updated_at":1557134402735
            }
        ],
        "first_page_url":"https:\/\/api.vcc.exchange\/v3\/transactions?page=1",
        "from":1,
        "last_page":1,
        "last_page_url":"https:\/\/api.vcc.exchange\/v3\/transactions?page=1",
        "next_page_url":null,
        "path":"https:\/\/api.vcc.exchange\/v3\/transactions",
        "per_page":"13",
        "prev_page_url":null,
        "to":1,
        "total":1
    }
}

Withdrawal History

{
    "dataVersion":"6d72fb82a9c613c8166581a887e1723ce5a937ff",
    "data":{
        "current_page":1,
        "data":[
            {
                "id":79,
                "transaction_id":"0x5bf3e770a65c8b912bb9e8dcc559838dbe1a928d2103b7387aa80ef1b547cbb3",
                "currency":"neo",
                "amount":"-1.0000000000",
                "fee":"0.0250000000",
                "confirmation":0,
                "status":"success",
                "blockchain_address":"AchKtYxobubZDqCnixxG3ktBP2oKej4FW1",
                "destination_tag":null,
                "error_detail":null,
                "created_at":1560496372348,
                "updated_at":1560496372348
            }
        ],
        "first_page_url":"https:\/\/api.vcc.exchange\/v3\/transactions?page=1",
        "from":1,
        "last_page":1,
        "last_page_url":"https:\/\/api.vcc.exchange\/v3\/transactions?page=1",
        "next_page_url":null,
        "path":"https:\/\/api.vcc.exchange\/v3\/transactions",
        "per_page":"13",
        "prev_page_url":null,
        "to":1,
        "total":1
    }
}

Response:

Name Type Description
currency String The coin of this transaction
amount Number The deposit/withdraw amount
blockchain_address String The blockchain address to receive coin
destination_tag String The tag/memo required for certain coins such as XRP, XLM, XMR
status String Status of this transaction. It can be pending, error, success, cancel
created_at Number The timestamp this transaction is submitted/acknowledge
updated_at Number The timestamp this transaction is updated
fee Number The fee of this transaction. Deposit is free
id Number The unique id of this withdrawal request
confirmation Number The number of network confirmations so far
error_detail String Explanation of the error if any

Socket

You must emit a subscribe event to our Socket server to join the channel before listen to any event. With private channel, you need to authorize via Bearer token using the api_key retrieved from VccExchange API Setting page.

Hosts

Environment REST
PROD wss://socket.vcc.exchange:6001

Join Channel

Emit subscribe event to request join in the channel. With channel name like private-App.User.{user_id}, {user_id} can get from this api.

Join Channel With Socket.io Client

const io = require('socket.io-client');
const socket = io('wss://socket.vcc.exchange:6001');

const API_KEY = '';
const CHANNEL = 'private-App.User.1';
const EVENT = 'App\\Events\\BalanceUpdated';

socket.on('disconnect', function () {
    console.log('disconnected');
});
socket.on('reconnect', function () {
    console.log('reconnect');
});
socket.on('reconnect_error', function () {
    console.log('reconnect error');
});
socket.on('connect', function () {
    console.log('connected');
    socket.emit('subscribe', {
        channel: CHANNEL,
        auth: {
            headers: {'Authorization': `Bearer ${API_KEY}`}
        }
    }).on(EVENT, function(channel, data) {
        console.log(data);
    });
});

Parameters:

Name Mandatory Description
channel Yes Name of channel want to join
auth No Required for private channel

OrderBook Updated

Public channel App.OrderBook.{COIN}{CURRENCY}

Event App\Events\OrderBookUpdated

{
    "data": {
        "buy": [
            {
                "price": 0.021232,
                "quantity": "73.910"
            },
            {
                "price": 0.021039,
                "quantity": "1.418"
            }
        ],
        "sell": [
            {
                "price": 0.02125,
                "quantity": "15.396"
            },
            {
                "price": 0.021403,
                "quantity": "0.046"
            }
        ],
        "meta": {
            "is_full_orderbook": true,
            "updated_at": 1567495444451
        }
    }
}

Response:

Name Type Description
currency String The quote currency
coin String The base currency
is_full_orderbook Boolean true is whole order book otherwise is only changed part
price Number Price of order
quantity Number The quantity of base currency. Quantity is 0 means that this price is removed from the orderbook

Balance Updated

Private channel private-App.User.{user_id}

Event App\Events\BalanceUpdated

Return wallet balances.

{
    "data": {
        "vnd": {
            "balance": "326822650895.0000000000",
            "available_balance": "326822650895.0000000000"
        },
        "xrp": {
            "balance": "9950.1030000000",
            "available_balance": "9950.1030000000",
            "blockchain_address": null,
            "blockchain_tag": ""
        }
    }
}

Response:

Name Type Description
balance Number Total balance
available_balance Number Avaiable balance
blockchain_address String Deposit address if any or null if not requested
destination_tag String The tag/memo required for certain coins such as XRP, XLM, XMR

Transaction Created

Private channel private-App.User.{user_id}

Event App\Events\TransactionCreated

This event is fired whenever there's new or UPDATED deposit/withdrawal transaction.

{
    "data": {
        "transaction_id": "32ec95ed-207c-404d-85bb-9081455c3b53",
        "currency": "vnd",
        "amount": "79.8850000000",
        "fee": "0.0000000000",
        "confirmation": 0,
        "status": "success",
        "blockchain_address": null,
        "destination_tag": null,
        "error_detail": null,
        "created_at": 1563181009961,
        "updated_at": 1563181009961
    }
}

Response:

Name Type Description
transaction_id Number The unique id of this transaction
currency String The coin of this transaction
amount Number The deposit/withdraw amount
fee Number The fee of this transaction. Deposit is free
confirmation Number The number of network confirmations so far
status String Status of this transaction. It can be pending, error, success, cancel
blockchain_address String The blockchain address to receive coin
destination_tag String The tag/memo required for certain coins such as XRP, XLM, XMR
error_detail String Explanation of the error if any
created_at Number The timestamp this transaction is submitted/acknowledge
updated_at Number The timestamp this transaction is updated

Order Changed

Private channel private-App.User.{user_id}

Event App\Events\OrderChanged. This event is fired when an order is created, filled or canceled.

{
    "data": {
        "id": 410,
        "trade_type": "sell",
        "currency": "usdt",
        "coin": "neo",
        "type": "limit",
        "quantity": "1.0000000000",
        "price": "14.9900000000",
        "executed_quantity": "0.0000000000",
        "executed_price": "0.0000000000",
        "fee": "0.0000000000",
        "status": "canceled",
        "created_at": 1560244052168,
        "updated_at": 1560244052168
    }
}

Response:

Name Type Description
id Number The order unique id
trade_type String Trade side which is buy or sell
type String At this moment, only limit order is supported
quantity Number The quantity of base currency
price Number Price of order
currency String The quote currency
coin String The base currency
executed_quantity Number The amount of base currency that was executed so far
executed_price String The avarage executed price
status String The current order status which can be pending, executing, executed or canceled
fee Number The commission of this order has been executed so far. Fee is always calculated in quote currency
created_at Number The UNIX timestamp this order is created in epoch-millisecond format.
updated_at Number The UNIX timestamp this order is updated in epoch-millisecond format.

Trades Created

Public channel App.Trades.{COIN}{CURRENCY}

Event App\Events\TradesCreated

This event is fired whenever there are new trades getting filled in the market.

{
    "data": [
        {
            "id": 1,
            "buy_order_id": 8,
            "sell_order_id": null,
            "currency": "btc",
            "coin": "bch",
            "price": "0.0369530000",
            "quantity": "0.0140000000",
            "amount": "0.0005173420",
            "created_at": 1562145452570,
            "buy_fee": "0.0000015520",
            "sell_fee": null,
            "transaction_type": "buy"
        },
        {
            "id": 1,
            "buy_order_id": 9,
            "sell_order_id": null,
            "currency": "btc",
            "coin": "bch",
            "price": "0.0369530000",
            "quantity": "0.0140000000",
            "amount": "0.0005173420",
            "created_at": 1562145452570,
            "buy_fee": "0.0000015520",
            "sell_fee": null,
            "transaction_type": "buy"
        }
    ]
}

Response:

Name Type Description
id Number The unique id of this trade
buy_order_id Number The id of buy order
sell_order_id Number The id of sell order
currency String The quote currency
coin String The base currency
price Number Price of the trade
quantity Number The quantity of base currency
amount Number The volume of this single trade which is price multipled by quantity
created_at Number The UNIX timestamp this order is created in epoch-millisecond format.
buy_fee Number The commission of this trade for buyer. Fee is always calculated in quote currency
sell_fee Number The commission of this trade for seller. Fee is always calculated in quote currency
transaction_type String The type of transaction, can be buy or sell