Quant Zone Tutorial: Use FTX Quant Zone to run grid trading

Benson Sun
6 min readOct 1, 2021

--

Recently, many people are asking me whether they can use Quant Zone to run grid trading. The answer is yes. But Quant Zone is not suitable to run too many grids because you’ll have to set every grid in the strategy, which is very time-consuming. However, you can create an “infinity grid trading” with Quant Zone.

How does it work?

Suppose you want to run an ETH infinity grid trading. You can divide your capital into 2 parts: half is USD, and the other half to buy ETH. If the ETH price goes up, the ETH will account for more than 50% of the overall position. At this time, the bot will sell some ETH to keep its position at 50%. Conversely, if the ETH price falls, it will also spend USD to buy ETH to keep its position at 50%.

This self-rebalance bot is like providing liquidity at Uniswap at a 50/50 pool. It will buy when the coin’s declining and sell when it’s rising. No matter how the market moves, you’ll always hold 50% coin and 50% USD. The result is like grid trading without setting grids.

PS:If you haven’t registered FTX, feel free to use my referral link (5% tx fee off)

The Tutorial

Step1:Go to wallet and click on + sign to create a subaccount.

Step2:Give it a name. Say you want to run an ETH grid, name it “ETH-Grid”.

Step3:Switch to the subaccount and click Quant Zone on the menu.

Step4:Click on “Create New Rule” button.

Step5:Give the rule a name. The example is “Set Parameter”. Then set the condition to “true”.

Next, we need to set five variables. We first set ETH% and USD%. Both of these variables are set to 0.5. This means that you want to balance the two positions at 50%.

Then set two variables: ETH_Current% and USD_Current%. The first variable is used to calculate the proportion of ETH in the overall position, the variable is set as follows:

price("ETH/USD")*balance("ETH")/(price("ETH/USD")*balance("ETH")+balance("USD"))

The second variable is used to calculate the proportion of USD in the overall position, the variable is set as follows:

balance("USD")/(price("ETH/USD")*balance("ETH")+balance("USD"))

Let’s set the last variable, name it rebalance%, and set it to 0.01. This variable means the percentage it deviates from the desired position before it starts to rebalance. Setting it to 0.01 is 1%.

Then click “Save Draft”

Step6:Create another rule, name it “Buy ETH”, and set the conditions as follows:

get_variable("ETH_Current%")<get_variable("ETH%")-get_variable("rebalance%")

This means the buy condition will be triggered when the current percentage of ETH in the overall position is less than the balance target% and the deviation is larger than the rebalance%. (for example, the ETH% target is 50% and it will start to buy ETH when it drops to 49% and below.)

Then set the execution logic: market buy ETH/USD with 1% USD.

balance("USD")/price("ETH/USD")/100

This applies when the rebalancing condition is triggered. 1% USD is used to buy ETH and the trading won’t be stopped until the position is balanced.
Then click “Save Draft”

Step7:Create another rule, name it “Sell ETH”, and set the conditions as follows:

get_variable("ETH_Current%")>get_variable("ETH%")+get_variable("rebalance%")

This condition sets in when the current percentage of ETH in the overall position is larger than the balance target% and the deviation is larger than the rebalance%, then the sell condition will be triggered (for example, the ETH% target is 50%, it will start to sell when it rises above 51%.)

Then set the execution logic: market Sell 1% ETH:

balance("ETH")/100

This means that when the rebalancing condition is triggered, the bot will start to sell ETH, and the trading won’t be stopped until the position is balanced.
Then click “Save Draft”

Step8:

Go to the subaccount management page and transfer USD into the subaccount you just set up.

Then go to Quant Zone page and enable all the rules.

After enabling all the rules, you can leave it as is. You can check the status of the bot in the transaction record:

If you want to see how much money you made, you can compare the initial capital and the wallet’s current USD value. I put 1,000 USD into the subaccount. The current account balance is $1,059.06, which means I have earned $59.06.

We’re done!
If you want to stop running the bot and get the money back, just suspend all rules then transfer the money back to the main account.

FAQ

Q1:If I have staked 25 FTT and want to use limit order to save the tx fee, what should I do?

Just change the market order to limit order, setting is as follows:

(“Post only” can ensure that it is a limit order and will not run orders at market prices)

Q2:Why is the robot not running?

The amount of money put in is insufficient.

For ETH, the smallest unit is 0.001. The order will not be placed when 1% USD amounts to less than 0.001 ETH.

The solution is to either add more USD or to increase the USD %. For example, you can use 2% USD to buy ETH.

Q3:How to solve “float division by zero in execution” error?

You’ll have to transfer money to the subaccount before running the rules.

Q4:Why not set the rebalance% to be smaller?

The smaller the rebalance% is, the more often the transactions will be executed. It will also easily sell or buy the coins too early if the price fluctuates a lot. The money you earn will probably be less than the normal rebalancing% setting.

1% is what I think is a reasonable rebalance% for the ETH grid. You can set your own parameters according to the coin you’d like to trade.

Follow me on Twitter.

--

--

Benson Sun
Benson Sun

Responses (4)