# Price Index Module

In addition to the core NFT sale and trade functionalities, the SALE contract also includes the `PRICE_INDEX` and `LIQUIDITY` modules to provide comprehensive price tracking and liquidity analysis capabilities. These modules enhance the overall marketplace experience by offering valuable insights into market dynamics and trends.

#### Price Index Module (`PRICE_INDEX`)

This module tracks and stores price history and trading volume data for NFT collections. It allows users to analyze price trends over different time intervals, understand market volatility, and make informed trading decisions.

**Key Features:**

* **Price Data Tracking:** The module records price and volume data for each trade, storing it in `PricePoint` structs.
* **Time Intervals:** Price data is aggregated and stored for various time intervals, including 1 minute, 5 minutes, 15 minutes, 1 hour, 4 hours, and 1 day.
* **Historical Data:** Users can access historical price data for any supported time interval using the `get_price_history` function.
* **Current Price and Volume:** The module provides functions to retrieve the current price (`get_current_price`) and 24-hour volume (`get_24h_volume`) for a collection.

**Functions:**

* **`create_price_index`:** Creates a new price index for a given collection.
* **`update_price`:** Updates the price index with new trade data.
* **`get_price_history`:** Retrieves historical price data for a specified time interval.
* **`get_current_price`:** Returns the current price for a collection.
* **`get_24h_volume`:** Returns the 24-hour trading volume for a collection.


---

# 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.artinals.com/artinals-protocol/sale-module/price-index-module.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.
