> For the complete documentation index, see [llms.txt](https://docs.uniocean.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.uniocean.io/forecast-platform/markets/market-lifecycle.md).

# Market Lifecycle

Every market follows a defined lifecycle with automatic state transitions.

```mermaid
flowchart LR
    A[Upcoming] --> B[Live]
    B --> C[Locked]
    C --> D[Settled]
    C --> E[Cancelled]
```

## Upcoming

The market has been scheduled but has not opened. Users can:

* View market details (asset, duration, entry fee)
* Subscribe to notifications (bell icon)
* Prepare their forecast
* See the start time countdown

## Live

The market is open for forecasts. This is the active prediction window.

Users can:

* View the live price chart (TradingView with Pyth data)
* See the current number of participants
* Submit predictions (up to 100 per market)
* Track the real-time rankings
* Watch their rank change as price moves
* Discuss in comments

The entry window stays open for approximately **70%** of the total duration. A visual countdown shows remaining time.

## Locked

The entry window closes. No predictions can be submitted, edited, or cancelled.

The remaining **30% cooling period** prevents last-second information advantages. This ensures all participants made their forecasts with similar time horizons.

During the locked period:

* No new predictions accepted
* Rankings continues updating (price still moves)
* Users can watch the countdown to settlement
* Comments remain active

## Settled

At settlement, the automated pipeline executes:

1. Oracle price is fetched from Pyth Network (with cryptographic attestation)
2. All predictions are ranked by accuracy using deterministic algorithm
3. Rewards are calculated via UCPRA
4. Independent validators verify the results
5. Merkle root submitted on-chain with validator signatures
6. Rewards are auto-claimed to rewarded wallets
7. Audit report is generated and published

Users can view:

* Final oracle price
* Complete ranking of all participants
* Their position and reward (if won)
* Full audit report with Merkle proofs
* Settlement transaction hash

## Cancelled

A market is cancelled if it cannot settle fairly:

| Reason                     | Threshold                                   |
| -------------------------- | ------------------------------------------- |
| Insufficient participation | Fewer than 15 predictions                   |
| Settlement timeout         | Cannot complete within 10 minutes of close  |
| Oracle unavailability      | Pyth price data not available for the asset |
| Invalid timing             | Edge cases in market scheduling             |

When cancelled:

* All participants receive 100% refund
* Refunds are automatic (no user action needed)
* System retries failed refunds

## State Transition Detection

Market state transitions are detected automatically by the platform's monitoring system:

* **Upcoming → Live**: Triggered when the scheduled start time arrives
* **Live → Locked**: Triggered when 70% of the market duration has elapsed
* **Locked → Settled**: Triggered when the close timestamp passes (settlement begins)
* **Locked → Cancelled**: Triggered by any cancellation condition

## Timing Example

| Item                   | 1-Hour Market | 12-Hour Market   |
| ---------------------- | ------------- | ---------------- |
| Market starts          | 1:00 PM       | 8:00 AM          |
| Entry closes (\~70%)   | \~1:42 PM     | \~4:24 PM        |
| Cooling period (\~30%) | \~18 minutes  | \~3 hours 36 min |
| Settlement begins      | 2:00 PM       | 8:00 PM          |
| Results available      | \~2:03 PM     | \~8:03 PM        |

***

## Related Pages

* [Understanding Markets](/forecast-platform/markets/understanding-markets.md)
* [Submitting Forecasts](/forecast-platform/markets/making-predictions.md)
* [Settlement Process](/forecast-platform/settlement/settlement-process.md)
* [Market Cancellation](/forecast-platform/markets/market-cancellation.md)
