1.0.470 • Published 1 year ago
node-sandnex-api v1.0.470
node-sandnex-api
This project is designed to help you make your own projects that interact with the Sandnex API. [https://api-docs.sandnex.com](https://api-docs.sandnex.com/) & Support & npm package
Installation :
npm install -s node-sandnex-api
Getting started
const Sandnex = require('node-sandnex-api');
const sandnex = new Sandnex().options({
api_key: '<key>',
secret_key: '<secret>'
});
Sandnex API (Spot)
Getting list of current balances
let balance = sandnex.balance();
console.log(balance)
{ status: true,result : [ { ticker_id: 'BTC_USDT', base: 'BTC', target: 'USDT' }] }
Current pairs
let pair = sandnex.pair();
Promise.all([pair]).then((values) => {
console.log(values[0]);
});
{
"status": true,
"result": [
{
"ticker_id": "BTC_USDT",
"ticker_name": "BTC/USDT",
"type": "spot",
"base_currency": "USDT",
"target_currency": "BTC",
"last_price": 23005,
"base_volume": 0,
"target_volume": 0,
"bid": 23004,
"ask": 23303,
"high": 0,
"low": 0,
"change_percent": 0
},
{
"ticker_id": "ETH_USDT",
"ticker_name": "ETH/USDT",
"type": "spot",
"base_currency": "USDT",
"target_currency": "ETH",
"last_price": 0,
"base_volume": 0,
"target_volume": 0,
"bid": 0,
"ask": 0,
"high": 0,
"low": 0,
"change_percent": 0
},
{...}
]
}
Current pairs with Symbol
let pair = sandnex.pair('ETH_USDT');
Promise.all([pair]).then((values) => {
console.log(values[0]);
});
{
"status": true,
"result": {
"ticker_id": "ETH_USDT",
"ticker_name": "ETH/USDT",
"type": "spot",
"base_currency": "USDT",
"target_currency": "ETH",
"last_price": 0,
"base_volume": 0,
"target_volume": 0,
"bid": 0,
"ask": 0,
"high": 0,
"low": 0,
"change_percent": 0
}
}
Get market depth for a symbol
let depth = sandnex.depth("ETH_USDT");
console.log(depth)
{
status: true,
result : [{
bids: [
'0.00022997': '49.00000000',
'0.00022867': '11.00000000',
'0.00022865': '1149.00000000',
'0.00022810': '20.00000000',
'0.00022800': '1000.00000000',
'0.00022777': '1350.00000000',
],
asks : [
'0.00022999': '32.00000000',
'0.00023086': '583.00000000',
'0.00023095': '1154.00000000',
'0.00023119': '781.00000000',
'0.00023120': '3401.00000000',
'0.00023180': '4889.00000000',
],
}]
}
Order Limit Buy
let quantity = 1, price = 0.069;
let buy_order = sandnex.buy("ETH_USDT", quantity, price);
console.log(buy_order)
{
status: true,
result : [
{
pair: 'ETHUSDT',
quantity: 1,
price: 0.069,
result: 0.069,
}
]
}
Order Limit Sell
let quantity = 1, price = 0.069;
let sell_order = sandnex.sell("ETH_USDT", quantity, price);
console.log(sell_order)
{
status: true,
result : [
{
pair: 'ETHUSDT',
quantity: 1,
price: 0.069,
result: 0.069,
}
]
}
Cancel Order
let orderid = 1100000000,
let cancel = sandnex.cancel("ETH_USDT", orderid);
console.log(cancel)
{
status: true,
pair: 'ETHUSDT',
orderid : 100000000,
result : []
}
Cancel All Order
let cancel_all = sandnex.cancelAll("ETH_USDT");
console.log(cancel_all)
{
status: true,
pair: 'ETHUSDT',
result : []
}
Assets
In depth details on crypto currencies available on the exchange
let assets = sandnex.assets();
console.log(assets)
{
status: true,
result : [
{
"trading_pairs": "XRP_BTC",
"last_price": 0.0000203,
"lowest_ask": 0.0000213,
"highest_bid": 0.0000202,
"base_volume": 350700,
"quote_volume": 7.139649999999999,
"price_change_percent_24h": -0.49019607843137253,
"highest_price_24h": 0.0000204,
"lowest_price_24h": 0.0000203
},
{
"trading_pairs": "LTC_BTC",
"last_price": 0.00469,
"lowest_ask": 0.00479,
"highest_bid": 0.00469,
"base_volume": 592.88,
"quote_volume": 2.7840513999999996,
"price_change_percent_24h": -0.635593220338983,
"highest_price_24h": 0.00471,
"lowest_price_24h": 0.00466
}
]
}
{
status: true,
result : [
{
"trading_pairs": "XRP_BTC",
"last_price": 0.0000203,
"lowest_ask": 0.0000213,
"highest_bid": 0.0000202,
"base_volume": 350700,
"quote_volume": 7.139649999999999,
"price_change_percent_24h": -0.49019607843137253,
"highest_price_24h": 0.0000204,
"lowest_price_24h": 0.0000203
},
{
"trading_pairs": "LTC_BTC",
"last_price": 0.00469,
"lowest_ask": 0.00479,
"highest_bid": 0.00469,
"base_volume": 592.88,
"quote_volume": 2.7840513999999996,
"price_change_percent_24h": -0.635593220338983,
"highest_price_24h": 0.00471,
"lowest_price_24h": 0.00466
}
]
}
Asset pair with Symbol
let asset = sandnex.asset('ETH_USDT');
console.log(asset)
{
status: true,
pair : 'XRP_BTC'
result :
{
"ticker_id": "ETH_USDT",
"ticker_name": "ETH/USDT",
"type": "spot",
"base_currency": "USDT",
"target_currency": "ETH",
"last_price": 0,
"base_volume": 0,
"target_volume": 0,
"bid": 0,
"ask": 0,
"high": 0,
"low": 0,
"change_percent": 0
}
}