Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/backtest-kit/uzse-backtest-app/llms.txt

Use this file to discover all available pages before exploring further.

check-gaps.ts is a diagnostic utility that inspects the trade-results MongoDB collection and identifies every calendar day between the first and last recorded trade dates that has no trade activity. Each missing day is printed with its date and Russian day-of-week abbreviation, making it easy to distinguish expected weekend gaps from unexpected weekday halts such as exchange holidays or trading suspensions.

Synopsis

npx tsx scripts/check-gaps.ts
This script takes no arguments. It operates on whatever data is currently present in the trade-results collection.

Behavior

The script performs the following steps:
  1. Connects to MongoDB — uses the MONGO_URI environment variable configured in config/setup.ts.
  2. Queries all trade timestamps — fetches the time field for every document in trade-results (projection { time: 1 }).
  3. Extracts unique calendar dates — converts each timestamp to a YYYY-MM-DD key and collects unique values into a Set.
  4. Walks the full date range — iterates from the earliest to the latest trading date, one calendar day at a time.
  5. Reports missing dates — any date absent from the set is appended to the missing list, annotated with its Russian day-of-week abbreviation.

Day-of-Week Labels

Missing dates are labelled using the following Russian abbreviations (taken from the DOW array in source):
AbbreviationDay
ВсSunday
ПнMonday
ВтTuesday
СрWednesday
ЧтThursday
ПтFriday
СбSaturday

Example Output

Trading days in DB: 247
Missing days (18):
  2023-08-12 (Сб)
  2023-08-13 (Вс)
  2023-08-14 (Пн)
  2023-08-15 (Вт)

MongoDB

SettingValue
Databasebacktest
Collectiontrade-results
ConnectionMONGO_URI env var (default: mongodb://localhost:27017/backtest)

Interpreting Results

Missing weekend dates (Сб, Вс) are expected — the UZSE does not trade on weekends. Missing weekday dates (ПнПт) indicate public holidays, exchange closures, or trading halts that should be verified against the official UZSE calendar.
The build-candles.ts script fills all detected gaps automatically. Every missing minute — including entire gap days — is represented in candle-items as a flat candle with open = high = low = close = lastClose and volume = 0. Running check-gaps.ts before build-candles.ts gives you a clear picture of how much gap-fill data will be generated.

Build docs developers (and LLMs) love