API Documentation

Public HTTP API Methods

The public HTTP API allows read access to public market data.

Public endpoint is: `http://extstock.com`

There are public methods, all of which take HTTP GET requests and Returns output in JSON format. No authentication is necessary but you must not excessively use any API endpoint.

Returns the details of cryptocurrencies available on the exchange.

Parameters: NONE

Response:

{
    "success":true,
    "data":{
        "BTC":{
            "name":"Bitcoin",
            "unified_cryptoasset_id":1,
            "can_deposit":true,
            "can_withdraw":true,
            "min_withdraw":"0.001",
            "max_withdraw":"100",
            "fee_withdraw":"0.0005",
            "maker_fee":"0.01",
            "taker_fee":"0.01"
        },
        "BCH":{
            "name":"Bitcoin Cash",
            "unified_cryptoasset_id":1831,
            "can_deposit":true,
            "can_withdraw":true,
            "min_withdraw":"0.01",
            "max_withdraw":"3500",
            "fee_withdraw":"0.001",
            "maker_fee":"0.01",
            "taker_fee":"0.01"
        }
    }
}

Fields include:

name: Name of cryptocurrency;
unified_cryptoasset_id: Unique ID of cryptocurrency assigned by​ ​Unified Cryptoasset ID​;
can_deposit: Identifies whether deposits are enabled or disabled;
can_withdraw: Identifies whether withdraws are enabled or disabled;
fee_withdraw: Withdrawal fee;
maker_fee: Fees applied when liquidity is added tothe order book;
taker_fee: Fees applied when liquidity is removed from the order book.

Returns the 24-hour volume totals for primary currencies.

Parameters: NONE

Response:

{
    "success":true,
    "data":{
        "USD":{
            "name":"US Dollar",
            "volume":"39561218.92433189"
        },
        "EUR":{
            "name":"Euro",
            "volume":"35361215.92662964"
        },
        "BTC":{
            "name":"Bitcoin",
            "volume":"4259.30107242"
        },
        "ETH":{
            "name":"Ethereum",
            "volume":"214375.15982849"
        },
        "LTC":{
            "name":"Litecoin",
            "volume":"670673.69243124"
        },
        "BCH":{
            "name":"Bitcoin Cash",
            "volume":"137425.44647751"
        }
    }
}

Fields include:

name: Name of cryptocurrency;
volume: 24-hour volume currencies.

Returns the summary information for each currency pair listed on the exchange.

Parameters: NONE

Response:

{
    "success":true,
    "data":{
        "BTC_USD":{
            "base_id":1,
            "quote_id":null,
            "last_price":"8182.72000000",
            "percent_change":"0.00000000",
            "base_volume":"0.00000000",
            "quote_volume":"0.00000000",
            "is_frozen":0,
            "high":"0.00000000",
            "low":"0.00000000"
        },
        "BCH_BTC":{
            "base_id":1831,
            "quote_id":1,
            "last_price":"0.02714877",
            "percent_change":"0.00000000",
            "base_volume":"0.00000000",
            "quote_volume":"0.00000000",
            "is_frozen":0,
            "high":"0.00000000",
            "low":"0.00000000"
        }
    }
}

Fields include:

base_id: The quote pair ​Unified Cryptoasset ID​;
quote_id: The base pair ​Unified Cryptoasset ID​;
last_price: The price of the last executed order;
percent_change: Price change percentage;
base_volume: 24 hour trading volume in base pair volume;
quote_volume: 24 hour trading volume in quote pair volume;
is_frozen: Indicates if this market is currently trading or not;
high: Highest current sale price for this asset;
low: Lowest current purchase price for this asset.

Returns the order book for a given market.

Parameters:

pair: Trading pair;
limit: (optional) Orders limit quantity.

Response:

{
    "success":true,
    "data":{
        "timestamp":1572426504,
        "bids":[
            [
                "9207.08000000",
                "0.27999415"
            ],
            [
                "9205.57000000",
                "1.19682307"
            ]
        ],
        "asks":[
            [
                "9215.59000000",
                "0.02860000"
            ],
            [
                "9218.78000000",
                "0.86628000"
            ]
        ]
    }
}

