- 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.US Quant Zone Telegram: https://t.me/FTX_US_Quant_Zone
What Are Quant Zone Rules
Rules let you say things like "when BTC goes above $9,000 buy $5000 of BTC". They also let you express more complicated rules, like "if BTC is above $8500 and you have less than $1000 in Fiat, then sell 5 BTC/USD ".
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
Here you specify what happens when your rule triggers. So if you wanted to buy 3 BTC/USD 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/USD is above $9k" and an action of "BUY 3 BTC/USD", your rule will keep adjusting your position BUY 3 BTC/USD 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/USD") > 9000 and your action is to buy 1 BTC/USD, you'll buy 1 BTC/USD 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.
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.