{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://raw.githubusercontent.com/api-evangelist/backpack/main/json-schema/backpack-market-schema.json", "title": "Backpack Market", "description": "JSON Schema for the Backpack Exchange Market resource, extracted from the Backpack Exchange OpenAPI 3.0 specification.", "type": "object", "required": [ "symbol", "baseSymbol", "quoteSymbol", "marketType", "filters", "orderBookState", "createdAt", "visible" ], "properties": { "symbol": { "type": "string", "description": "Symbol of the market, e.g. `ETH_USDC`" }, "baseSymbol": { "type": "string", "description": "The base asset of the market." }, "quoteSymbol": { "type": "string", "description": "The quote asset of the market." }, "marketType": { "description": "The type of the market.", "allOf": [ { "$ref": "#/$defs/MarketType" }, { "description": "The type of the market." } ] }, "filters": { "description": "Price, lot and leverage rules.", "allOf": [ { "$ref": "#/$defs/OrderBookFilters" }, { "description": "Price, lot and leverage rules." } ] }, "imfFunction": { "description": "IMF function.", "allOf": [ { "$ref": "#/$defs/PositionImfFunction" }, { "description": "IMF function." } ] }, "mmfFunction": { "description": "MMF function.", "allOf": [ { "$ref": "#/$defs/PositionImfFunction" }, { "description": "MMF function." } ] }, "fundingInterval": { "type": "integer", "format": "uint64", "description": "Funding interval for perpetuals in milliseconds." }, "fundingRateUpperBound": { "type": "string", "format": "decimal", "description": "Funding rate upper bound for perpetual markets. In basis points. E.g. 10\n= 10bps" }, "fundingRateLowerBound": { "type": "string", "format": "decimal", "description": "Funding rate lower bound for perpetual markets. In basis points. E.g.\n-10 = -10bps" }, "openInterestLimit": { "type": "string", "format": "decimal", "description": "Maximum open interest limit for the market if the market is a future." }, "orderBookState": { "description": "The order book state.", "allOf": [ { "$ref": "#/$defs/OrderBookState" }, { "description": "The order book state." } ] }, "createdAt": { "type": "string", "format": "naive-date-time", "description": "Market created at time." }, "visible": { "type": "boolean", "description": "Market currently visible." }, "positionLimitWeight": { "type": "string", "format": "decimal", "description": "Position limit weight coefficient.\nUsed to calculate position limits when clearing a trade." } }, "$defs": { "MarketType": { "type": "string", "enum": [ "SPOT", "PERP", "IPERP", "DATED", "PREDICTION", "RFQ" ] }, "OrderBookFilters": { "type": "object", "title": "OrderBookFilters", "required": [ "price", "quantity" ], "properties": { "price": { "description": "Defines the price rules for the order book.", "allOf": [ { "$ref": "#/$defs/PriceFilter" }, { "description": "Defines the price rules for the order book." } ] }, "quantity": { "description": "Defines the quantity rules for the order book.", "allOf": [ { "$ref": "#/$defs/QuantityFilter" }, { "description": "Defines the quantity rules for the order book." } ] } } }, "PriceFilter": { "type": "object", "title": "PriceFilter", "required": [ "minPrice", "tickSize" ], "properties": { "minPrice": { "type": "string", "format": "decimal", "description": "Minimum price the order book will allow." }, "maxPrice": { "type": "string", "format": "decimal", "description": "Maximum price the order book will allow." }, "tickSize": { "type": "string", "format": "decimal", "description": "Price increment." }, "maxMultiplier": { "type": "string", "format": "decimal", "description": "Maximum allowed multiplier from last active price." }, "minMultiplier": { "type": "string", "format": "decimal", "description": "Minimum allowed multiplier from last active price." }, "maxImpactMultiplier": { "type": "string", "format": "decimal", "description": "Maximum allowed impact multiplier from best offer. This\ndetermines how far above the best ask a market buy can penetrate." }, "minImpactMultiplier": { "type": "string", "format": "decimal", "description": "Minimum allowed impact multiplier from best bid. This\ndetermines how far below the best bid a market sell can penetrate." }, "meanMarkPriceBand": { "description": "Futures price band. Used to determine how far the price is allowed to\ndeviate from the mean mark price.", "allOf": [ { "$ref": "#/$defs/PriceBandMarkPrice" }, { "description": "Futures price band. Used to determine how far the price is allowed to\ndeviate from the mean mark price." } ] }, "meanPremiumBand": { "description": "Futures price band. Used to determine how far the premium is allowed to\ndeviate from the mean premium.", "allOf": [ { "$ref": "#/$defs/PriceBandMeanPremium" }, { "description": "Futures price band. Used to determine how far the premium is allowed to\ndeviate from the mean premium." } ] }, "borrowEntryFeeMaxMultiplier": { "type": "string", "format": "decimal", "description": "Maximum allowed multiplier move from last active price without incurring\nan entry fee for spot margin." }, "borrowEntryFeeMinMultiplier": { "type": "string", "format": "decimal", "description": "Minimum allowed multiplier move from last active price without incurring\nan entry fee for spot margin." }, "maxPriceUpdateMultiplier": { "type": "string", "format": "decimal", "description": "Maximum allowed multiplier for mark/index price updates relative to\nthe previous mark/index price. When set, an update is capped at\n`prev * max_price_update_multiplier`." }, "minPriceUpdateMultiplier": { "type": "string", "format": "decimal", "description": "Minimum allowed multiplier for mark/index price updates relative to\nthe previous mark/index price. When set, an update is floored at\n`prev * min_price_update_multiplier`." } } }, "PriceBandMarkPrice": { "type": "object", "title": "PriceBandMarkPrice", "required": [ "maxMultiplier", "minMultiplier" ], "properties": { "maxMultiplier": { "type": "string", "format": "decimal", "description": "Maximum allowed multiplier move from mean price." }, "minMultiplier": { "type": "string", "format": "decimal", "description": "Minimum allowed multiplier move from mean price." } } }, "PriceBandMeanPremium": { "type": "object", "title": "PriceBandMeanPremium", "required": [ "tolerancePct" ], "properties": { "tolerancePct": { "type": "string", "format": "decimal", "description": "Maximum allowed deviation from the mean premium. E.g. if\n`tolerance_pct` is 0.05 (5%), and the mean premium is 5%, then\norders will be prevented from being placed if the premium exceeds 10%." } } }, "QuantityFilter": { "type": "object", "title": "QuantityFilter", "required": [ "minQuantity", "stepSize" ], "properties": { "minQuantity": { "type": "string", "format": "decimal", "description": "Minimum quantity the order book will allow.\n\nFor futures, this will be the threshold at which a position gets closed\nand so it should be as close as possible, preferably equal, to the\n`step_size`." }, "maxQuantity": { "type": "string", "format": "decimal", "description": "Maximum quantity the order book will allow." }, "stepSize": { "type": "string", "format": "decimal", "description": "Quantity increment." } } }, "PositionImfFunction": { "type": "object", "anyOf": [ { "$ref": "#/$defs/PositionImfFunction_SqrtFunction" } ], "discriminator": { "propertyName": "type", "mapping": { "sqrt": "#/components/schemas/PositionImfFunction_SqrtFunction" } } }, "PositionImfFunction_SqrtFunction": { "allOf": [ { "type": "object", "required": [ "type" ], "properties": { "type": { "type": "string", "enum": [ "sqrt" ], "example": "sqrt" } } }, { "$ref": "#/$defs/SqrtFunction" } ] }, "SqrtFunction": { "type": "object", "title": "SqrtFunction", "required": [ "base", "factor" ], "properties": { "base": { "type": "string", "format": "decimal" }, "factor": { "type": "string", "format": "decimal" } } }, "OrderBookState": { "type": "string", "enum": [ "Open", "Closed", "CancelOnly", "LimitOnly", "PostOnly" ] } } }