Fields include:

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

Returns the recent trades.

Parameters:

pair: Trading pair;
limit: (optional) Trades limit quantity.

Response:

{
    "success":true,
    "data":[
        {
            "trade_id":41565600,
            "price":"9207.08000000",
            "base_volume":"0.00044400",
            "quote_volume":"4.08794352",
            "trade_timestamp":1572426668,
            "type":"buy"
        },
        {
            "trade_id":41565599,
            "price":"9207.95000000",
            "base_volume":"0.01700000",
            "quote_volume":"156.53515000",
            "trade_timestamp":1572426668,
            "type":"buy"
        }
    ]
}

Fields include:

trade_id: The unique ID associated with this trade;
price: Transaction price in base pair volume;
base_volume: Transaction amount in base pair volume;
quote_volume: Transaction amount in quote pair volume;
trade_timestamp: Unix timestamp in milliseconds for when the transaction occurred;
type: Used to determine whether or not the transaction originated as a buy or sell.

Returns candlestick chart data.

pair: Trading pair;
period: (optional) Candlestick period in minutes. Valid values are 5, 15, 30, 120, 240, and 1440.

Response:

{
    "success":true,
    "data":[
        {
            "open":"11621.72000000",
            "close":"11650.04000000",
            "high":"11650.04000000",
            "low":"11617.69000000",
            "volume":"3.54253551",
            "timestamp":1561793100
        }
    ]
}

Fields include:

open: The price for this asset at the start of the candle;
close: The price for this asset at the end of the candle;
high: Transaction amount in base pair volume;
low: The lowest price for this asset within this candle;
volume: The total amount of this asset transacted within this candle;
timestamp: The UTC date for this candle in miliseconds since the Unix epoch.

Returns current server time.

Parameters: NONE

Response:

{
    "success":true,
    "data":{
        "timestamp":1572424862
    }
}

Fields include:

timestamp: Server time.

Private HTTP API Methods

The private HTTP API allows read / write access to your private account.

Private endpoint is: `http://extstock.com`

All calls to the trading API are sent via HTTP using POST parameters to http://extstock.com and must contain the following headers:

  • x-api-key: Your PUBLIC key;
  • x-api-signature: HMAC-generated request signature; *
  • x-api-tonce: Timestamp in integer, stands for milliseconds elapsed since Unix epoch. Tonce must be within 30 seconds of server's current time. Each tonce can only be used once.
* In order to sign the request, one should perform HMAC-SHA512 with the following parameters:
  • privateKey: Your PRIVATE key.
  • message: The result of concatenation path + tonce + body, where path is a URL-path of the request with parameters, e.g. /api/v2/trading/balances, tonce is a value passed in x-api-tonce header, body is a request body

All responses from the trading API are in JSON format.

Returns all of your balances available for trade.

Parameters: NONE

Response:

{
    "success":true,
    "data":{
        "USD":{
            "name":"US Dollar",
            "can_deposit":true,
            "can_withdraw":true,
            "available":"0.00000000",
            "on_orders":"0.00000000"
        },
        "BTC":{
            "name":"Bitcoin",
            "can_deposit":true,
            "can_withdraw":true,
            "available":"0.00000000",
            "on_orders":"0.00000000"
        }
    }
}

Fields include:

name: Name of cryptocurrency;
can_deposit: Identifies whether deposits are enabled or disabled;
can_withdraw: Identifies whether withdraws are enabled or disabled;
available: Number of coins not reserved in orders;
on_orders: Number of coins in open orders.

Returns coin of your balances available for trade .

Parameters:

coin: Coin symbol.

Response:

{
    "success":true,
    "data":{
        "BTC":{
            "name":"Bitcoin",
            "can_deposit":true,
            "can_withdraw":true,
            "available":"0.00000000",
            "on_orders":"0.00000000"
        }
    }
}

Fields include:

