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.

CandleModel is the Mongoose model that stores pre-aggregated OHLCV (Open / High / Low / Close / Volume) candlestick records in the candle-items collection of the backtest database. Documents are produced by the build-candles.ts script, which reads raw trade data from trade-results and materialises continuous candle series for all eleven supported timeframes simultaneously. A unique compound index on { symbol, interval, timestamp } makes every write idempotent — re-running the build script never corrupts existing data.

Collection Details

PropertyValue
Collectioncandle-items
Databasebacktest
TimestampscreateDate, updatedDate (auto-managed by Mongoose)

TypeScript Interface

interface ICandleDto {
  symbol: string;           // Display ticker, e.g. "HMKB"
  interval: CandleInterval; // One of the 11 supported timeframes
  timestamp: number;        // Unix timestamp in milliseconds (start of candle period)
  open: number;             // Opening price
  high: number;             // Highest price in period
  low: number;              // Lowest price in period
  close: number;            // Closing price
  volume: number;           // Total units traded in period
}
ICandleRow extends ICandleDto with the document’s id string and the Mongoose timestamp fields createDate and updatedDate.

Supported Intervals

The interval field is validated against the INTERVAL_ENUM constant defined in the schema. Only the following values are accepted:
ValueDuration
"1m"1 minute
"3m"3 minutes
"5m"5 minutes
"15m"15 minutes
"30m"30 minutes
"1h"1 hour
"2h"2 hours
"4h"4 hours
"6h"6 hours
"8h"8 hours
"1d"1 day
The CandleInterval type is imported from backtest-kit and must match this enum. Inserting a document with any other interval string will fail Mongoose validation before reaching MongoDB.

Field Reference

symbol
string
required
Short display ticker for the security, e.g. "HMKB". This is the human-readable symbol passed on the CLI when build-candles.ts is invoked — not the ISIN code stored in trade-results. Carries a single-field index.
interval
CandleInterval
required
Timeframe of the candle. Must be one of the eleven values in INTERVAL_ENUM. Validated by Mongoose at write time and carries a single-field index to support per-timeframe queries.
timestamp
number
required
Unix epoch timestamp in milliseconds marking the start of the candle’s time period. For example, a 1h candle that covers 10:00–10:59 UTC has timestamp = 1743084000000. Carries a single-field index and participates in the unique compound index.
open
number
required
Price of the first trade that falls within the candle’s time window, in UZS.
high
number
required
Highest trade price recorded during the candle’s time window, in UZS.
low
number
required
Lowest trade price recorded during the candle’s time window, in UZS.
close
number
required
Price of the last trade that falls within the candle’s time window, in UZS. For gap-filled (zero-volume) candles this equals the close of the previous real candle.
volume
number
required
Total number of units (shares or bonds) traded during the candle’s time window. Gap-filled candles have volume = 0.

Indexes

IndexTypePurpose
symbolSingleFilter candles by ticker
intervalSingleFilter candles by timeframe
timestampSingleRange queries over time
{ symbol, interval, timestamp }Unique CompoundPrevents duplicate candles; enables exact lookups
The unique compound index is the primary deduplication guard. When build-candles.ts calls insertMany with ordered: false, any candle that already exists in the collection triggers a duplicate-key error (code 11000) which the script catches and counts as “skipped” rather than treating as a fatal error.

Import

import { CandleModel, ICandleDto, ICandleRow } from "../schema/Candle.schema";

Example Document

{
  "symbol": "HMKB",
  "interval": "1h",
  "timestamp": 1743084000000,
  "open": 4200,
  "high": 4300,
  "low": 4150,
  "close": 4250,
  "volume": 500,
  "createDate": "2026-04-18T08:00:00.000Z",
  "updatedDate": "2026-04-18T08:00:00.000Z"
}
timestamp is stored in milliseconds. To convert to a JavaScript Date, use new Date(timestamp). To get a Unix second-precision timestamp, divide by 1000: Math.floor(timestamp / 1000).

Build docs developers (and LLMs) love