- None of this is investment advice.
- Users should use the Quant Zone at their own risk.
- The below are rough descriptions of how Quant Zone Rules are designed to work, but they make some approximations and should not be taken to be precise. There are no guarantees that rules or the platform will always be available or execute as intended.
- The Quant Zone, like the rest of FTX, is not being offered to US users.
PLEASE NOTE RULES ARE DESIGNED TO LOOP EVERY 10-20 SECONDS
FTX Quant Zone Homepage: https://ftx.com/quant-zone
FTX Quant Zone Telegram: https://t.me/Ftx_Quant_Zone
What Are Quant Zone Rules
Rules let you say things like "when BTC goes above $9,000, get 2x short BTC". They also let you express more complicated rules, like "if BTC is above $8500 and the BTC-PERP premium to its index is above 1, then sell 5 BTC-PERP and buy 5 BTC".
How Do I Build A Rule?
Go to your Rules page and click "CREATE NEW RULE".
Each rule has two sections: the trigger, and the actions.
The Trigger of a Rule is the condition that causes the rule to happen. You can enter a trigger using arbitrary formulas that reference FTX market data, your account, and mathematical functions.
For instance, if you wanted to have your rule trigger when BTC goes above $9k, your trigger could be
price("BTC-PERP") > 9000
For a more complicated example, if you wanted your rule to trigger when BTC-PERP goes above $9k, it's at a premium to its index, you are flat BTC-PERP, and BTC was below $9k 1 minute ago, your rule could be:
(price("BTC-PERP") > 9000) and (premium("BTC-PERP") > 1) and (position_net("BTC-PERP") == 0) and (price("BTC-PERP",1) < 9000)
Here you specify what happens when your rule triggers. So if you wanted to get 3x long BTC-PERP when BTC goes above $9k, your action could look like this:
You can string together multiple actions if you want.
Once you're done designing your rule, you can click "SAVE DRAFT" to save it, or "SAVE AND RUN" to save it and immediately start running the rule.
On your rules page, you'll see all active rules. Click on a rule to edit, disable, enable, copy, or delete it.
Below that you can also see your Logs, which will contain a complete history of orders placed by your rules.
How Rules Trade
Roughly 15 seconds, each rule is intended to check whether its trigger is true. If so, it is intended to execute its action.
Note that if a rule is enabled and triggers, it will keep executing its action as long as the trigger is still true unless you use Pause Rule. This means that if you have a trigger of "BTC-PERP is above $9k" and an action of "get 3x long BTC-PERP", your rule will keep adjusting your position to be 3x long BTC-PERP as long as BTC is above $9k. If you don't want this, either use a Pause Rule action, or do something so that the Trigger Condition is no longer true. For instance if your trigger condition has ... and get_variable("v1") < 3 as a condition and then you add Set Variable, v1, 5 as an action, it'll only trigger once (unless some other rule modifies it).
Note, also, that all rules--and all actions within a rule--run simultaneously. This means that if you set the value of a variable, that won't be recognized until the next loop, and if you send orders, your balance won't update until the next loop.
How Can You Store State?
By default, rules are mostly just functions of the current state of the world: they evaluate the trigger every 15s and if it's true they take the actions. This means that if your trigger is price("BTC-PERP") > 9000 and your action is to buy 1 BTC-PERP, you'll buy 1 BTC-PERP every 15 seconds as long as BTC is above $9k.
There are two actions to store information:
You can use Pause Rule to sleep for a duration. This way, if a rule triggers, you can wait before considering whether to trigger it a second time.
In addition, you can store arbitrary information. Using a Set Variable action will assign a numerical value to a variable with some name. You can then later reference that with get_variable("name").
So, for instance, if you wanted to increase your order size by 1 each time you sent, you could have one of the actions be
Set Variable; "v1"; get_variable("v1")+1
and then you could send an order with size
Variables exist across rules, so you can set one with one rule and then reference it with another.
Note that all variables have to be numbers. If you want to treat a variable like a boolean, consider using 0 and 1.
What Can Rules Access?
Rules have access to all of the funds and trading capabilities of their subaccount. So they can trade on any FTX market and access all of the funds in your wallet, but they can't touch funds or positions from other subaccounts.
How to Move Rules Between Subaccounts?
To quickly do this:
1) Copy rule.
2) Switch to desired subaccount.
3) Save rule.
There's a lot of details to the Quant Zone and this FAQ doesn't spell everything out. If you have questions feel free to ask us!
Be careful about how you interpret triggers. For instance, price("BTC-PERP") > 9000 means "during the most recent cycle, the mark price of BTC-PERP was above $9000", with cycles every 15 seconds.