name: Name of cryptocurrency;
can_deposit: Identifies whether deposits are enabled or disabled;
can_withdraw: Identifies whether withdraws are enabled or disabled;
available: Number of coins not reserved in orders;
on_orders: Number of coins in open orders.

Returns your open orders.

Parameters:

pair: Trading pair.

Response:

{
    "success":true,
    "data":[
        {
            "order_id":4,
            "pair":"ETH_BTC",
            "type":"sell",
            "price":"1.00000000",
            "amount":"1.00000000",
            "total":"1.00000000",
            "filled":"0.00",
            "status":"open",
            "timestamp":1574339812
        }
    ]
}

Fields include:

order_id: Name of cryptocurrency;
pair: Trading pair;
type: Type order;
price: The purchase price in this order;
amount: The amount in this order;
total:The total amount in this order;
filled: Fullness percent;
status: Status order;
timestamp: Order creation time.

Returns order creation history.

Parameters:

pair: (optional) Trading pair;
type: (optional) Type order;
status: (optional) Status order;

Response:

{
    "success":true,
    "data":[
        {
            "order_id":4,
            "pair":"ETH_BTC",
            "type":"sell",
            "price":"1.00000000",
            "amount":"1.00000000",
            "total":"1.00000000",
            "filled":"0.00",
            "status":"open",
            "timestamp":1574339812
        }
    ]
}

Fields include:

order_id: Name of cryptocurrency;
pair: Trading pair;
type: Type order;
price: The purchase price in this order;
amount: The amount in this order;
total:The total amount in this order;
filled: Fullness percent;
status: Status order;
timestamp: Order creation time.

Places an order.

Parameters:

pair: Trading pair;
type: The type by which this order is executed;
price: The purchase price in this order;
amount: The total amount in this order.

Response:

{
    "success":true,
    "data":"Order 3 placed"
}

Cancels an order you have placed.

Parameters:

order_id: The identity number of the order to be canceled.

Response:

{
    "success":true,
    "data":"Order canceled"
}

Returns your trade history.

Parameters:

pair: (optional) Trading pair;
type: (optional) Type at which this trade executed.

Response:

{
    "success":true,
    "data":[
        {
            "trade_id":1,
            "pair":"ETH_BTC",
            "type":"buy",
            "price":"1.00000000",
            "amount":"1.00000000",
            "total":"1.00000000",
            "timestamp":1572937734
        }
    ]
}

Fields include:

trade_id: The unique ID associated with this trade;
pair: Trading pair;
type: Used to determine whether or not the transaction originated as a buy or sell;
price: Transaction price in base pair volume;
amount: Transaction amount in base pair volume;
total: The total cost;
timestamp: Unix timestamp in milliseconds for when the transaction occurred.

Examples

const request = require('request');
const apiHost = 'https://extstock.com';

var path = '/api/v2/assets';

var body = {

};

var form = JSON.stringify(body);

request({
    headers: {
        'Content-Type': 'application/json',
    },
    uri: apiHost + path,
    body: form,
    method: 'GET'
    },
    function (error, response, body) {
        console.log('error:', error);
        console.log('statusCode:', response.statusCode);
        console.log('body:', body);
    }
);
const crypto = require('crypto');
const request = require('request');

const apiHost = 'https://extstock.com';
const publicKey = '-- your public key --';
const privateKey = '-- your private key --';

var path = '/api/v2/trading/balances';

var tonce = Date.now();
var body = {

};

var message = path + tonce + form;
var form = JSON.stringify(body);
var hmac = crypto.createHmac('sha512', privateKey);
var signature = hmac.update(message).digest('hex');

request({
    headers: {
        'Content-Type': 'application/json',
        'x-api-key': publicKey,
        'x-api-tonce': tonce,
        'x-api-signature': signature,
    },
    uri: apiHost + path,
    body: form,
    method: 'POST'
    },
    function (error, response, body) {
        console.log('error:', error);
        console.log('statusCode:', response.statusCode);
        console.log('body:', body);
    }
);