> ## Documentation Index
> Fetch the complete documentation index at: https://docs.voxfi.com.br/llms.txt
> Use this file to discover all available pages before exploring further.

# Markets

> Understanding markets in prediction markets

## What is a Market?

A **Market** in VoxFi is a tradable contract within an event. An event can contain **one or multiple markets**, each representing a specific outcome or question.

**Important**: Markets are **always obtained from their respective events**. There is no direct endpoint to fetch markets in isolation - you must first get the event and then access its markets through the `markets` property in the event response.

### Key Features

* **Binary Outcomes**: Each market has two possible outcomes: `YES` or `NO`;
* **Trading**: Users can buy or sell contracts for any outcome;
* **Price**: Market prices range from 0 to 100 ticks, representing probability;
* **Liquidity**: The amount of capital available for trading (in ticks, cached);
* **Volume**: Total trading volume in the market (in ticks, cached).

### Relationship with Events

* **Single Market Event**: An event with `is_single_market: true` has only one market;
* **Multi-Market Event**: An event can have multiple markets, each representing different aspects or questions related to the main event.

### Market Example

```json theme={null}
{
      "id": "95f88394-4f4d-4489-99dc-8cef9f7682ee",
      "description": "",
      "metadata": {},
      "thumbnail_url": null,
      "options": [
        {
          "id": "13f89ed4-8cc0-4d72-bc64-88faf17ef386",
          "option_type": 1,
          "description": "Yes",
          "metadata": {}
        },
        {
          "id": "230d9631-b35a-4fbc-970d-39a60df7a7c6",
          "option_type": 2,
          "description": "No",
          "metadata": {}
        }
      ],
      "volume": 29500,
      "closed_at": null,
      "resolved_at": null,
      "settled_at": null,
      "liquidity": 32051,
      "winner_option_type": null
    }
```

## Market Options

Each market has **exactly two options**, with a **fixed and immutable** mapping between the option type and its meaning.

### Official Mapping

* `1` → **YES**
* `2` → **NO**

This mapping **never changes** in any market.

### Option Structure (JSON)

```json theme={null}
{
  "id": "string",
  "option_type": 1,
  "description": "YES",
  "metadata": {}
}
```

## Market States

Markets can be in different states:

* **Active**: Market is awaiting opening;
* **Active**: Active trading is allowed;
* **Closed**: Trading is closed, awaiting resolution;
* **Resolved**: Outcome has been determined;
* **Settled**: Contracts have been settled and payouts distributed.

## Use Cases

* **Get Markets from an Event**: Fetch a specific event to access all its markets through the `markets` property;
* **List Available Markets**: Browse events to discover markets available for trading;
* **Analyze Event Markets**: Examine all markets related to an event to understand the different possible questions or outcomes;
* **Trade in Markets**: Identify specific markets within events to buy or sell contracts;
* **Monitor Volume and Liquidity**: Track market metrics (volume, liquidity) through data returned with the event;
* **Check Market States**: Check the current state of markets (active, closed, resolved, settled) to determine if they are available for trading.
