This is npm package to help users who want to develop apps using AXNET APIs.
The AXNET APIs are designed to allow access to all of the features of the AXNET platform. The end goal is to allow people to potentially recreate the entire platform on their own.
npm install node-axnet-api --save
You can get class of node-axnet-api and create instance with some parameters. Here important fields are APIKEY and APISECRET, which are neccessary for API authorization. You can get them from user profile of AXNET site.
const AXNET = require('node-axnet-api');
const axnet = new AXNET(
{
APIKEY: '<key>',
APISECRET: '<secret>',
requestTimeout: 10000
});
axnet.getSymbols()
.then(symbols => {
console.log("Symbols: ", symbols);
})
.catch(e => {
console.log("error: ", e);
})
axnet.getMarkets()
.then(markets => {
console.log("Markets: ", markets);
})
.catch(e => {
console.log("error: ", e);
})
axnet.getBalance()
.then(balance => {
console.log("balance: ", balance);
})
.catch(e => {
console.log("error: ", e);
})
axnet.getMyOpenOrders()
.then(orders => {
console.log("open orders: ", orders);
})
.catch(e => {
console.log("error: ", e);
})
let orderData = {};
orderData.orderType = 'LIMIT';
orderData.token = 'ETH';
orderData.baseToken = 'BTC';
orderData.amount = 0.0001;
orderData.price = 0.05;
orderData.direction = 1;
axnet.sendOrder(orderData)
.then(order => {
console.log("order result: ", order);
})
.catch(e => {
console.log("error: ", e);
})
axnet.cancelOrder(orderObject._id)
.then(order => {
console.log("order canceled: ", order);
})
.catch(e => {
console.log("error: ", e);
})
axnet.onUpdateOrderSocket(order => {
console.log("order updated: ", order);
})
axnet.onUpdateBalanceSocket(balance => {
console.log("balance updated: ", balance);
})
axnet.onTradeSocket(trade => {
console.log("new trade: ", trade);
})