Skip to main content

Tables

ClearingHouse_PositionChanged_event

Position change events from Perpetual Protocol v1 ClearingHouse contract on Gnosis Chain, capturing trader activity including margin, position size changes, realized/unrealized PnL, fees, funding payments, and liquidation data. Used for analyzing trader behavior, market dynamics, and protocol liquidation mechanics across automated market maker (AMM) pairs.
ColumnTypeDescription
block_timestampTIMESTAMPTimestamp when the block was produced. UTC timezone, millisecond precision.
block_numberINT64Sequential identifier for the block in which the event or transaction was recorded. Integer value indicating the block’s position in the blockchain.
transaction_hashSTRINGUnique identifier for the transaction. 66-character hex string including 0x prefix.
log_indexINT64Position of the event within the block’s transaction logs. Zero-indexed integer representing the sequential order of log emission.
addressSTRINGContract address that emitted the event. Hex-encoded, 0x-prefixed, 42-character string.
removedBOOLBoolean flag indicating whether the event log was removed from the blockchain due to a chain reorganization.
in_traderSTRINGAddress that initiated or executed the trade transaction. Hex-encoded, 0x-prefixed, 42-character string.
in_ammSTRINGContract address of the automated market maker (AMM). Hex-encoded, 0x-prefixed, 42-character string.
in_marginSTRINGMargin amount posted or held for the trading position. String-encoded integer value representing collateral in the smallest unit of the relevant token or currency.
in_positionNotionalSTRINGNotional value of the position after the trade, denominated in the margin asset (typically USD). Represented as a wei-formatted integer (18 decimals) showing the dollar value of the perpetual position.
in_exchangedPositionSizeSTRINGChange in position size (delta) resulting from this trade action, denominated in the perpetual contract’s base units. Positive values indicate longs, negative values indicate shorts or position closures.
in_feeSTRINGFee amount charged for the transaction or operation. String-encoded integer value representing the fee in the smallest unit of the relevant token or currency.
in_positionSizeAfterSTRINGPosition size held by the trader after this change is applied, denominated in the AMM’s base asset units. Positive values indicate long positions, negative values indicate short positions.
in_realizedPnlSTRINGRealized profit or loss from the position or transaction. String-encoded integer value representing the net financial result in the smallest unit of the relevant token or currency, where negative values indicate losses and positive values indicate profits.
in_unrealizedPnlAfterSTRINGTrader’s unrealized profit or loss (PnL) for the position after this trade executed, denominated in the margin currency (wei). Positive values indicate unrealized gains, negative values indicate unrealized losses.
in_badDebtSTRINGBad debt amount resulting from the position change, measured in wei. Typically zero unless the position was liquidated with insufficient collateral to cover losses.
in_liquidationPenaltySTRINGFee charged when a position is forcibly closed due to insufficient margin. Denominated in wei (10^-18 tokens), typically zero for voluntary position changes and non-zero during liquidation events.
in_spotPriceSTRINGCurrent spot price of the asset or position. String-encoded integer value representing the price in the smallest unit of the relevant token or currency.
in_fundingPaymentSTRINGFunding payment amount charged or credited to the position holder. String-encoded integer value representing the periodic fee in the smallest unit of the relevant token or currency, where negative values indicate payments owed by the trader and positive values indicate payments received.
in_ammin_feeaddressremovedin_marginin_traderlog_indexin_badDebtblock_numberin_spotPricein_realizedPnlblock_timestamptransaction_hashin_fundingPaymentin_positionNotionalin_positionSizeAfterin_liquidationPenaltyin_unrealizedPnlAfterin_exchangedPositionSize
0x0f346e19f01471c02485df1758cfd3d624e399b45964000000000000000x5d9593586b4b5edbd23e7eba8d88fd8f09d83ebdfalse994000000000000000000xf15a780336068b58997bfd4640f008349c27636c320135682282281806603039142329227102020-12-17T18:24:00.000Z0xb5cd0b4c78474e230fc01fbafb989840d9cb74eb04164e181f2dd1374bc383c40596400000000000000000261386797052566580026138679705256658
0x0f346e19f01471c02485df1758cfd3d624e399b435937349431429404720x5d9593586b4b5edbd23e7eba8d88fd8f09d83ebdfalse3593734943142940472650xe8913568dd98e1967c1063d04657a79a13964665190135614322245565880475404570114202020-12-17T07:59:40.000Z0xcbc70528eb865845e76d55bb58876455fa3600b361276ae974aac32898e24a8c0359373494314294047265016009256929541314600160092569295413146
0x0f346e19f01471c02485df1758cfd3d624e399b444788803658087003080x5d9593586b4b5edbd23e7eba8d88fd8f09d83ebdfalse1076447836093669572570xe8913568dd98e1967c1063d04657a79a139646652501355634621378877039368160014768-49852198749527913912020-12-17T00:21:45.000Z0x228e80689e81404f08974d7eab83396f36885afa879a812630bf067a43b1e07e044788803658087003088405035637143047014100209593287342010062
Query with partition filter
SELECT *
FROM `tt-contracts.perpetualprotocol_v1_gnosis.ClearingHouse_PositionChanged_event`
WHERE block_timestamp >= DATE_SUB(CURRENT_DATE(), INTERVAL 7 DAY)
LIMIT 100

