A Grok Bot has its own cloud computer with a terminal, so it can install Python libraries and run models for you, not just write the code. This guide shows how to set that up for trading research, and how to do it safely. For the background and our test results, see our companion article.
1. Ask for a project folder and a virtual environment
According to the Grok Bot documentation, project files you want to keep belong in /workspace. Ask your Bot to create a folder there and set up a virtual environment:
python3 -m venv .venv && .venv/bin/pip install statsmodels
Use a virtual environment rather than the system Python. In our test, installing into the system Python was refused with an “externally managed environment” error (PEP 668). Inside a virtual environment, statsmodels 0.15.0 installed in 14.3 seconds.
2. Install the libraries you need
- pandas for price (OHLCV) data, resampling and rolling features.
- statsmodels for regression, ADF stationarity tests, ARIMA and Markov-switching models.
- scikit-learn for classifiers and regressors.
- scipy for distributions, optimisation and hypothesis tests.
- arch for GARCH-family volatility models.
- Prophet for trend and seasonality, though it was designed for business data and is often weak on prices.
3. Starting points to ask for
These are sketches based on each library’s documentation. Ask the Bot to adapt them to your data and run them.
- Volatility:
arch_model(100*returns, vol="GARCH", p=1, q=1).fit() - Market regimes:
MarkovRegression(returns, k_regimes=2, switching_variance=True).fit(), fromstatsmodels.tsa.regime_switching.markov_regression - Walk-forward testing:
TimeSeriesSplit(n_splits=5). Train only on data from before each test period, and never shuffle the data.
4. Backtest with Freqtrade and FreqAI
If you use Freqtrade, run freqtrade backtesting on downloaded data so that fee and slippage settings stay the same between runs. FreqAI, Freqtrade’s machine-learning layer, installs with pip install -r requirements-freqai.txt or the freqtradeorg/freqtrade:stable_freqai Docker image. It retrains models periodically, and in backtests it emulates that retraining. It cannot be used with dynamic VolumePairlists, and its documentation says the example strategy “is not designed to be run in production”.
5. Know the limits
We found no published CPU, memory, GPU or runtime quota. The computer we tested had no GPU. You can let a Bot run commands on your own computer, but only with approval, set under “Execution on Local Computer” in the approvals settings. The documentation does not mention using a GPU this way, so treat that as something to try, not a feature.
6. Lock down keys and files
The security FAQ says every Bot on your account shares the same computer, so a file or login on it is available to all of them. Use exchange API keys that can trade but have withdrawals disabled. Keep keys out of notes and out of git, and consider using a separate exchange account for live trading.
7. Make runs reproducible
Pin package versions with pip freeze > requirements.txt, fix random seeds and record the date ranges of your data. Keep your code in git somewhere other than the Bot’s computer: resetting the computer in Settings rebuilds it “from your last saved snapshot; very recent changes may be lost.”
What’s still unknown
- What compute limits apply, and how heavy jobs count against plan usage.
- How well GPU work runs through a connected PC.
What to watch
- Any published quotas or GPU options for Bot computers.
- Changes in FreqAI releases.
What this means
- You can get a working statistics set-up in minutes.
- The main risks are shared keys and backtests that overfit.
- None of this is financial advice. A good in-sample fit says nothing about future returns.
Sources
- Use the computer and apps, docs.x.ai
- Approvals, security and privacy, docs.x.ai
- Security FAQ, docs.x.ai
- FreqAI documentation, freqtrade.io
- pandas, statsmodels, scikit-learn, scipy, arch, Prophet documentation
Related stories
- A Grok Bot Can Run Statistical Models on Its Own Cloud Computer (companion article)
- Quick Guide: Bring What ChatGPT or Claude Knows About You Into Grok Bot
- Quick Guide: Tame a Flood of Newsletters With a Grok Bot Daily Report
Follow @tsnmediahub on X for breaking AI news as it happens.
Follow on X





