Public HTTP API Methods
The public HTTP API allows read access to public market data.
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
Request:
curl -X GET 'https://extstock.com/api/v2/assets' -H 'Content-Type: application/json'
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
Request:
curl -X GET 'https://extstock.com/api/v2/volume' -H 'Content-Type: application/json'
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
Request:
curl -X GET 'https://extstock.com/api/v2/ticker' -H 'Content-Type: application/json'
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.
Request:
curl -X GET 'https://extstock.com/api/v2/orderbook/BTC_USD?limit=10' -H 'Content-Type: application/json'
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.
Request:
curl -X GET 'https://extstock.com/api/v2/trades/BTC_USD?limit=10' -H 'Content-Type: application/json'
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.
Request:
curl -X GET 'https://extstock.com/api/v2/chart/BTC_USD?period=5' -H 'Content-Type: application/json'
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
Request:
curl -X GET 'https://extstock.com/api/v2/time' -H 'Content-Type: application/json'
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.
All calls to the trading API are sent via HTTP using POST parameters to https://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.
- 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
Request:
curl -X POST 'https://extstock.com/api/v2/trading/balances' -H 'Content-Type: application/json' -H 'x-api-key: MHtMh-EWEWE7F-8wGrr-XnLbRBfp9HmS' -H 'x-api-tonce: 1577836800' -H 'x-api-signature: a0ec5638f4562f129240fbd3b91bd32fba063214ca0f7c1803b5364634f0fec2d3d2acd42600faf6656028ea7f1f1a87d26e89cb1887cd3941dee04a65106a36'
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.
Request:
curl -X POST 'https://extstock.com/api/v2/trading/balance/BTC' -H 'Content-Type: application/json' -H 'x-api-key: MHtMh-EWEWE7F-8wGrr-XnLbRBfp9HmS' -H 'x-api-tonce: 1577836800' -H 'x-api-signature: 2038aeceaea8729eab989b6131900404763b11560cee4e1187eddbbf1877b379a567d30c95c595ee44d98954bf8ff9efd54427b4c252f719fa027857d6755b0a'
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.
Request:
curl -X POST 'https://extstock.com/api/v2/trading/orders/active/BTC_USD' -H 'Content-Type: application/json' -H 'x-api-key: MHtMh-EWEWE7F-8wGrr-XnLbRBfp9HmS' -H 'x-api-tonce: 1577836800' -H 'x-api-signature: a191fe1692f14770be8837469ae2e6d9b73ce761b338ce618d58292b45ecc295dd0babd6d6796552a225e024fb95312804f616180697298839852a5c5a124314'
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;
Request:
curl -X POST 'https://extstock.com/api/v2/trading/orders/history' -H 'Content-Type: application/json' -H 'x-ap i-key: MHtMh-EWEWE7F-8wGrr-XnLbRBfp9HmS' -H 'x-api-tonce: 1577836800' -H 'x-api-signature: 38c54e6a39b896db74 fddc4cb24505a95b0568854c6e73d4ef4f6f214ec2ed2e9fc2ba9aab8bbd742409c85e4a614f72e3aad5ecd29e616ee218567b426f068 1' -d '{"pair":"BTC_USD","status":"open"}'
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.
Request:
curl -X POST 'https://extstock.com/api/v2/trading/order/create' -H 'Content-Type: application/json' -H 'x-api-key: MHtMh-EWEWE7F-8wGrr-XnLbRBfp9HmS' -H 'x-api-tonce: 1577836800' -H 'x-api-signature: 30a5a92bf59d244f82058fd4a65be699df2c4aa7f1045a052fd3f93accc531e41a9a3404f87be1efcd77fe46d07a019856287c77f017f35e35b7a285bc1d8f6f' -d '{"pair":"BTC_USD","price":"1000","amount":"0.02","type":"sell"}'
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.
Request:
curl -X POST 'https://extstock.com/api/v2/trading/order/cancel' -H 'Content-Type: application/json' -H 'x-api-key: MHtMh-EWEWE7F-8wGrr-XnLbRBfp9HmS' -H 'x-api-tonce: 1577836800' -H 'x-api-signature: da687bfe747a189b3d31d43c8d82b54744bf600aa9ab45b808d7b2f0954a970fc69d372e6106960deae57b71ffb25e89a79e3ec9fd277a3b65e00090bc5cda18' -d '{"order_id":5}'
Response:
{ "success":true, "data":"Order canceled" }
Returns your trade history.
Parameters:
pair: (optional) Trading pair;
type: (optional) Type at which this trade executed.
Request:
curl -X POST 'https://extstock.com/api/v2/trading/trades' -H 'Content-Type: application/json' -H 'x-api-key: MHtMh-EWEWE7F-8wGrr-XnLbRBfp9HmS' -H 'x-api-key: MHtMh-EWEWE7F-8wGrr-XnLbRBfp9HmS' -H 'x-api-tonce: 1577836800' -H 'x-api-signature: 4838b9832ebfeff88486640ea438275b3e6260695b5c5d56cb895057d38c1dfe37083464ff496ddeee80eb0e69d33d2eafa258033f31a8794d5607128524a4ff' -d '{"pair":"BTC_USD"}'
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); } );