ClearingHouse_PositionLiquidated_event

Liquidation events from Perpetual Protocol v1 on Gnosis Chain, recording forced position closures when traders’ margin falls below maintenance requirements. Contains liquidator addresses, position sizes, notional values, liquidation fees, and bad debt for analyzing undercollateralized positions and liquidator profitability.
ColumnTypeDescription
block_timestampTIMESTAMPTimestamp when the block was produced. UTC timezone, millisecond precision.
block_numberINT64Sequential identifier for the block in which the event or transaction was recorded. Integer value indicating the block’s position in the blockchain.
transaction_hashSTRINGUnique identifier for the transaction. 66-character hex string including 0x prefix.
log_indexINT64Position of the event within the block’s transaction logs. Zero-indexed integer representing the sequential order of log emission.
addressSTRINGContract address that emitted the event. Hex-encoded, 0x-prefixed, 42-character string.
removedBOOLBoolean flag indicating whether the event log was removed from the blockchain due to a chain reorganization.
in_traderSTRINGAddress that initiated or executed the trade transaction. Hex-encoded, 0x-prefixed, 42-character string.
in_ammSTRINGContract address of the automated market maker (AMM). Hex-encoded, 0x-prefixed, 42-character string.
in_positionNotionalSTRINGNotional value of the liquidated perpetual position at the time of liquidation, denominated in the quote currency (typically a stablecoin). Represented as a raw integer value that requires decimal adjustment (typically 18 decimals for Perpetual Protocol v1).
in_positionSizeSTRINGTotal size of the trading position after the event. String-encoded integer value representing the position magnitude in the smallest unit of the relevant asset or USD-denominated value.
in_liquidationFeeSTRINGLiquidation fee collected from the liquidated position, paid to the liquidator for executing the liquidation. Denominated in the protocol’s base unit (wei-equivalent 18 decimals), typically representing a percentage of position notional value.
in_liquidatorSTRINGAddress of the account executing the liquidation operation. Hex-encoded, 0x-prefixed, 42-character string.
in_badDebtSTRINGBad debt amount in wei resulting from the liquidation when the trader’s collateral is insufficient to cover losses. Typically zero when liquidations are profitable, non-zero when position losses exceed available margin.
in_ammaddressremovedin_traderlog_indexin_badDebtblock_numberin_liquidatorblock_timestampin_positionSizetransaction_hashin_liquidationFeein_positionNotional
0xab08ff2c726f2f333802630ee19f4146385cc3430x5d9593586b4b5edbd23e7eba8d88fd8f09d83ebdfalse0x28fc94298bc9a20d6b5673d745bec57e69c6e36860187749280x07cf2d1ba50f015571a6f1a5493b69781fdcd4ec2021-10-27T07:51:20.000Z61816477066732196453770x7568ff0370407f5c7017e3353089c2f421b55f0bf4c0f1c60dc8c80795014f5c16778675204888092133826845880327820947414110
0xb48f7accc03a3c64114170291f352b37eea26c0b0x5d9593586b4b5edbd23e7eba8d88fd8f09d83ebdfalse0x45a1b2157f9a1b464f949efcbeaf40309d7b07e0310187820980x07cf2d1ba50f015571a6f1a5493b69781fdcd4ec2021-10-27T19:24:17.000Z140783786773681640xb0e6f0e660072efc37cbe1eec156e1377d0a44c36f27b8833cfeb530af11217d19572760424423775731316416679078041278
0x187c938543f2bde09fe39034fe3ff797a3d35ca00x5d9593586b4b5edbd23e7eba8d88fd8f09d83ebdfalse0x6c2f2ea95392f22d138be349061bd55e18e0d94660187778710x07cf2d1ba50f015571a6f1a5493b69781fdcd4ec2021-10-27T12:37:00.000Z828521645969947427640x4ec67114384507ba956e9362b5eff29d701725371f708f0a5de7e2dbb186aafb49462905053583471179140648085733553779
Query with partition filter
SELECT *
FROM `tt-contracts.perpetualprotocol_v1_gnosis.ClearingHouse_PositionLiquidated_event`
WHERE block_timestamp >= DATE_SUB(CURRENT_DATE(), INTERVAL 7 DAY)
LIMIT 100