This guide walks you through the complete end-to-end workflow — from cloning the repository to opening an interactive Pine Script chart — using the Uzbekistan Stock Exchange symbol HMKB (Hamkorbank) as a concrete example. Each step is a discrete script you can re-run independently, making it easy to add new symbols or date ranges later without repeating the full setup.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.
Clone the repository and install dependencies
Start by cloning the project and installing all Node.js packages. The project uses After installation, your
npx tsx to run TypeScript scripts directly without a separate compile step, so no build phase is required after npm install.node_modules will contain all required packages including the backtest-kit suite, Playwright, and Mongoose. You can verify the key packages are present:Start MongoDB
UZSE Backtest App stores all trade records and candles in MongoDB. You must have a running MongoDB instance before executing any of the pipeline scripts.The app connects to For a full Docker Compose setup that also includes Redis and MinIO, see the MongoDB infrastructure guide.
mongodb://localhost:27017/backtest by default. You can override this by setting the MONGO_URI environment variable before running any script:Download trade data from uzse.uz
The download script launches a headless Chromium browser via Playwright, navigates to the paginated trade results on You should see output similar to:The ISIN
uzse.uz, and saves each page as an HTML file in the local tmp/ directory.The arguments are: <ISIN> <begin_date> <end_date> and an optional [mktId] market identifier (defaults to STK) where dates use the DD.MM.YYYY format.UZ7011340005 corresponds to HMKB (Hamkorbank). Each HTML file covers one page of trade results for the specified date range. Files are written to tmp/trades_page_1.html, tmp/trades_page_2.html, and so on.Import trades into MongoDB
Once the HTML files are saved in Expected output:The deduplication hash ensures that re-running this script against the same HTML files is safe — existing records are silently skipped, so you will never end up with duplicate trades in your database.
tmp/, the import script parses each file, extracts trade rows (timestamp, symbol, price, quantity, volume), computes a SHA-1 deduplication hash per row, and upserts the records into the trade-results MongoDB collection.Build OHLCV candles for HMKB
With raw trades in MongoDB, run the candle builder. Provide the ticker symbol and its ISIN as arguments. The script aggregates trades into 1-minute buckets, fills intraday and holiday gaps, and then rolls the 1m series up to all supported higher timeframes.Expected output:After this step, the
candle-items collection holds candles for all eleven timeframes. The unique index { symbol, interval, timestamp } guarantees idempotency — re-running the script will not create duplicates.To verify the data landed correctly, you can query MongoDB directly:Launch the visual editor
Start the backtest-kit editor with the standard npm script. This launches the Open
@backtest-kit/cli server, which serves the visual editor UI and connects to your local MongoDB instance through the custom mongo-exchange adapter defined in modules/editor.module.ts.http://localhost:8080 in your browser. In the editor, set the exchange to mongo-exchange, the symbol to HMKB, choose a timeframe (e.g. 1d), and the chart will render the candles you built in the previous step. From here you can apply any Pine Script indicator from the @backtest-kit/pinets library.For a full walkthrough of the editor interface, see the Visual Editor guide. To learn how to write and attach custom Pine Script strategies, see the Pine Script guide.What’s Next
Now that your first symbol is live in the editor, explore the rest of the documentation to go deeper:Check Gaps
Use
check-gaps.ts to identify which days the exchange was closed or had no trades, so you can audit your data completeness.Bulk Fetch
Generate a shell script that downloads and imports every month of trade history in a single overnight batch run.
Pine Script
Apply built-in and custom Pine Script indicators and strategies to your UZSE candle data in the editor.
Timeframes Reference
Review all eleven supported timeframes and how the candle aggregation algorithm handles each one.