Docs

Get market state

Dynamic state lookup for a single market. :market-id is the stable Midnight market id and is unique across supported chains, so no chain id is required.

Returns the market state inside a data envelope. Use GET /v0/midnight/markets/{market-id} for immutable market configuration. 404s when the id is unknown.

Path Parameters

market-id*string

Midnight market id.

Response Body

application/json

application/json

const baseUrl = "https://api.morpho.org";const marketId = "0xcc9418ea594c6e658650aedd205ce4544b266b69493f56fd2adc65c14bd06738";const url = new URL(`${baseUrl}/v0/midnight/markets/${marketId}/state`);const response = await fetch(url, {  headers: {    accept: "application/json",  },});if (!response.ok) throw new Error(await response.text());const body = await response.json();
{
  "data": {
    "chain_id": 8453,
    "market_id": "0xcc9418ea594c6e658650aedd205ce4544b266b69493f56fd2adc65c14bd06738",
    "total_units": "1481439992020013",
    "tick_granularity": 4,
    "settlement_fee_schedule": [
      {
        "time_to_maturity_days": 0,
        "fee_cbp": "0"
      },
      {
        "time_to_maturity_days": 1,
        "fee_cbp": "0"
      },
      {
        "time_to_maturity_days": 7,
        "fee_cbp": "0"
      },
      {
        "time_to_maturity_days": 30,
        "fee_cbp": "0"
      },
      {
        "time_to_maturity_days": 90,
        "fee_cbp": "0"
      },
      {
        "time_to_maturity_days": 180,
        "fee_cbp": "0"
      },
      {
        "time_to_maturity_days": 360,
        "fee_cbp": "0"
      }
    ],
    "current_settlement_fee_wad": "0",
    "current_settlement_fee_cbp": "0",
    "continuous_fee_rate": "0",
    "last_indexed_block": "48408699"
  }
}
{
  "error": {
    "code": "MARKET_NOT_FOUND",
    "message": "Market 0x0000000000000000000000000000000000000000000000000000000000000000 not found",
    "details": null,
    "request_id": "f0e1d2c3-b4a5-4968-8728-1c0d1e2f3a4b"
  }
}