Automate Your Exchange: HollaEx v2.6 (Cass) New Admin APIs and Libraries

• Date Published:
June 9, 2023
Introduced in v2.6 (Cass): Simplified API Integration for Operators and Users
Automate Your Exchange: HollaEx v2.6 (Cass) New Admin APIs and Libraries

The latest HollaEx update (codename: Cass) is a big one, and this time it’s all about the devs. The latest update enables operators and their users to interface programmatically with their exchange and set up scripts to accomplish exchange functions easily.

Key to this is the addition of the API Key section to the operator controls. This enables scripting admin functions in a similar way to the previously existing user API key section, so the concept should be familiar to those who have already taken advantage of this. The new admin API access is exclusively for exchanges running on Crypto Pro, Fiat Ramp or DIY Boost.

Each key gives access to functionality within the scope of that key. This means that with a user key for example, scripts will only be able to read and write information pertaining to their own account, or access public exchange information. Admin keys have a greater scope, and so can perform the same functions, as well as exchange-wide functions, such as settling fees for the exchange to a wallet.

The HollaEx docs have a full detailed rundown on how to set up and use API keys. In brief API Keys can be generated in the security section from the sidebar for the User, and within the Operator controls -> General -> Security for admin keys.

With the key generated, both Admin and User must define the particular scope of that key using the Read and Write options. These are much as they sound, read access will allow accessing inforamtion for that key scope but only getting it, whilst write access will allow changing the status of the particular key's scope (creating an order, or withdraw for a user, or creating a user in general for an admin, etc.).

With these keys generated it’s possible to interact with the HollaEx Node Library.

With the setup complete (check the docs for the specific setup), scripts can be mae to automate exchange activity.

Creating HollaEx Node Library Scripts

With either the user or the admin, the API key and secret are the ‘key’ to creating scripts. (All?) Scripts follow a similar structure, such as below:

This code can also be found (and copied) in the admin section of the API docs

On line one in this script we import the HollaEx Node Library, following this the generated API keys are placed in the relevant points in the hollaex object, along with the URL of the exchange in question with '/api' added to the end, and will give access to specific accounts and functions they have been generated for.

With these two sections complete the next is creating the particualr srcript to carry out the desired goal.

Some Example Scripts

With the extensive list of functions, let's consider some potential use cases:

User Scripts

User scripts can deal with checking specific information about the user, or public exchange information. To this end reading the API docs there is a whole host of ‘get’ functions such as getTicker() which will retrieve ticker information for a given on-exchange pair.

For something a bit more involved consider an example ‘chain’ of logic a user could conceivably want to carry out and have running on their machine:

Perhaps a user believes that if the price of one asset, A, reaches a certain point, it will have a negative effect on another asset, B.

To do this they want their script to be monitoring this asset A (using getTrades), and if the reading of this price hits a certain point, to automatically create a specific order (createOrder) for asset B. If the order is not filled after a certain period, however, they may assume their forecast was wrong and want to automatically cancel the order (cancelOrder).

By creating this script and allowing it to run, this user has used their own API key, which they granted read and write access to, the ability to act in their place automatically.

Admin Scripts

As mentioned before admin scripts give access to the whole range of functions, so example scripts may focus on exchange-wide tasks, rather than specific trading goals (also the admin can always set up these as well).

An example may be an operator who has a website linked to HollaEx, such as a main information page about their project. This operator may have users sign up on their main site but simultaneously want an account to be created on the exchange as well.

Luckily for them, they could embed this logic into the signup form of their main site, by utilizing the Hollaex node library, and the createUser function. This means the user would have two accounts (for the main site and the exchange) and have only had to do the work of one sign-up.

This logic could be furthered with the updateExchangeUser and createExchangeUserWallet functions, again embedded in main site forms, but interacting with the exchange seamlessly behind the scenes

Here are some more quick ideas that could be implemented with a admin key:

  • Detect large trades or trades and notify the operator, keeping in loop for any significant activity
  • Find the largest traders on the exchange and reward them with discounts (removing this discount if trading volume drops) or use stats from outwith the exchange (perhaps social media engagement), reward users with discounts
  • Extract data and create visualizations of exchange statistics
  • Integrate with the HollaEx Plugins, and use data to create whole new pages for the exchange
  • Sending emails to users, when specific activty on their account occurs.
  • Check out this page on the docs for some copiable scripts for even more advanced situations.

Interacting with the API gives a method of advanced interaction with HollaEx exchanges (only for Crypto Pro, Fiat Ramp or DIY Boost) and the wider network and with the newly added admin API key generation in v2.6 accessing this functionality is easier than ever.

Lastly, if you are looking for more HollaEx admin API information there is a YouTube video below covering a host of possibilities for creating scripts. The video shows script examples and how to access Dev mode, as well as a quick example of this quick editing ability.

For more information check out the docs, and be sure to discuss your ideas with other community members over on the Discord developer board!

Back to blog