Share articles to

Academy Beginners Tutorial Article
Trading OKEx

How to use the OKEx trading bot for automated crypto buys and sells

2021.11.19 OKEx

A step-by-step guide on how to use OKEx’s trading bot to automate your strategy

As one of the world’s leading cryptocurrency ecosystems, OKEx offers a comprehensive suite of products and services. In addition to our extensive trading pairs, decentralized finance offerings and opportunities to generate passive income, we’ve now introduced a customizable trading bot to help you leverage a variety of automated and manual trading strategies.

The OKEx trading bot has three distinct modes: spot grid, iceberg and TWAP (i.e., time-weighted average price) — suitable for varying purposes and needs. The first mode, called spot grid, is ideal for traders of any volume hoping to lock in additional profits from asset volatility. You can determine the spot grid’s parameters yourself or choose the AI strategy, which is based on previous price movements. 

The second two modes are intended for traders with larger orders. Both TWAP and iceberg orders use the bot to enter or exit a market where price slippage is a risk. These modes are ideal for those wanting to place big trades relative to the size of the chosen market. In less liquid markets — like those of smaller market-cap assets listed on OKEx — large trade sizes can potentially shift the price unfavorably. Therefore, these modes can be useful when placing such relatively large orders.

The tutorial below covers all three modes as well as instructions for accessing and using the OKEx trading bot.

Accessing OKEx’s trading bot

Visit the OKEx homepage and log in to your account using the Login button at the top-right corner of the screen. Enter your email address or telephone number and password and click Log in. Alternatively, you can scan the QR code using the OKEx application. 

Complete any two-factor authentication checks you have active on your account and click Continue

Now, back on the OKEx homepage, hover over Trade and click Basic Trading.

In the Trade section, use the dropdown menu in the top-left corner to select Trading bot.

Using the spot grid mode for automated buys and sells

Spot grid mode enables you to set a manual price range or use a back-tested AI strategy according to which the trading bot will execute automated buys and sells. This mode is particularly useful for high volatility assets in bullish markets.

Spot grid mode splits your starting capital between the two assets of your chosen trading pair. It then creates a grid of price points between the upper and lower bounds, and divides your starting position equally between the number of grids used. 

Each time the asset price reaches the upper grid line, the bot automatically sells a portion of the asset. When the asset price reaches the lower grid line, the bot automatically buys the asset. The trader profits from the difference between these buys and sells that are executed according to volatile price swings.

The following example demonstrates how this works in practice:

Maxwell has $10,000 and wants to profit from BTC price volatility as it trades at $60,000. In manual spot grid mode, he sets a lower price of $50,000, an upper price of $70,000 and 20 grids. This places grid lines with buy or sell orders positioned after every $1,000 interval.

The bot divides his starting position — $10,000 — equally between the number of grid lines. In this case, each grid line is allocated $500 (10,000/20). Since the price when he opens his trade is exactly in the middle of his stated range ($60,000), half of his 10,000 USDT is immediately exchanged for BTC. Under this setup, the bot sets up $500 BTC sell orders at $61,000, $62,000, etc., up to $70,000, and $500 BTC buy orders at $59,000, $58,000, etc., down to $50,000. Each time a buy or sell order is hit, the bot rebalances the grid with the starting point at the new price. 

If the BTC price moves up to $61,000 over the next day, and the bot sells $500 worth of BTC for USDT. The grid rebalances with BTC sell orders above $61,000 and buy orders below. If then, the price moves down to $60,000 again, it fills a buy trade and nets Maxwell just under $8.20 in profit — while also returning the BTC position to roughly its starting size.

If Maxwell had simply held his position, the price action described above would result in $0 profit.

To access spot grid mode, click Spot grid from the options shown under the “Trading bot” menu.

Then, select the pair you wish to trade using the top-left menu. 

Using the AI strategy for the Spot grid

The easiest way to use the spot grid trading bot is with OKEx’s back-tested AI strategy. This strategy determines the number of grids and price range on your behalf based on historical price data. 

In the “Spot grid” section, select AI strategy.

Then, set the amount with which you want the bot to trade and click Create.

