Cryptocurrencies

Why API Trading for Retail Crypto Traders Could Catch On

By Stephan Lutz, group CEO and CFO of BitMEX

Most centralized exchanges offer APIs that allow placing orders, managing balances and in general, control the entirety of the account through automated bots. Many regular users don’t take their time to learn how they can improve their edge with automation, but I believe that eventually, this will become the norm in crypto.

API trading is primarily used by professional traders for its reliability, low latency, and automation capabilities.

A solid and responsive API is the cornerstone of any successful exchange, and it’s usually accessible to all users, be they retail or professional. Even though each exchange sets API rate limits, it’s quite difficult that regular users would be impacted by them significantly.

With the increasing availability of trading bots and algorithmic trading, API trading is becoming more accessible to a wider range of traders, especially those who are tech-savvy. Additionally, open-source projects on platforms like Github provide experimental traders with tools to set up their bots and calibrate their strategies.

Active crypto traders have a major challenge to their sanity and mental health that traditional markets traders are shielded from: the fact that crypto markets are open 24/7.

While this is great from an efficiency standpoint, it does mean that crypto traders never have any guaranteed respite. Anything could happen any time of day, maybe deep in the night, or in the worst case, deep into a Saturday night. Traditional markets, on the other hand, have well-defined sessions lasting about as much as a work day. Some traders may engage in pre and post-markets, futures, and foreign sessions, which dilute the effective length of trading activity to the entire day. However, weekends remain a “sanctuary” of closed markets that offers some much needed rest, which is not the case in crypto.

Dealing with the stress of 24/7 trading can become uniquely exhausting for crypto traders, and adopting automation in the trading strategies is the key to managing positions effectively.

What’s even better, trading via APIs and bots forces traders to take a step back and design holistic trading strategies, instead of getting caught in the heat of the moment. Machines are cold and unemotional, which can be a significant edge in trading.

Finally, bots can be backtested on past market data. Any strategy that traders might think of can be tested in a close simulation of the real trading environment, which helps cut down on potential mistakes and false assumptions.

Overall, API trading can significantly increase a trader’s edge over trading manually.

With API trading, traders can execute trades based on specific parameters and rules, without the need for constant monitoring. This leads to better trading outcomes and enables traders to trade 24/7 without losing their sleep.

Additionally, API trading provides access to advanced trading tools such as historical and real-time data analyticsand high-frequency trading, making it a scalable solution that can handle the complexity of cryptocurrency markets.

But what if the trader isn’t tech-savvy? Recent advances in AI and general usability of public trading bots should make API trading much more common-place. For example, the traders could eventually be able to use an AI-assisted tool, like chatGPT, to explain their strategy with natural language, without needing to go into the weeds of the code. But even as of now, using AI tools to build the bot saves a lot of learning and coding time.

Implementing API trading strategies

Making a bot is as simple as taking some existing code and developing a unique strategy based on the trader’s input. (For those who are still weary of “bot creation” GitHub has a large library of pre-made strategy bots that can even be customized.) Most common languages for creating bots are Python and Javascript, due to great support for performing math and input/output operations. For most cases, hosting the bot on the trader’s devices is good enough for testing, though more serious efforts will probably need to use cloud providers like AWS.

APIs can be accessed through either HTTPS REST interfaces, or WebSockets. The former is more reliable, but somewhat slower and best used for relatively low frequency strategies. For best performance and latency, WebSockets are the solution of choice, but they can be a bit trickier to set up and maintain.

It’s important to make sure that API keys, which are used to authenticate into the account, are handled safely, both by the exchange itself and the individual users. In most cases, API keys are created with different levels of permissions. For example, it is rare that particular trading strategies on individual assets will need access to withdraw or deposit funds. While for arbitrage strategies, control over assets is a critical component to execute the strategy efficiently. Choosing the correct permissions is key to maintaining account security.

As more traders gain familiarity with tools leveraging APIs, we can expect to see a rise in the use of automated trading among retail users, bridging part of the gap with institutional traders.

In traditional finance, institutional-grade participants have many advantages over retail due to the ability to co-locate their servers, access the exchange directly (instead of using brokers), and flexibility with position sizing (minimum contract size rules are particularly damaging for less capitalized traders). Not to mention the ability to access a plethora of historical data for backtesting APIs, which are not easily available for regular users.

Crypto, even with centralized platforms, levels the field by allowing both institutions and regular users to use the same APIs at the same conditions. I do expect, and hope, that more users will take advantage of this opportunity in the future.

Author bio

Stephan Lutz is group CEO and CFO of BitMEX, a leading crypto derivatives exchange. Prior to BitMEX, Stephan was a Senior Partner at PwC, and held senior positions with Deutsche Börse.

The views and opinions expressed herein are the views and opinions of the author and do not necessarily reflect those of Nasdaq, Inc.