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.
download-trades.ts is the first step in the data-ingestion pipeline. It launches a headless Chromium browser via Playwright, navigates to the UZSE trade results search, auto-detects the total number of result pages, and saves every page as an HTML file in tmp/ for the downstream import-trades.ts script to parse.
Synopsis
Parameters
ISIN code of the security to query, e.g.
UZ7011340005. This value is passed directly as the search_key query parameter to the UZSE trade results endpoint.Start date of the range in
DD.MM.YYYY format, e.g. 01.03.2026. Inclusive.End date of the range in
DD.MM.YYYY format, e.g. 31.03.2026. Inclusive.Market sector code passed as
mkt_id. Defaults to STK when omitted. Common values:| Value | Description |
|---|---|
STK | Equities market |
BON | Bonds market |
Constants
The following retry and timeout constants are compiled into the script:| Constant | Value | Description |
|---|---|---|
TIMEOUT | 30000ms | Maximum wait time per page navigation before triggering a retry |
RETRIES | 10 | Maximum number of fetch attempts per page before aborting |
RETRY_DELAY | 30000ms | Pause between retry attempts |
Behavior
The script performs the following steps in order:- Clears
tmp/— deletes every existing.htmlfile from thetmp/directory before starting, ensuring a clean slate. - Launches Chromium — opens a headless Playwright browser instance.
- Fetches page 1 — navigates to the first results page and saves it as
tmp/trades_page_1.html. Scans the HTML for the paginationclass="last next"anchor to determinetotalPages. - Downloads pages 2..N — iterates from page
2tototalPages, saving each astmp/trades_page_N.html. Each fetch is retried up toRETRIEStimes withRETRY_DELAYbetween attempts on timeout. - Closes browser — disposes the Playwright browser after all pages are saved.
URL Pattern
Each page is fetched from:Output Files
Saved undertmp/ relative to the project root:
The
tmp/ directory is created automatically if it does not exist. All files written here are consumed and deleted by import-trades.ts after parsing.Exit Codes
| Code | Meaning |
|---|---|
0 | All pages downloaded successfully |
1 | Missing required arguments, or an unrecoverable error |