# Fairground - [Protocol Overview](https://docs.fairground.fi/index.md): Fairground is a perpetuals exchange with no periodic funding payments, built around a single oracle price. - [Official Links](https://docs.fairground.fi/official-links.md): Trading app, socials, and other official resources. - [Trading Hours](https://docs.fairground.fi/trading-hours.md): Market hours for crypto, FX, commodities, and stocks, and what happens when a market is closed - [Overview](https://docs.fairground.fi/faqs/overview.md) - [Market Design](https://docs.fairground.fi/faqs/market-design.md) - [Troubleshooting](https://docs.fairground.fi/faqs/troubleshooting.md): Common problems and what causes them - [Season 4](https://docs.fairground.fi/faqs/season-4.md) - [Fairground Referrals](https://docs.fairground.fi/faqs/referrals.md) - [Onboarding](https://docs.fairground.fi/trading/onboarding.md): Get set up to trade on Fairground - [Orders](https://docs.fairground.fi/trading/orders.md): How to place and modify positions - [Pricing](https://docs.fairground.fi/trading/pricing.md): How orders use the oracle price, and how bad prices are handled - [Fees and Rebates](https://docs.fairground.fi/trading/fees-rebates.md): Trade fees, impact fees, and rebates - [PnL](https://docs.fairground.fi/trading/pnl.md): How Segment PnL and Lifetime PnL are calculated - [Advanced Trading Overview](https://docs.fairground.fi/trading/advanced/overview.md): Deep dive into order matching, liquidations, the insurance fund, and ADL. - [Order Matching](https://docs.fairground.fi/trading/advanced/order-matching.md): How orders are matched and filled - [Liquidation](https://docs.fairground.fi/trading/advanced/liquidation.md): How liquidation works, when it triggers, and what happens to your margin - [Insurance Fund](https://docs.fairground.fi/trading/advanced/insurance-fund.md): When and how the insurance fund is used - [ADL (auto-deleveraging)](https://docs.fairground.fi/trading/advanced/adl.md): What ADL is, when it triggers, and what happens to positions - [Glossary](https://docs.fairground.fi/trading/advanced/glossary.md): Definition of terms used in the protocol - [XP Program](https://docs.fairground.fi/earn/xp-program.md) - [XP Program Terms](https://docs.fairground.fi/earn/xp-program-terms.md) - [Market Makers / LPs](https://docs.fairground.fi/earn/market-makers-lps.md): For liquidity providers and integrators - [Overview](https://docs.fairground.fi/developers/overview.md): Integrate with Fairground - [API keys](https://docs.fairground.fi/developers/api-keys.md): Create an API key and use it to authenticate API requests - [Use with AI](https://docs.fairground.fi/developers/use-with-ai.md): Connect AI assistants and coding tools to the Fairground docs - [Error Selector Reference](https://docs.fairground.fi/developers/error-selector-reference.md): Decode on-chain revert reasons from their 4-byte hex. - [Introduction](https://docs.fairground.fi/developers/api-reference/introduction.md): Fairground API reference and integration guide - [GetUserFills](https://docs.fairground.fi/api-reference/trades/getuserfills.md): Returns individual trade-history records (fills) for one wallet, optionally scoped to a time range. Results are ordered oldest first (ascending by block time). - [GetMarketConfigs](https://docs.fairground.fi/api-reference/markets/getmarketconfigs.md): Returns the full configuration for one market, resolved by numeric `market_id` or by `market_symbol`. - [GetMarketIdByName](https://docs.fairground.fi/api-reference/markets/getmarketidbyname.md): Returns the numeric `market_id` for a market, looked up by `asset_symbol` and optional `quote_symbol` (for example `BTC`). Use it to turn a market name into the id that other endpoints accept. - [GetMarketSummary](https://docs.fairground.fi/api-reference/markets/getmarketsummary.md): Returns a live trading summary for one market: open interest, 24h price change and volume, the current oracle price, whether the market is open for trading, executable standard-order interest, resting no-rush order interest, and the current trade fee rate. - [GetMarkets](https://docs.fairground.fi/api-reference/markets/getmarkets.md): Returns the full configuration for every active market, ordered by `market_id` ascending. - [GetOrderBook](https://docs.fairground.fi/api-reference/orderbook/getorderbook.md): Returns a simulated aggregated order-book depth for one market: bid and ask price levels, each bucketed by `tickSize` and sorted toward the best price. Resolved by `market_id` or `market_symbol`. - [GetOrder](https://docs.fairground.fi/api-reference/orders/getorder.md): Returns the current stored state of one order, identified by the composite key `order_id` + `market` + `reduce_only`. Order IDs are not globally unique: the same numeric ID can exist as both a position-opening order and a reduce-only order in the same market, so `reduce_only` must match the kind… - [GetOrders](https://docs.fairground.fi/api-reference/orders/getorders.md): Returns the latest stored state of each order associated with `address`, optionally filtered to one market. Results include position-opening and reduce-only orders across active and terminal statuses. This endpoint does not return order lifecycle events or individual fills. - [DeleteApiKey](https://docs.fairground.fi/api-reference/permissions/deleteapikey.md): Deletes the API key with the given `id` for `user_address`. Use `ListApiKeys` to find the id. - [GenerateApiKey](https://docs.fairground.fi/api-reference/permissions/generateapikey.md): Creates a new API key for `user_address`, with an optional `label`. The key value is returned only in this response, so store it securely: `ListApiKeys` returns key ids and labels, not key values. Each wallet can have up to 3 active keys; requesting a fourth returns `resource_exhausted`. - [ListApiKeys](https://docs.fairground.fi/api-reference/permissions/listapikeys.md): Lists the API keys for `user_address`: each key's `id`, `label`, and creation time. Key values are not returned. - [GetPortfolio](https://docs.fairground.fi/api-reference/portfolio/getportfolio.md): Returns an aggregated portfolio snapshot for one wallet: margin, PnL, volume, fee, and equity totals, plus the wallet's currently open positions and open orders. - [GetOpenPositions](https://docs.fairground.fi/api-reference/positions/getopenpositions.md): Returns all currently open positions for one wallet, across all markets. `address` is required (matched trimmed and case-insensitively). Results are ordered by timestamp descending, most recent first. - [GetHistoricalPrices](https://docs.fairground.fi/api-reference/prices/gethistoricalprices.md): Returns oracle-price OHLC candles for one market from `start_time` (inclusive) to `end_time` (exclusive). `interval` sets the candle width and defaults to 1 hour. Supports `limit`/`offset` pagination. Only the `market_id` form of the market selector is supported. - [GetPrice](https://docs.fairground.fi/api-reference/prices/getprice.md): Returns the current oracle price for one market, with its `market_id`, canonical name (for example "BTC-USD"), and the time the price was printed. Resolved by `market_id` or `market_symbol`. ## OpenAPI Specs - [markets](/developers/api-reference/markets.yaml) - [openapi](/developers/api-reference/openapi.yaml) - [orderbook](/developers/api-reference/orderbook.yaml) - [orders](/developers/api-reference/orders.yaml) - [permissions](/developers/api-reference/permissions.yaml) - [portfolio](/developers/api-reference/portfolio.yaml) - [positions](/developers/api-reference/positions.yaml) - [prices](/developers/api-reference/prices.yaml) - [trades](/developers/api-reference/trades.yaml) ## Optional - [Community](https://fairground.fi/discord) This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.