This skill provides a fully functional mock (paper) trading environment. It allows OpenClaw to simulate algorithmic trading by fetching live market data, evaluating algorithmic strategies, and updating a virtual portfolio.
assets/portfolio.json: A template virtual bank account containing $10,000 USD. scripts/mock_bot.py: A python script that executes a single "tick" of the trading bot. It fetches the current price, evaluates the strategy based on price history, executes mock trades, and updates the portfolio file.When a user asks to start a mock trading session:
Copy the template portfolio to the user's working directory.
```bash
cp {baseDir}/assets/portfolio.json ./my_portfolio.json
```
Run the bot script. This executes a single cycle (fetch data -> evaluate -> trade -> save).
```bash
uv run {baseDir}/scripts/mock_bot.py --portfolio ./my_portfolio.json --asset bitcoin
```
To run the bot continuously, add the command from Step 2 into the user's HEARTBEAT.md file or schedule it via cron to run every 5-10 minutes.
Read ./my_portfolio.json to report the user's current PnL, cash balance, and trade history.
The script currently defaults to an SMA Crossover strategy. You can edit the python script locally to swap it with Mean Reversion, Momentum Breakout, or RSI strategies if the user requests different logic.
共 1 个版本