How to execute your trades with a crypto trading bot

How to execute your crypto bot trades

So, you have been building a trading strategy, and maybe now it is time to get the trades to your exchange. What is the best way to do that?

Building a profitable trading strategy is one thing, but successfully executing and managing those trades is another. They are not the same. In this article, I will explain how you could execute the trades that your trading strategy is generating, what platforms are available, and share my own experiences.

Architecture

Firstly, consider the architecture you want for your bot. Typically, the architecture of a crypto trading bot looks like this:

DATA SOURCE -> TRADING STRATEGY -> MIDDLEWARE -> CRYPTO EXCHANGE

Data source: You need price or candle data for your asset to input into your trading strategy. Normally, this data comes from your crypto exchange.

Trading strategy: Your trading strategy makes trading decisions based on the data source (buy/sell/take profit, etc.) and sends those decisions to the middleware. You can create a trading strategy in Metatrader 5 or Tradingview for example.

Middleware: When a signal is received from the trading strategy, the middleware contacts the crypto exchange using an API connection. The middleware also includes all the trading logic, such as how to place orders and which kinds of orders to use. The middleware can be a cloud platform, open source solution or a self hosted piece of software.

It does not sound like a big deal, but choosing the right middleware is crucial. If your middleware does match your trading strategy you are likely to experience problems. You can experience high time slippage, wrong order types, orders not coming through to your exchange etc. So test different middleware solutions and pick the one that works best in combination with your trading strategy.

Crypto exchange: The orders are received by the crypto exchange, executed, and feedback is sent back to the middleware. Think about which exchange you want to trade on, not every middleware solution works with every exchange. Your best bet is to go for the biggest exchanges, normally they have good api trading infrastructure, used to connect to trading bots.

Do not forget to check the trading fees, funding and trading products, to see if they match with your trading strategy.

When choosing a platform or software solution to develop your crypto trading bot, you can choose from a variety of options:

One-stop-shop: This platform or software takes care of all four steps mentioned above. Example: Tradestation (https://www.tradestation.com/)

Middleware only: This platform or software only takes care of the middleware part. To generate trades, you need to connect it with a trading strategy. Example: Alpha Shifter (https://oxidosolutions.com/alphashifter/)

Trading strategy only: This platform or software only takes care of the trading strategy part. To execute trades, you need to connect it with middleware. Example: Tradingview (https://tradingview.com/)

Open source, self hosted & cloud based platforms

Software for one stop shops, middleware and trading strategies are available in 3 ways:

Open source: On GitHub (https://github.com/) there are a lot of projects for crypto trading bots. For most of them you need extensive technical knowledge to use them. For middleware purposes you could take a look at CCXT (https://github.com/ccxt/ccxt)

The upside to open source is that you are fully in control and know exactly what happens in the source code.

Self hosted

With self hosted solutions you are not able to peek into the source code and you probably need to buy a license. However you are in control of where to host it and most of the time the software is regularly updated by the company that makes the software.

In self-hosted middleware solutions, you often have many possibilities to customize the order execution process. Additionally, it is probably faster since you can choose how you host it.

Cloud based platforms

Platforms like Tradingview are very convenient to use. They are fast, offer tons of features, and look great. For trading strategies, you can definitely use this platform. However, for middleware solutions that execute orders, we would not recommend cloud-based platforms (Tradingview does not support this). Instead, platforms like Tradestation are more suitable.

Although cloud-based platforms may be convenient, the way your trades are executed is crucial. On most platforms, you do not have enough freedom to customize the way your middleware places orders, which may not be adapted to your bot’s trading strategy. Another issue is the speed of order placement on the exchange, as you are using the platform with thousands of other traders.

Another potential issue is that if the platform experiences technical difficulties or outages, your bots may not be able to execute trades properly, resulting in missed opportunities or even losses. Additionally, if the platform’s bots are poorly designed or use flawed strategies, this could also negatively impact your trading results.

Connecting software

If you are developing your trading strategy on a platform that does not support order execution, such as Tradingview, you could connect it to middleware software like Alertatron. This is done through a webhook. When your strategy makes a buy or sell decision, it will trigger an alert that sends a request to the middleware software. This software will then execute the trade for your trading strategy.

At Oxido Solutions we use our own middleware, it is called Alpha Shifter. It is self hosted and like a swiss knife for crypto bot traders. You can read more about it here.

What is the best way to go?

This really depends on your plans. Are you planning to implement trend following strategies? A platform like Tradingview may work fine. However, for ultra-low time frame trading, it may not be suitable since the alerts are too slow. In that case, you may want to consider programming and exploring GitHub for solutions.

In my personal experience, a combination of Tradingview and a self-hosted middleware solution can work great. Tradingview is a reliable cloud-based platform, and with a self-hosted middleware solution, you can customize your order placement logic.

Developing your own bot in Python or using a bot from GitHub can also be a viable option. However, it requires extensive technical knowledge to get it up and running, create a good strategy, ensure reliability, and make a profit. This can be a nearly impossible task to achieve without a large team.

My personal experiences

I had a lot of fun creating trading strategies, but executing those trading signals into orders on exchanges was frustrating. I’ve tried open source projects, Metatrader 5, and I am now mainly using Tradingview in combination with my own middleware (Alpha Trader). But why?

While using third-party middleware, I experienced security issues, such as the 3commas hacks. There were more of those on other platforms. I was not impacted, but it is scary. Other problems were the lack of customization of the order flow, and not being able to use variables to customize order sizing, limit prices, and so on.

The biggest problem is that you are using that platform with thousands of other users at the same time. This causes problems with time slippage and even unreliable service when a lot of bots are trading at the same time.

For me, using Tradingview is convenient. The price data is real-time, and getting access to good price data in crypto is very difficult in, for example, MetaTrader 5. You have to use all kinds of unreliable third-party tools and platforms to get even normal price data. MetaTrader 5 is just not suited to trade crypto.

Tradingview alerts are pretty fast. For me, it has proven to be reliable. It is low-cost, and the user interface + pine script works great. I wish it had an input API so I can give feedback from the middleware to Tradingview, for example, to tell Tradingview that my limit order is filled or not filled. That would help in my strategy logic.

It could be that I will switch from Tradingview to another solution in the future, but at this point, I have not seen any better platform or open source solution.

Conclusion

Overall, while using a third-party platform for crypto bot trading can be a convenient and accessible way to get started with automated trading, there are some potential downsides to be aware of. Most of the platforms and middleware have free trials, so it’s important to do a lot of testing and think about all the possible combinations.

The opinion expressed in this blog article is for general informational purposes only and is not intended to provide specific advice or recommendations for any individual or on any specific security or investment product.