FreqAI bots
A FreqAI bot is a bot like any other in Wickfleet: one registry entry, one container, the same fleet views. Two things are specific to it. A strategy spec can trade on the model's prediction, and a replay of a FreqAI bot runs with more memory and without the bias checks.
A FreqAI bot in the registry
| Bot field | What it does |
|---|---|
freqaimodel | the model class. Wickfleet passes it to freqtrade as --freqaimodel, for the bot and for every replay of it |
config_extra.freqai | the bot's FreqAI config, as freqtrade reads it. The feature settings sit under feature_parameters: indicator_periods_candles, include_timeframes, include_corr_pairlist, label_period_candles |
image | the key of an image the admin listed in WICKFLEET_IMAGES and in the guard's WFGUARD_IMAGES. It must point at a freqtrade image that ships FreqAI, for example the stable_freqai tag. PyTorch models need stable_freqaitorch, reinforcement learning needs stable_freqairl. The quick start lists only the plain freqtrade key |
freqaimodel and config_extra are set in the bot's registry file. The bot form in the UI does not offer them.
A model in a strategy spec
A strategy can be a small JSON spec instead of Python. Add model and the conditions can use two more operands: prediction and do_predict.
{
"version": 1,
"name": "FreqaiExample",
"timeframe": "1h",
"stoploss": -0.10,
"model": {"features": "freqai_example", "target": "mean_return"},
"startup_candles": 40,
"entry_guard": {"max_above_close": 0.0025},
"indicators": [],
"entry": {"all": [
{"left": "do_predict", "op": "==", "right": 1},
{"left": "prediction", "op": ">", "right": 0.02}
]},
"exit": {"all": [
{"left": "do_predict", "op": "==", "right": 1},
{"left": "prediction", "op": "<", "right": 0}
]}
}
| Key | Meaning |
|---|---|
model.features | freqai_example, a fixed feature set that follows freqtrade's FreqAI example strategy |
model.target | mean_return: the mean close over the next label_period_candles, as a return |
prediction | the model's predicted return. 0.02 is 2% |
do_predict | FreqAI's outlier flag, an integer from -2 to 2. == 1 means the prediction is trustworthy |
startup_candles | required with a model, because the indicator periods live in the bot's FreqAI config and not in the spec |
entry_guard.max_above_close | refuses a buy filled too far above the last close |
A spec with a model only runs on a FreqAI bot. Saving a bot through the hub with such a spec is refused, with the reason, unless the bot has both freqaimodel and a freqai config.
Replays of a FreqAI bot
| Part | Plain bot | FreqAI bot |
|---|---|---|
| Memory per replay container | 1536 MB, WICKFLEET_REPLAY_MEM_MB | 3072 MB, WICKFLEET_REPLAY_FREQAI_MEM_MB |
| Candles fetched | the bot's pairs and timeframe | plus the model's include_timeframes. The include_corr_pairlist pairs are in the hub's daily store fetch |
| Lookahead and recursive analysis | run after the backtest | skipped and shown as skipped. Freqtrade's analysis supports FreqAI strategies, but it retrains the model for every signal it checks, which is too slow for a replay |
| Robustness verdict | the same for both: walk-forward windows and Monte Carlo over the replay's trades | |
| Live trading | a clean lookahead result and a passed robustness verdict | not yet. Live needs a clean lookahead result, which a skipped check never gives, so the hub refuses with "FreqAI bots need the FreqAI live rule, not built yet" |
A FreqAI bot can sit in a comparison next to plain bots, since each bot there is an ordinary replay job.
A prediction is a model's guess from past candles. The replay shows how that guess would have traded, not how it will.