# 08 - Historify

### Overview

Historify is OpenAlgo's historical market data manager built on DuckDB. It downloads OHLCV data from brokers and stores it locally for backtesting and analysis.

### Architecture

<figure><img src="/files/9fuJnp6qdC7k1fPLxZFN" alt=""><figcaption></figcaption></figure>

### Database (DuckDB)

**Location:** `db/historify.duckdb`

| Table             | Purpose                                                          |
| ----------------- | ---------------------------------------------------------------- |
| `market_data`     | OHLCV candles (symbol, exchange, interval, timestamp, OHLCV, oi) |
| `watchlist`       | Symbols to track                                                 |
| `download_jobs`   | Bulk download job tracking                                       |
| `job_items`       | Individual symbol status within jobs                             |
| `symbol_metadata` | Enriched symbol info (expiry, strike, lotsize)                   |

### Intervals

| Storage (Downloaded) | Computed (Aggregated from 1m) |
| -------------------- | ----------------------------- |
| `1m`, `D`            | `5m`, `15m`, `30m`, `1h`      |

Only 1-minute and Daily data are stored. Other timeframes are computed on-the-fly from 1-minute data.

### Key Features

* **Watchlist**: Track symbols for batch downloads
* **Bulk Download Jobs**: Download entire option chains with progress tracking
* **Pause/Resume/Cancel**: Job control with Socket.IO progress updates
* **Incremental Download**: Only fetch data after last available timestamp
* **CSV/Parquet Import/Export**: Data portability
* **FNO Discovery**: Find underlyings, expiries, and option chains

### Key Files

| File                               | Purpose                           |
| ---------------------------------- | --------------------------------- |
| `database/historify_db.py`         | DuckDB schema and queries         |
| `services/historify_service.py`    | Business logic and job processing |
| `blueprints/historify.py`          | Web UI routes                     |
| `frontend/src/pages/Historify.tsx` | React UI                          |

### Supported Exchanges

`NSE`, `BSE`, `NFO`, `BFO`, `CDS`, `MCX`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.openalgo.in/developers/design-documentation/utilities.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
