Logo

hw98_console_prompt.avif Backtesting trading strategies on historical data

Reliable portfolio backtesting. Quant research level quant

hamster-bot/tester - Advanced tool for testing your trading systems on historical data.

    hw98_console_prompt.avif Backtester features:
  • Run multiple strategy types across different timeframes simultaneously.
  • All of this with a shared balance, to understand how strategies coexist in one wallet in real time.
  • Tick data support. Simulates strategy behavior inside a candle as in live trading.
  • No limits on input market data. Run tests for any historical period.
  • Test complex custom logic that cannot be accurately tested with off-the-shelf solutions without workarounds.
  • Backtests run on the same production code used by the bot in real time.

Implemented as a separate connector hw98_console_prompt.avif to an "exchange" (a Mock object replacing the real exchange). This makes it possible to test all previously written bot code. The bot thinks it is connected to a real exchange (places orders, receives balances and position info). The virtual exchange stub performs all calculations and generates the report.

hw98_console_prompt.avif Market data for testing

Crypto exchanges publicly share historical market data. Examples: public.bybit.com, data.binance.vision, public.bitmex.com.
The tester downloads the required trade data range and builds candles for the bot. Before the test starts, the tester also downloads extra data to warm up all TA indicators used by the strategy.
Data is saved to hw98_console_prompt.avif folder tester/data/{symbol}. You can also put your own data in CSV format into this folder.


hw98_console_prompt.avif Tester behavior

From the bot’s perspective, the tester is just another exchange. The bot connects to it and starts receiving candles, placing orders, etc. Meanwhile, the tester simply emulates real exchange behavior.
Balance is shared across all strategies. Behavior is similar to BYBIT/BINANCE futures with cross margin. The bot can request Wallet or Margin balance. Margin balance is calculated including all open positions and their unrealized PnL.
Real price behavior. When the bot requests the current unfinished candle, the tester returns trade prices from tick data (until market data inside the candle is exhausted and then moves to the next candle). This allows strategies that depend on intrabar pricing (for example, slippage, trailing stops, etc.) to work correctly.


hw98_console_prompt.avif Report

After testing is complete, a detailed HTML report is saved to hw98_console_prompt.avif folder tester/report.

    Report includes:
  • Overall metrics for the entire trading system:
    • Starting and ending balance
    • Total profit/loss in USDT and %
    • Maximum drawdown
    • Number of trades
    • Win rate
    • Profit Factor
    Hamster Bot Backtesting
  • Separate candlestick charts for each strategy, with trade markers and strategy TA visualization. Hamster Bot Backtesting
  • Margin balance chart (including all open positions and unrealized PnL) and Wallet balance chart. Hamster Bot Backtesting
  • Chart showing the total size of open positions in USDT (and a separate-axis % line showing the ratio of total open positions to Margin balance)Hamster Bot Backtesting
  • Tables with full trade lists for each strategy. Hamster Bot Backtesting
  • List of strategy settings and tester parameters.
  • Summary information across all strategies. Trading volume and paid commissions.Hamster Bot Backtesting


hw98_console_prompt.avif Tester parameters

file: config_tester.json
name_comment - comment for the test
InitialBalance - initial balance for backtesting
StartDate - backtest start date in format 2026-02-03T00:00:00
EndDate - backtest end date in format 2026-02-13T00:00:00
WarmupDays - number of warmup days before the backtest starts
MakerFee - maker fee (0.0001 = 0.01%)
TakerFee - taker fee (0.0001 = 0.01%)
SlippagePercent - slippage for market orders (0.0001 = 0.01%)
UpdateData - update data before backtesting (true/false)
use_logger - use logger. If disabled, backtesting runs faster (true/false)

Hamster Bot Backtesting

Also, all bot strategies are available in PineScript format for backtesting on TradingView.