Inspecting OctoBot Backtests and Updating Strategy Test Expectations
Summary
This developer guide explains two practical tasks for working with OctoBot strategies. Backtesting data collected through the regular collector is stored in SQLite files, which can be opened in a database browser to inspect historical candle records supplied by the exchange.
For strategy test development, the guide shows how to change a functional test helper so it prints the measured and expected profitability values while disabling the equality assertion. This lets developers examine updated results without stopping the test run on a mismatch. The example is a debugging aid, not a method for evaluating whether a strategy is sound: removing the assertion means the test no longer checks that profitability matches its expected value. The page provides no trading analysis or performance evidence.
Key ideas
- OctoBot backtesting records are stored as SQLite databases.
- A SQLite viewer can be used to inspect collected historical candle data.
- Strategy tests can print observed and expected profitability for debugging.
- Disabling the assertion allows a failing result to pass, so it weakens the test’s validation.
Tags
Full text
# Astuces pour les développeur
---
title: "Astuces pour developpeurs"
description: "Profitez de nos conseils pour vous lancer rapidement en tant que développeur OctoBot. Explorez les fichiers de backtesting SQLite en utilisant un navigateur SQLite et testez vos stratégies."
sidebar_position: 9
---
# Astuces pour les développeur
:::info
La traduction française de cette page est en cours.
:::
## Données de Backtesting
[Backtesting](/guides/octobot-usage/backtesting) data files are sqlite database files. When using the regular data collector, these files contain every historical candles the requested exchange is willing to give. You can use a <a href="https://sqlitebrowser.org/" rel="nofollow">SQLite browser</a> to explore these files.
## Testes de stratégies
To quickly check tentacles strategy tests states or develop a new tentacles strategy test, change the following lines in **octobot/tests/functional_tests/strategy_evaluators_tests/abstract_strategy_test.py**:
```python
def _handle_results(self, independent_backtesting, profitability):
exchange_manager_ids = get_independent_backtesting_exchange_manager_ids(independent_backtesting)
for exchange_manager in get_exchange_managers_from_exchange_ids(exchange_manager_ids):
_, run_profitability, _, market_average_profitability, _ = get_profitability_stats(exchange_manager)
actual = round(run_profitability, 3)
# uncomment this print for building tests
# print(f"results: rounded run profitability {actual} market profitability: {market_average_profitability}"
# f" expected: {profitability} [result: {actual == profitability}]")
assert actual == profitability
```
into
```python
def _handle_results(self, independent_backtesting, profitability):
exchange_manager_ids = get_independent_backtesting_exchange_manager_ids(independent_backtesting)
for exchange_manager in get_exchange_managers_from_exchange_ids(exchange_manager_ids):
_, run_profitability, _, market_average_profitability, _ = get_profitability_stats(exchange_manager)
actual = round(run_profitability, 3)
# uncomment this print for building tests
print(f"results: rounded run profitability {actual} market profitability: {market_average_profitability}"
f" expected: {profitability} [result: {actual == profitability}]")
# assert actual == profitability
```
This will not stop tests on failure and display the current tests results as well as expected values.Shown in full with attribution under the source's licence. Licence: GPL-3.0
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.