Files
gocryptotrader/backtester/engine
Copilot 7134ea0393 Backtester: Fix intermittent race condition in TestExecuteStrategy (#2080)
* Initial plan

* Fix intermittent race condition in TestExecuteStrategy

Add synchronization point after async ExecuteStrategy call to wait for
background goroutine completion before resetting metadata. This prevents
the race condition where Stop() could be called after metadata reset,
causing errAlreadyRan instead of the expected errLiveOnly.

Co-authored-by: thrasher- <4685270+thrasher-@users.noreply.github.com>

* Use assert.Eventually instead of manual polling loop

Replace manual for-loop polling with assert.Eventually for cleaner
and more idiomatic test synchronization.

Co-authored-by: gloriousCode <9261323+gloriousCode@users.noreply.github.com>

* Use require.Eventually instead of assert.Eventually

Change to require.Eventually to ensure test stops immediately if the
async goroutine doesn't complete, preventing potential race conditions
from leaking into subsequent test assertions.

Co-authored-by: shazbert <9391715+shazbert@users.noreply.github.com>

* Change error message from "should" to "must"

Update assertion message to reflect mandatory nature of the condition
when using require.Eventually.

Co-authored-by: shazbert <9391715+shazbert@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: thrasher- <4685270+thrasher-@users.noreply.github.com>
Co-authored-by: gloriousCode <9261323+gloriousCode@users.noreply.github.com>
Co-authored-by: shazbert <9391715+shazbert@users.noreply.github.com>
2025-10-16 13:49:16 +11:00
..

GoCryptoTrader Backtester: Engine package

Build Status Software License GoDoc Coverage Status Go Report Card

This engine package is part of the GoCryptoTrader codebase.

This is still in active development

You can track ideas, planned features and what's in progress on our GoCryptoTrader Kanban board.

Join our slack to discuss all things related to GoCryptoTrader! GoCryptoTrader Slack

Engine package overview

The engine package is the most important package of the GoCryptoTrader backtester. It is the engine which combines all elements. It is responsible for the following functionality

  • Loading settings from a provided config file
  • Retrieving data
  • Loading the data into assessable chunks
  • Analysing the data via the handleEvent function
  • Looping through all data
  • Outputting results into a report

A flow of the application is as follows: workflow

Donations

If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:

bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc