Events

Query Vertex events by subaccount, products, event types, etc.

Rate limits

  • Dynamic based on limit param provided (weight = 2 + limit / 10)

    • E.g: With limit=100, you can make up to 200 requests per min or 33 requests / 10 secs.

See more details in API Rate limits

Available Events

Each event corresponds to a transaction type in Vertex. See below available events and their event_type mapping:

Event NameEvent Type Value

LiquidateSubaccount

liquidate_subaccount

DepositCollateral

deposit_collateral

WithdrawCollateral

withdraw_collateral

SettlePnl

settle_pnl

MatchOrders

match_orders

MintLp

mint_lp

BurnLp

burn_lp

Event Limits

You can specify 2 types of limit on the query:

  • raw: the max number of events to return.

  • txs: the max number of transactions to return. note: one transaction can emit multiple events, by specifying this limit, you will get all the events associated to the transactions in the response.

Request

Query events corresponding to a specific subaccount, ordered by submission index desc. E.g: all MatchOrder events for subaccount xxx specific to spot wBTC.

POST [ARCHIVE_ENDPOINT]

Body

{
  "events": {
    "product_ids": [
      1
    ],
    "subaccount": "0x12a0b4888021576eb10a67616dd3dd3d9ce206b664656661756c740000000000",
    "event_types": ["match_orders"],
    "max_time": 1679728762,
    "limit": {
       "raw": 1
    }
  }
}

Request Parameters

ParameterTypeRequiredDescription

subaccount

string

No

a bytes32 sent as a hex string; includes the address and the subaccount identifier.

product_ids

number[]

No

when provided, only return events for the specified product ids; return events for all products otherwise.

event_types

string[]

No

when provided, only return events for the specified event types; return all events otherwise.

idx

number / string

No

when provided, only return events 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 events created <= max_time

limit

object {"raw": number } or

{"txs": number }

No

  • specifying raw limit: max number of events to return. defaults to 100. max possible of 500.

  • specifying txs limit: max number of txs to return.

Response

Note:

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

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

  • use the submission_idx to associate an event to it's corresponding transaction.

{
  "events": [
    {
      "subaccount": "0x12a0b4888021576eb10a67616dd3dd3d9ce206b664656661756c740000000000",
      "product_id": 1,
      "submission_idx": "563011",
      "event_type": "match_orders",
      "pre_balance": {
        "spot": {
          "product_id": 1,
          "lp_balance": {
            "amount": "217360200000000000000000"
          },
          "balance": {
            "amount": "26766781157882079846319",
            "last_cumulative_multiplier_x18": "1001292804799204317"
          }
        }
      },
      "post_balance": {
        "spot": {
          "product_id": 1,
          "lp_balance": {
            "amount": "217360200000000000000000"
          },
          "balance": {
            "amount": "26767505157882079846318",
            "last_cumulative_multiplier_x18": "1001292804799204317"
          }
        }
      },
      "product": {
        "spot": {
          "product_id": 1,
          "oracle_price_x18": "27540844575000000000000",
          "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": "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": "1001292804799204317",
            "cumulative_borrows_multiplier_x18": "1002791493009348417",
            "total_deposits_normalized": "94095904024674402346367",
            "total_borrows_normalized": "1755914630382859644973"
          },
          "lp_state": {
            "supply": "1304161199999999999673957",
            "quote": {
              "amount": "1739271965822676148431418",
              "last_cumulative_multiplier_x18": "1000000000612384372"
            },
            "base": {
              "amount": "63297536722571942760",
              "last_cumulative_multiplier_x18": "1001292804799204317"
            }
          },
          "book_info": {
            "size_increment": "1000000000000000",
            "price_increment_x18": "1000000000000000000",
            "min_size": "10000000000000000",
            "collected_fees": "7658873942615761269158545",
            "lp_spread_x18": "3000000000000000"
          }
        }
      },
      "net_interest_unrealized": "49040544804593257",
      "net_interest_cumulative": "51596254598679857",
      "net_funding_unrealized": "0",
      "net_funding_cumulative": "0",
      "net_entry_unrealized": "748947727410369682388339518",
      "net_entry_cumulative": "749148081870171307027129958",
      "net_entry_lp_unrealized": "577238176026145728940277",
      "net_entry_lp_cumulative": "577238176026145728940277"
    }
  ],
  "txs": [
    {
      "tx": {
        "match_orders": {
          "product_id": 1,
          "amm": true,
          "taker": {
            "order": {
              "sender": "0x12a0b4888021576eb10a67616dd3dd3d9ce206b664656661756c740000000000",
              "price_x18": "27540000000000000000000",
              "amount": "2000000000000000000",
              "expiration": 4611686020107120000,
              "nonce": 1761322602510418000
            },
            "signature": "0x826c68f1a3f76d9ffbe8041f8d45e969d31f1ab6f2ae2f6379d1493e479e56436091d6cf4c72e212dd2f1d2fa17c627c4c21bd6d281c77172b8af030488478b71c"
          },
          "maker": {
            "order": {
              "sender": "0xf8d240d9514c9a4715d66268d7af3b53d619642564656661756c740000000000",
              "price_x18": "27540000000000000000000",
              "amount": "-724000000000000000",
              "expiration": 1679731656,
              "nonce": 1761322565506171000
            },
            "signature": "0xd8b6505b8d9b8c3cbfe793080976388035682c02a27893fb26b48a5b2bfe943f4162dea3a42e24e0dff5e2f74fbf77e33d83619140a2a581117c55e6cc236bdb1c"
          }
        }
      },
      "submission_idx": "563011",
      "timestamp": "1679728127"
    }
  ]
}

Response Fields

Events

  • Net cumulative: the net difference in that quantity since the beginning of time. For example, if I want to compute total amount paid out in funding between two events, you can subtract the net_funding_cumulative of the larger event by the net_funding_cumulative of the smaller event.

  • Net unrealized: similar to net_cumulative, but for net_unrealized, we have the caveat that when the magnitude of your position decreases, the magnitude of net_unrealized decreases by the same amount.

Field nameDescription

submission_idx

Used to uniquely identify the blockchain transaction that generated the event; 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.

event_type

Name of the transaction type this event corresponds to.

subaccount

The subaccount associated to the event.

pre_balance

The state of your balance before the event happened.

post_balance

The state of your balance after the event happened.

product

The state of the product throughout the event.

Txs

Field nameDescription

submission_idx

Unique identifier of the transaction.

product_id

Product associated to the transaction.

tx

Raw data of the corresponding transaction e.g: match_orders with all associated data.

timestamp

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

Last updated