Product Snapshots

Query historical product snapshots.

Rate limits

  • 240 requests/min or 40 requests/10secs per IP address. (weight = 10)

See more details in API Rate limits

Single Product

Request

Query snapshots for a given product ordered by submission index desc.

POST [ARCHIVE_ENDPOINT]

Body

{
    "products": {
        "product_id": 3,
        "max_time": 1679728762,
        "limit": 1
    }
}

Request Parameters

ParameterTypeRequiredDescription

product_id

number

Yes

id of product to fetch snapshots for.

idx

number / string

No

when provided, only return product snapshots with submission_idx <= idx

max_time

number / string

No

when idx is not provided, max_time (unix epoch in seconds) can be used to only return snapshots created <= max_time

limit

number

No

max number of snapshots to return. defaults to 100. max possible of 500.

Response

Note:

  • the response includes a txs field which contains the relevant transactions to the product snapshots. There are >=1 product snapshots per transaction.

  • both products and txs are in descending order by submission_idx.

  • use the submission_idx to associate a product snapshot to it's corresponding transaction.

{
  "products": [
    {
      "product_id": 3,
      "submission_idx": "563014",
      "product": {
        "spot": {
          "product_id": 3,
          "oracle_price_x18": "1751488625000000050000",
          "risk": {
            "long_weight_initial_x18": "750000000000000000",
            "short_weight_initial_x18": "1250000000000000000",
            "long_weight_maintenance_x18": "800000000000000000",
            "short_weight_maintenance_x18": "1200000000000000000",
            "large_position_penalty_x18": "0"
          },
          "config": {
            "token": "0xcc59686e3a32fb104c8ff84dd895676265efb8a6",
            "interest_inflection_util_x18": "800000000000000000",
            "interest_floor_x18": "10000000000000000",
            "interest_small_cap_x18": "40000000000000000",
            "interest_large_cap_x18": "1000000000000000000"
          },
          "state": {
            "cumulative_deposits_multiplier_x18": "1003006222268375194",
            "cumulative_borrows_multiplier_x18": "1005686349789989371",
            "total_deposits_normalized": "101765274778392635900623",
            "total_borrows_normalized": "48739080269992866425685"
          },
          "lp_state": {
            "supply": "902924999999999999774268",
            "quote": {
              "amount": "1026773958941457186836518",
              "last_cumulative_multiplier_x18": "1000000000612384372"
            },
            "base": {
              "amount": "587811596408602623177",
              "last_cumulative_multiplier_x18": "1003006222268375194"
            }
          },
          "book_info": {
            "size_increment": "10000000000000000",
            "price_increment_x18": "100000000000000000",
            "min_size": "100000000000000000",
            "collected_fees": "1546717023589573343471212",
            "lp_spread_x18": "3000000000000000"
          }
        }
      }
    }
  ],
  "txs": [
    {
      "tx": {
        "update_price": {
          "product_id": 3,
          "price_x18": "1750710375000000000000"
        }
      },
      "submission_idx": "563014",
      "timestamp": "1679728271"
    }
  ]
}

Response Fields

Products

Field nameDescription

submission_idx

Used to uniquely identify the blockchain transaction that generated the product snapshot; you can use it to grab the relevant transaction in the txs section.

product_id

The id of of the product the event is associated with.

product

The state of the product at the time of the transaction.

Txs

Field nameDescription

submission_idx

Unique identifier of the transaction.

tx

Raw data of the corresponding transaction

timestamp

The unix epoch in seconds of when the transaction took place.

Multiple Products

Request

Query the latest snapshot for the provided products.

POST [ARCHIVE_ENDPOINT]

Body

{
    "product_snapshots": {
        "product_ids": [1, 2],
        "max_time": 1679728762
    }
}

Request Parameters

ParameterTypeRequiredDescription

product_ids

number[]

Yes

Ids of products to fetch snapshots for.

max_time

number / string

No

When provided, returns the last snapshot created <= max_time for each product. Otherwise, the latest snapshot is returned.

Response

Note: the response is a map of product_id -> snapshot for each requested product.

{
  "1": {
    "product_id": 1,
    "submission_idx": "459743",
    "product": {
      "spot": {
        "product_id": 1,
        "oracle_price_x18": "31582395488073320408472",
        "risk": {
          "long_weight_initial_x18": "900000000000000000",
          "short_weight_initial_x18": "1100000000000000000",
          "long_weight_maintenance_x18": "950000000000000000",
          "short_weight_maintenance_x18": "1050000000000000000",
          "large_position_penalty_x18": "0"
        },
        "config": {
          "token": "0x5cc7c91690b2cbaee19a513473d73403e13fb431",
          "interest_inflection_util_x18": "800000000000000000",
          "interest_floor_x18": "10000000000000000",
          "interest_small_cap_x18": "40000000000000000",
          "interest_large_cap_x18": "1000000000000000000"
        },
        "state": {
          "cumulative_deposits_multiplier_x18": "1005266691979081067",
          "cumulative_borrows_multiplier_x18": "1008464332498400342",
          "total_deposits_normalized": "3853380366798127292498",
          "total_borrows_normalized": "3171903194179038855701"
        },
        "lp_state": {
          "supply": "485670917658672273450851",
          "quote": {
            "amount": "533498653674283527525638",
            "last_cumulative_multiplier_x18": "1000000000047911804"
          },
          "base": {
            "amount": "16862535452736644443",
            "last_cumulative_multiplier_x18": "1005266691979081067"
          }
        },
        "book_info": {
          "size_increment": "1000000000000000",
          "price_increment_x18": "1000000000000000000",
          "min_size": "10000000000000000",
          "collected_fees": "460839041331226808022323",
          "lp_spread_x18": "3000000000000000"
        }
      }
    }
  },
  "2": {
    "product_id": 2,
    "submission_idx": "459842",
    "product": {
      "perp": {
        "product_id": 2,
        "oracle_price_x18": "31577635670035396763528",
        "risk": {
          "long_weight_initial_x18": "950000000000000000",
          "short_weight_initial_x18": "1050000000000000000",
          "long_weight_maintenance_x18": "970000000000000000",
          "short_weight_maintenance_x18": "1030000000000000000",
          "large_position_penalty_x18": "0"
        },
        "state": {
          "cumulative_funding_long_x18": "134895011744110446566737",
          "cumulative_funding_short_x18": "134437616226076003830045",
          "available_settle": "3528089205596638824705152",
          "open_interest": "3341108000000000000000"
        },
        "lp_state": {
          "supply": "264410712802085330000000",
          "last_cumulative_funding_x18": "134895011744110446566737",
          "cumulative_funding_per_lp_x18": "5521082805340854",
          "base": "9170000000000000000",
          "quote": "289310002802085330000000"
        },
        "book_info": {
          "size_increment": "1000000000000000",
          "price_increment_x18": "1000000000000000000",
          "min_size": "10000000000000000",
          "collected_fees": "313231857879134266832804",
          "lp_spread_x18": "3000000000000000"
        }
      }
    }
  }
}

Response Fields

Field nameDescription

submission_idx

Used to uniquely identify the blockchain transaction that generated the product snapshot.

product_id

The id of of the product the event is associated with.

product

The state of the product at the time of the transaction.

Last updated