Getting More Interesting: Orders with the Tools
In this tutorial lets deal with something a little more involved, creating and monitoring trades through two users with the Network Tools
Last updated
In this tutorial lets deal with something a little more involved, creating and monitoring trades through two users with the Network Tools
Last updated
Let’s try something a bit more fun. Now with users on our exchange, let's see how we can facilitate trades using the network tools.
Since this script will have a little more complexity to it, I am going to be splitting it into a few sections and files so we can see what is going on at each stage.
At the end, a complete script will be provided for enabling and monitoring trade between two users (you can skip to there if you don't want the guided tour).
The possibilities are endless in how you want to integrate the HollaEx Network into your own service, here I will be taking this general hardcoded approach for explanation's sake. The sky is the limit though in how you work with the Tools.
For the sake of reference, these are the rough steps we will take in this tutorial.
Some of these steps are not required for facilitating a sell or buy order, but to show off some more of the feature of the network tools, as well as due to the fact I am running these commands on a test exchange and so a little setup is required.
The main commands we are using are also listed, alongside their step.
Interact with three accounts (Admin and two users)
Account A and B have been created with a similar script to the previous tutorial and given wallets we need for trades
Transfer from the Admin account XHT to user A, and USDT to user B
transerAsset
From account A create a sell order for 10 XHT and a buy order for Account B for 10 XHT
createOrder
Observe this order
getOrder
getOrders
See the values in our users' wallets now the trade has occurred
getUser
See our generated fees from the trade
getGeneratedFees
Settle these fees to the admin account
settleFees