LogoLogo
Join DiscordFollow on XBridge FundsLong $BERA
  • Doc Bros v1
    • Overview
    • Key Features
      • Speed & Liquidity is Key
      • Bropetual Markets
      • A Hub for Berachain DeFi
    • Proof-of-Liquidity
      • Reward Vault
    • Power of Points
    • Partners & Integrations
    • Campaigns
      • bro.trade Em Up
  • bullish bros
    • SuperBros NFT
  • Technicals
    • What is Proof-of-Liquidity?
    • One-Click Trading
    • Funding Rates
  • Liquidations & Insurance Fund
  • Vertex Edge Sequencer
  • Fees
  • PnL Settlements
  • Withdrawals
  • Pricing (Oracles)
  • links & resources
    • bro.trade Links
      • Website
      • Trade Bropetuals
      • Discord
      • X (Twitter)
      • Medium
      • Swap on OogaBooga
    • Berachain Links
      • Berachain.com
      • Official Bridge
      • BeraHub
      • Berascan
      • Bera Discord
      • Berachain X (Twitter)
      • Berachain Docs
    • FAQ
  • developer bros
    • API
      • Gateway
        • Executes
          • Place Order
          • Cancel Order
          • Cancel and Place
          • Cancel Product Order
          • Withdraw Colleteral
          • Transfer Quote
          • Liquidate Subaccount
          • Mint LP
          • Burn LP
          • Link Signer
        • Queries
          • All Products
          • Contracts
          • Fee Rates
          • Health Groups
          • Insurance
          • Linked Signer
          • Market Liquidity
          • Market Prices
          • Max Lp Mintable
          • Max Order Size
          • Max Withdrawable
          • Min Deposit Rates
          • Nonces
          • Order
          • Orders
          • Status
          • Subaccount Info
          • Symbols
        • Signing
          • Examples
          • Q A
      • Subscriptions
        • Authentication
        • Streams
        • Events
        • Rate Limits
      • Archive (indexer)
        • Candlesticks
        • Events
        • Funding Rate
        • Interest Funding Payments
        • Linked Signer Rate Limit
        • Liquidation Feed
        • Maker Statistics
        • Market Snapshots
        • Matches
        • Merkle Proofs
        • Oracle Price
        • Orders
        • Perp Prices
        • Product Snapshots
        • Rewards
        • Signatures
        • Subaccounts
        • Summary
        • HONEY Price
      • Trigger
        • Executes
          • Place Order
          • Cancel Orders
          • Cancel Product Orders
        • Queries
          • List Trigger Orders
      • V2
        • Apr
        • Assets
        • Contracts
        • Orderbook
        • Pairs
        • Tickers
        • Trades
      • Rate limits
      • Errors
      • Symbols
      • Depositing
      • Withdrawing (on-chain)
      • Integrate via Smart Contracts
      • Definitions / Formulas
    • On-Chain Contracts
Powered by GitBook
On this page
  • Rate limits
  • Single Product
  • Response Fields
  • Multiple Products
  1. developer bros
  2. API
  3. Archive (indexer)

Product Snapshots

PreviousPerp PricesNextRewards

Last updated 2 months ago

Rate limits

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

See more details in .

Single Product

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

Parameter
Type
Required
Description

product_id

number

Yes

ID of the 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, with a 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 Name
Description

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 the product the event is associated with.

product

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

Txs

Field Name
Description

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

Parameter
Type
Required
Description

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 Name
Description

submission_idx

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

product_id

The ID of the product the event is associated with.

product

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

API Rate limits