- 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.
PLEASE NOTE RULES ARE DESIGNED TO LOOP EVERY 10-20 SECONDS
FTX US Quant Zone Homepage: https://ftx.us/quant-zone
FTX Quant Zone Telegram: https://t.me/FTX_US_Official
What Are Quant Zone Rules
Rules let you say things like "when BTC goes above $9,000, place a market buy on BTC/USD with a size of 1". They also let you express more complicated rules, like "if BTC is above $8500 and my BTC wallet balance is less than 1, place a market buy order for 1 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 US 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/USD") > 9000
For a more complicated example, if you wanted your rule to trigger when BTC/USD goes above 9000 and is lower than the average price of BTC/USD over the last 30 minutes, your trigger could be:
price("BTC/USD") > 9000 and 9000 < average_price("BTC/USD", 30)
Here you specify what happens when your rule triggers. So if you wanted to place a limit order for 1 BTC with a limit price of $8000 when BTC goes over $9k USD, 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/USD is less than $9000 USD" and an action of "Buy .01 BTC", your rule will continue to execute a buy for .01 BTC roughly every 15 seconds so long as the rule is still true. 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/USD") > 9000 and your action is to buy 1 BTC, you'll buy 1 BTC 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 US 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/USD") > 9000 means "during the most recent cycle, the mark price of BTC/USD was above $9000", with cycles every 15 seconds.
Rules run out of the FTX server. While rules are located right next to the matching engine, they also generally cycle only once every 15 seconds, and so aren't great for strategies that require lower latency than that. There are no guarantees that a rule will always execute as intended, or that a trigger will always invoke the rule in all circumstances. For example only, and without limitation, there could be extreme trading volume, delays in Internet, latency of hosting provider, or other technology instability that results in a rule not being triggered or executed. FTX IS NOT RESPONSIBLE FOR ANY ACTUAL OR FORECASTED LOSSES DUE TO SUCH ERRORS OR CAUSES. See our Terms of Service for further limitations.