资源加载中... loading...

Classic spot multi-currency grid strategy

Author: ChaoZhang, Date: 2023-10-26 14:59:00
Tags:

Overview

This strategy is a multi-exchange grid trading strategy. It supports running grid trading on multiple trading pairs across multiple exchanges simultaneously. The grid size and price ratio can be set separately for each trading pair. Based on the initial price and ratio settings, the strategy dynamically calculates the buy and sell prices for each grid. When the market price reaches the corresponding level, it will place orders to buy or sell a certain amount of coins. The strategy provides 5 different trading modes, allowing flexible choice of whether to place both buy and sell orders at the same time. In addition, the strategy can be set to dynamically adjust the initial price according to the latest market price, in order to adapt to market changes. The strategy outputs rich status information, including account information, position information, order information, etc., which is convenient for real-time monitoring of the operation.

Strategy Principle

The core principle of this strategy is grid trading. For each trading pair, according to the set initial price and price ratio, the price range is divided into multiple grids. Each grid corresponds to a buy price and a sell price. When the market price rises to the sell price of a grid, the strategy will place an order to sell a certain amount of coins; when the market price falls to the buy price of a grid, the strategy will place an order to buy a certain amount of coins. By repeatedly buying and selling at different price levels, the strategy can earn spread income.

Specifically, the calculation formulas for the buy and sell prices are:

  • Buy Price = (Grid Value * Price Difference - Grid Value * Initial Price) / ((Initial Coin Quantity - Current Coin Holding) * Price Difference - Grid Value)
  • Sell Price = (-Grid Value * Price Difference - Grid Value * Initial Price) / ((Initial Coin Quantity - Current Coin Holding) * Price Difference - Grid Value)

Where “Grid Value” is the fund amount of the grid, “Price Difference” is calculated according to the set ratio, “Initial Coin Quantity” is the coin quantity when the strategy starts, “Current Coin Holding” is the current coin quantity in the account, and “Initial Price” is the set initial reference price.

In addition, the strategy provides an option to adjust the initial price based on the market price. According to the set adjustment mode and coefficient, the strategy will periodically move the initial price closer to the market price, so that the position of the grid can adapt to market fluctuations.

Strategy Advantages

  1. Suitable for volatile markets: Grid trading strategy is very suitable for use in oscillating markets. As long as the price fluctuates within the grid range, the strategy can continuously earn spreads through buying and selling, without the need to judge the trend.

  2. Small drawdown: Compared with trend strategies, grid strategy usually has a smaller maximum drawdown. Because it sets a stop-loss position in each grid and stops losses in a timely manner. Moreover, when the price touches the lower grid, it will trigger position increase and reduce the holding cost.

  3. Suitable for coin-to-coin arbitrage: This strategy supports running on multiple exchanges at the same time, which is convenient for cross-market arbitrage. The grid parameters of different trading pairs and different exchanges can be flexibly set.

  4. Automatic position adjustment: The strategy can be set to automatically adjust the grid position according to the market price. This enables the grid to closely follow the market, avoiding losses caused by the price being too far away from the grid, and capturing new trading opportunities.

Strategy Risks

  1. Black swan events: If the market experiences extreme conditions and breaks through the upper or lower limit of the grid, the strategy may be in a passive position. Risk management is most important.

  2. Fund utilization rate: Since grid trading requires placing orders at different price levels, a large amount of funds are occupied at the same time, resulting in a low fund utilization rate. This may affect returns.

  3. Transaction fees: When the grid density is high, frequent trading will generate more transaction fees, eroding returns. It is necessary to balance grid density and transaction fee costs.

  4. Parameter setting: Grid strategy is relatively sensitive to parameters. Improper settings of initial price, price ratio, etc. may cause the strategy to fail. Parameters need to be optimized based on backtesting.

  5. Lack of trending: In unilateral trending markets, grid strategy may frequently stop losses, resulting in losses. In this case, consider combining trend factors to optimize the strategy.

Summary

This strategy is a feature-rich, highly customizable multi-exchange grid trading strategy. It can simultaneously conduct grid trading on multiple coin pairs on multiple exchanges, and provides multiple trading modes and parameter settings. The strategy automatically calculates the buying and selling prices of the grid according to the set rules, and places orders in a timely manner, striving to reduce risk while increasing returns.

template: strategy.tpl:40:21: executing "strategy.tpl" at <.api.GetStrategyListByName>: wrong number of args for GetStrategyListByName: want 7 got 6