Skip to main content

Documentation Index

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

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

The TradeModel represents a single executed trade scraped from the Uzbekistan Stock Exchange (UZSE) website. Every row returned by the UZSE HTML trade history pages — with its Russian-language date format, ISIN identifier, and UZS-denominated values — is normalised and stored as a document in the trade-results collection. This collection is the raw source of truth that the build-candles.ts script reads when constructing OHLCV candlestick series.

Collection Details

PropertyValue
MongoDB collectiontrade-results
Mongoose modelTradeModel
TypeScript interfaceITradeDto
Databasebacktest (configured via MONGO_URI)

Fields

time
Date
required
Trade execution timestamp. The UZSE website presents dates in Russian-language format — for example, 17 апреля 2026, 16:02 — which the download/import scripts parse into a JavaScript Date stored in UTC.Indexed individually ({ time: 1 }) and as part of the compound { symbol, time } index used by the candle builder.
symbol
String
required
ISIN code of the security — e.g. UZ7011340005. This is the authoritative identifier used by UZSE in its trade records. Note that this differs from the display symbol (HMKB) stored in the candle-items collection; the build-candles.ts script accepts the ISIN as a separate argument and handles the mapping.Indexed individually ({ symbol: 1 }) and as part of the compound { symbol, time } index.
issuer
String
required
Full name of the security issuer (company) as listed on UZSE. Examples: <Hamkorbank> ATB, O'zbekiston temir yo'llari JSC. The issuer name is scraped verbatim from the exchange and may contain angle brackets or Uzbek/Russian characters.
securityType
String
required
Type of security as reported by UZSE. Common values include:
ValueMeaning
Простые акцииCommon (ordinary) stock
Привилегированные акцииPreferred stock
Additional security types (e.g. bonds, ETFs) may appear depending on the queried market.
market
String
required
Market sector (trading segment) of the trade. Common values:
ValueMeaning
STKEquities / stocks
BONBonds
The market code is used to filter the correct segment when scraping UZSE pages.
platform
String
required
Trading session or platform identifier assigned by UZSE — e.g. G1, G2. Different platforms may represent different auction mechanisms or session windows on the exchange.
tradePrice
Number
required
Price per security in UZS (Uzbekistani soums) at which this trade was executed. This value is used directly as the OHLCV price signal when aggregating 1-minute candles.
quantity
Number
required
Number of securities (shares, bonds, etc.) exchanged in this single trade. This is the raw share count, not the monetary value. It maps directly to the volume field in candle documents (candle volume = sum of trade quantity values within the period).
volume
Number
required
Total monetary value of the trade in UZS, calculated as tradePrice × quantity. This represents the full consideration exchanged, not the number of securities. See the note below about the semantic distinction between trade volume and candle volume.
hash
String
required
SHA1 deduplication fingerprint. Computed from the pipe-delimited concatenation:
symbol|time|tradePrice|quantity|volume|pageIndex|rowIndex|urlKey
where urlKey is itself begin|end|search_key — the query parameters extracted from the UZSE trade-results URL for that scrape run. The { hash: 1 } unique index means that re-importing the same UZSE export file will silently skip any row whose hash already exists in the database, making the import pipeline fully idempotent.Carries a unique: true index constraint.
createDate
Date
Creation timestamp managed automatically by Mongoose via timestamps: { createdAt: "createDate" }. Set once at insert time; never modified.
updatedDate
Date
Last-updated timestamp managed automatically by Mongoose via timestamps: { updatedAt: "updatedDate" }. Refreshed on any subsequent document save.

Indexes

IndexTypePurpose
{ hash: 1 }UniquePrevents duplicate trade imports across re-runs
{ symbol: 1, time: 1 }CompoundEfficient range queries by ISIN and date range (primary access pattern for build-candles.ts)
{ time: 1 }StandardDate-range scans across all symbols
{ symbol: 1 }StandardLookups by ISIN across all dates

TypeScript Interface

interface ITradeDto {
  /** Trade execution timestamp — e.g. parsed from "17 апреля 2026, 16:02" */
  time: Date;
  /** ISIN code of the security — e.g. "UZ7011340005" */
  symbol: string;
  /** Issuer/company name — e.g. "<Hamkorbank> ATB" */
  issuer: string;
  /** Type of security — e.g. "Простые акции", "Привилегированные акции" */
  securityType: string;
  /** Market sector — e.g. "STK" (stocks), "BON" (bonds) */
  market: string;
  /** Trading session/platform — e.g. "G1", "G2" */
  platform: string;
  /** Price per security in UZS */
  tradePrice: number;
  /** Number of securities in the trade */
  quantity: number;
  /** Total trade value in UZS (tradePrice × quantity) */
  volume: number;
  /** SHA1 deduplication key */
  hash: string;
}
Two additional interfaces extend ITradeDto:
  • TradeDocument — extends both ITradeDto and Mongoose Document; used for typed Mongoose operations.
  • ITradeRow — adds id: string, createDate: Date, and updatedDate: Date; used when reading fully-hydrated documents.

Mongoose Schema Definition

const TradeSchema: Schema<TradeDocument> = new Schema(
  {
    time:         { type: Date,   required: true,  index: true },
    symbol:       { type: String, required: true,  index: true },
    issuer:       { type: String, required: true },
    securityType: { type: String, required: true },
    market:       { type: String, required: true },
    platform:     { type: String, required: true },
    tradePrice:   { type: Number, required: true },
    quantity:     { type: Number, required: true },
    volume:       { type: Number, required: true },
    hash:         { type: String, required: true,  unique: true },
  },
  { timestamps: { createdAt: "createDate", updatedAt: "updatedDate" } }
);

TradeSchema.index({ symbol: 1, time: 1 });

const TradeModel = mongoose.model<TradeDocument>("trade-results", TradeSchema);
Trade volume vs candle volume: In UZSE trade records, the volume field is the total monetary value of the trade in UZS soums (tradePrice × quantity). In the candle-items collection, however, the volume field represents the sum of quantity (share count) across all trades in the candle period. These are different quantities with different units — always check which collection you are querying.

Deduplication Hash Details

The SHA1 hash is computed over a pipe-delimited string that includes not only the trade data itself but also the scraping context (pageIndex, rowIndex, urlKey). This means: Including scraping-context fields (pageIndex, rowIndex, urlKey) in the hash ensures that the fingerprint captures both the trade content and the scraping context, making the import pipeline fully idempotent across re-runs.

Candle Schema

The candle-items collection schema that stores aggregated OHLCV candles derived from these trades.

Data Model

How trade records flow into candles and are queried by the backtest editor.

Import Trades

How to import downloaded UZSE HTML trade files into the trade-results collection.

Build Candles

How build-candles.ts reads from trade-results and writes to candle-items.

Build docs developers (and LLMs) love