On the next screen, check your order details and click Confirm.

You can then check your open positions in the “Bots” tab on the main trading dashboard.

Manually setting the spot grid parameters

OKEx’s trading bot also allows you to manually determine the spot grid parameters. This is riskier than using the AI strategy — particularly for novice traders. However, it does allow for greater user control and potentially higher profitability. 

Click Set myself in the “Spot Grid” section. 

Next, enter the upper and lower price bounds for your desired trading range. Then, enter the number of grids with which you would like to fill the range. This will determine the size of the buy and sell orders the bot creates. Next, enter the total amount you want to invest.

You can also add a price at which to take profit from your trade or a stop loss. These are useful if the asset price increases or decreases beyond the range you set, and they essentially exit your position either in profit or to limit further losses. 

When you have determined the spot grid parameters, click Create.

On the next pop-up window, check the trade details and click Confirm.

You can check on your open positions in the “Bots” tab on the main trading dashboard. Clicking Details will show additional information about the trade, including the profits the grid has produced and those occurring because of the price movement itself. 

Placing Iceberg orders using the trading bot

Iceberg orders are large buys or sells broken down into many smaller orders. They are particularly useful when making a large trade relative to the size of the market. Even a smaller order can move the asset price in illiquid markets, resulting in a less favorable entry or exit. Iceberg orders attempt to mask large orders and limit the impact of price slippage. 

To enter iceberg mode, click Iceberg from the trading bot options.

In the “Iceberg” section, select the pair you want to trade using the menu in the top-left corner.

Next, choose whether you want to buy or sell the first asset listed in the trading pair. 

Next, enter the amount of slippage you will tolerate — i.e., the amount by which the price can move when executing your trade. You can do this in either the second asset of the trading pair by using the “Variance” option or as a percentage of your order price by using the “Ratio” option. 

Under “Price limit,” enter your ideal exit or entry price. This is the minimum price at which your sell orders will execute or the maximum price of buy orders.

Then, enter the average amount of each of your smaller orders and the total position size. Click Buy [asset] to place your iceberg trade. 

Check your trade details on the next pop-up window and click Confirm to place your iceberg trade. 

Placing TWAP orders using the trading bot 

TWAP mode — short for time-weighted average price — seeks to execute a large trade over a specified period. It is similar to an iceberg order in that it attempts to enter or exit a market with a large position without significantly moving the asset’s price. 

To enter the trading bot’s TWAP mode, click TWAP from the bot selection page. 

Now, once again, select your desired trading pair using the menu to the top-left of the “TWAP” section. 

Choose whether you want to buy or sell the first asset listed in the trading pair and input your tolerated price slippage. Selecting “Variance” enables you to enter an amount denoted in the second asset from the trading pair. Meanwhile, “Ratio” enables you to choose your slippage based on a percentage move from the limit price. 

Next, enter your desired limit price, the time interval at which you want the bot to make trades and the size of each buy or sell. Finally, enter the total trade amount and click Buy [asset].

Check your trade details and click Confirm on the next screen to initiate the bot. 

Stopping the trading bot and closing trades

You can check on any trades you have created using the trading bot in the “Bots” tab of the trading dashboard. Here you can view details of your trades, including their profitability to date, and here is also where you can stop the bot manually. 

To stop an active bot, just click Stop next to the relevant trade.

You then have the option to keep the asset traded or exit your position entirely. Choose the appropriate option and click Confirm.   

Your trade will then disappear from the “Bots” section and appear in your “History.” 

If you experience any difficulties using the trading bot, feel free to contact our support team via the OKEx Telegram group or our dedicated Support Center

Not already an OKEx trader? Create an account and enjoy a sign-up bonus for joining us!

Catch up on all the latest crypto industry news and subscribe to the OKEx Insights podcast, Send It.

Disclaimer: This material should not be taken as the basis for making investment decisions, nor be construed as a recommendation to engage in investment transactions. Trading digital assets involve significant risk and can result in the loss of your invested capital. You should ensure that you fully understand the risk involved and take into consideration your level of experience, investment objectives and seek independent financial advice if necessary.



%d bloggers like this: