Creating and Monitoring a Sell Order
Creating buy and sell orders is, of course, a fairly vital part of the crypto industry and here we will look at how we can interact with this core functionality
//using the index file, get access to the functions we will be using throughout
//Note: make sure the index file is pointed in the correct relative folder to this
//script
const Network = require('./index');
const network = new Network({
apiUrl: 'https://api.hollaex.network',
apiKey: '<YOUR_API_KEY>',
apiSecret: '<YOUR_API__SECRET_KEY>',
activation_code: '<YOUR_ACTIVATION_CODE>',
});
//main function for adding user and their address
(async () => {
try {
//initialise the network
const init = await network.init();
//account's IDs
let idAccountA = 2275;
//balance before the sell order
console.log(await network.getUserBalance(idAccountA));
//fee data (in percentages ie. 0.03 = 0.03% fee)
let feeData = { fee_structure: { maker: 0.03, taker: 0.03 } };
//create the order
await network.createOrder(
idAccountA, //account placing order
'xht-usdt', //symbol of market
'sell', //type of order
10, //order amount
'market', //type of order (limit/ market)
undefined, //limit if limit order
feeData //feeobject from above
);
//balance after the order
console.log(await network.getUserBalance(idAccountA));
//see what trades this user has completed
console.log(await network.getUserTrades(idAccountA));
//see what active orders this user has
console.log(await network.getUserOrders(idAccountA));
} catch (err) {
console.log(err);
}
})();
Transfer Assets Script: The Output
Last updated