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.
download-trades.ts is the first step in the UZSE data pipeline. It launches a headless Chromium browser via Playwright, navigates to https://uzse.uz/trade_results with the parameters you supply, auto-detects how many result pages exist, and saves each page as an HTML file in the local tmp/ directory for the next import step to consume.
Usage
Arguments
ISIN code of the security to query, e.g.
UZ7011340005.Start date of the query window in
DD.MM.YYYY format, e.g. 01.01.2024.End date of the query window in
DD.MM.YYYY format, e.g. 31.01.2024.Market sector to filter by. Defaults to
STK when omitted.| Value | Description |
|---|---|
STK | Equity / stocks market |
BON | Bond market |
Example
URL Pattern
For each pageN, the script builds and fetches:
.last.next CSS selector in the first page’s HTML to read the highest available page number.
Behavior
Clear stale HTML
Before any network requests are made, all existing
.html files are deleted from tmp/ to prevent stale data from a previous run mixing with new results.Fetch page 1 and detect total pages
The script fetches page 1 and inspects the pagination markup. The regex
/class="last next">\s*<a[^>]+[?&](?:amp;)?page=(\d+)/ extracts the last page number. If no pagination element is found, the total is assumed to be 1.Download remaining pages
Pages 2 through N are fetched sequentially. Each page is written to
tmp/trades_page_N.html.Retry Logic
Network timeouts onuzse.uz are common. The script retries automatically before giving up.
| Parameter | Value |
|---|---|
TIMEOUT | 30 s |
RETRIES | 10 |
RETRY_DELAY | 30 s |
Output
Saved files follow the naming conventiontmp/trades_page_N.html where N is the 1-based page index. A summary line is printed after the last page:
The
tmp/ directory is created automatically if it does not already exist. Ensure the process has write permissions to the project root.Next Step
Once the HTML pages are saved totmp/, proceed to Import Trades to parse them and insert the records into MongoDB.