Drift V2

On-Chain Perpetual & Spot Trading with Leverage.

drift_v2.txns

This table has similar schema as of Solana transactions table

drift_v2.parsed

The table contains the parsed instructions data for Drift V2. Data related to instruction type, executing account, account arguments, arguments, etc. is available here.

Column Name
Column Type
Description

block_date

date

Event date

block_time

timestamp

The (estimated) time this block was produced

block_slot

bigint

This block’s slot index in the ledger

dapp

string

Solana program address

inner_instruction_index

int

The order of inner instruction of an instruction in a txns

input_accounts

array<string>

Ordered list of accounts to pass to the program

instruction_index

int

The order of the instruction in a txns

instruction_type

string

Name of the function of a Solana program invoked via an instruction

is_inner_instruction

boolean

Whether the respective instruction of a txns has an inner instruction

tx_id

string

The first signature in the transaction

args

<STRUCT>

The arguments passed to the invoked function. Generated after decoding the instructions data parameter

Some columns in the above table needs to be explained a bit for better understanding. Let's go into what each one of them contains.

input accounts

Field
Column Type

admin

string

adminTokenAccount

string

authority

string

baseSpotMarket

string

driftSigner

string

filler

string

fillerStats

string

fromUser

string

insuranceFundStake

string

insuranceFundVault

string

liquidator

string

liquidatorStats

string

oracle

string

payer

string

perpMarket

string

quoteAssetMint

string

quoteSpotMarket

string

rent

string

serumFulfillmentConfig

string

serumMarket

string

serumOpenOrders

string

serumProgram

string

sourceVault

string

spotMarket

string

spotMarketMint

string

spotMarketVault

string

srmVault

string

state

string

systemProgram

string

taker

string

takerStats

string

toUser

string

tokenProgram

string

user

string

userStats

string

userTokenAccount

string

args

Field
Data Type

subAccountId

int

name

array<string>

marketIndex

int

amount

double

reduceOnly

bool

<STRUCT>

orderId

int

orderId

int

userOrderId

int

marketType

string

scale

int

direction

string

takerOrderId

int

fulfillmentType

string

nShares

int

sharesToBurn

int

marginRatio

int

marginTradingEnabled

bool

delegate

string

makerOrderId

int

liquidatorMaxBaseAssetAmount

int

limitPrice

int

assetMarketIndex

int

liabilityMarketIndex

int

liquidatorMaxLiabilityTransfer

double

perpMarketIndex

int

spotMarketIndex

int

liquidatorMaxPnlTransfer

double

quoteSpotMarketIndex

int

marketIndexes

array<int>

expiryTs

int

optimalUtilization

int

optimalBorrowRate

int

maxBorrowRate

int

oracleSource

string

initialAssetWeight

string

maintenanceAssetWeight

int

initialLiabilityWeight

int

maintenanceLiabilityWeight

int

imfFactor

int

liquidatorFee

int

activeStatus

bool

status

string

ammBaseAssetReserve

double

ammQuoteAssetReserve

double

ammPeriodicity

int

ammPegMultiplier

double

marginRatioInitial

int

marginRatioMaintenance

int

baseAssetReserve

double

quoteAssetReserve

double

sqrtK

double

newPegCandidate

double

unrealizedMaxImbalance

int

maxRevenueWithdrawPerPeriod

int

quoteMaxInsurance

int

ifLiquidationFee

int

insuranceFundUnstakingPeriod

int

withdrawGuardThreshold

int

userIfFactor

int

totalIfFactor

int

revenueSettlePeriod

int

assetTier

string

maxTokenDeposits

int

stepSize

int

tickSize

int

orderSize

int

ordersEnabled

bool

contractTier

string

unrealizedPnlImfFactor

int

unrealizedInitialAssetWeight

int

unrealizedMaintenanceAssetWeight

int

concentrationScale

double

curveUpdateIntensity

int

lpCooldownTime

int

<STRUCT>

initialPctToLiquidate

int

liquidationDuration

int

settlementDuration

int

baseSpread

int

ammJitIntensity

int

maxSlippageRatio

int

maxFillReserveFraction

int

maxOpenInterest

double

whitelistMint

string

discountMint

string

exchangeStatus

int

minPerpAuctionDuration

int

defaultSpotAuctionDuration

int

params

Field
Data Type

orderType

string

marketType

string

direction

string

userOrderId

int

baseAssetAmount

double

price

double

marketIndex

int

reduceOnly

bool

postOnly

bool

immediateOrCancel

bool

maxTs

int

triggerPrice

double

triggerCondition

string

oraclePriceOffset

int

auctionDuration

int

auctionStartPrice

double

auctionEndPrice

double

Field
Data Type

array<STRUCT>

feeTiers

Field
Data Type

feeNumerator

int

feeDenominator

int

makerRebateDenominator

int

referrerRewardNumerator

int

referrerRewardDenominator

double

refereeFeeNumerator

int

refereeFeeDenominator

int

oracleGuardRails

Field
Data Type

<STRUCT>

priceDivergence

Field
Data Type

markOracleDivergenceNumerator

int

markOracleDivergenceDenominator

int

validity

Field
Data Type

slotsBeforeStaleForAmm

int

slotsBeforeStaleForMargin

int

confidenceIntervalMaxSize

int

tooVolatileRatio

int

drift_v2.events

This table has all the drift v2 historically parsed events.

Field
Column Type
Description

block_date

date

Event date

block_time

timestamp

The (estimated) time this block was produced

block_slot

bigint

This block’s slot index in the ledger

tx_id

string

The first signature in the transaction

dapp

string

Solana program address

event_type

The name of the event emitted

<STRUCT>

The arguments of the respective event

args

Field
Data Type

ts

int

userAuthority

string

user

string

subAccountId

int

name

array<int>

referrer

string

direction

string

depositRecordId

double

amount

double

marketIndex

int

marketDepositBalance

double

marketWithdrawBalance

double

marketCumulativeDepositInterest

double

marketCumulativeBorrowInterest

double

totalDepositsAfter

double

totalWithdrawsAfter

double

explanation

string

transferUser

string

depositBalance

double

cumulativeDepositInterest

double

borrowBalance

double

cumulativeBorrowInterest

double

optimalUtilization

int

optimalBorrowRate

int

maxBorrowRate

int

fundingPayment

double

baseAssetAmount

double

userLastCumulativeFunding

double

ammCumulativeFundingLong

double

ammCumulativeFundingShort

double

recordId

double

fundingRate

int

fundingRateLong

double

fundingRateShort

double

cumulativeFundingRateLong

double

cumulativeFundingRateShort

double

oraclePriceTwap

int

markPriceTwap

int

periodRevenue

int

baseAssetAmountWithAmm

double

baseAssetAmountWithUnsettledLp

double

pegMultiplierBefore

double

baseAssetReserveBefore

double

quoteAssetReserveBefore

double

sqrtKBefore

double

pegMultiplierAfter

double

baseAssetReserveAfter

double

quoteAssetReserveAfter

double

sqrtKAfter

double

baseAssetAmountLong

double

baseAssetAmountShort

double

totalFee

double

totalFeeMinusDistributions

double

adjustmentCost

double

fillRecord

double

numberOfUsers

int

<STRUCT>

action

string

actionExplanation

string

marketType

string

filler

string

fillerReward

int

fillRecordId

int

baseAssetAmountFilled

int

quoteAssetAmountFilled

int

takerFee

int

makerFee

int

referrerReward

int

quoteAssetAmountSurplus

int

spotFulfillmentMethodFee

double

taker

string

takerOrderId

int

takerOrderDirection

string

takerOrderBaseAssetAmount

double

takerOrderCumulativeBaseAssetAmountFilled

double

takerOrderCumulativeQuoteAssetAmountFilled

double

maker

string

makerOrderId

int

makerOrderDirection

string

makerOrderBaseAssetAmount

double

makerOrderCumulativeBaseAssetAmountFilled

double

makerOrderCumulativeQuoteAssetAmountFilled

double

oraclePrice

double

nShares

int

deltaBaseAssetAmount

int

deltaQuoteAssetAmount

int

pnl

double

liquidationType

string

liquidator

string

marginRequirement

double

totalCollateral

double

marginFreed

int

liquidationId

int

bankrupt

bool

canceledOrderIds

array<int>

quoteAssetAmountAfter

int

quoteEntryAmount

int

settlePrice

int

spotMarketIndex

int

perpMarketIndex

int

userIfFactor

int

totalIfFactor

int

vaultAmountBefore

int

insuranceVaultAmountBefore

int

totalIfSharesBefore

double

totalIfSharesAfter

double

ifSharesBefore

double

userIfSharesBefore

double

ifSharesAfter

double

userIfSharesAfter

double

order

Field
Data Type

slot

int

price

int

baseAssetAmount

double

baseAssetAmountFilled

int

quoteAssetAmountFilled

int

triggerPrice

int

auctionStartPrice

int

auctionEndPrice

int

maxTs

int

oraclePriceOffset

int

orderId

int

marketIndex

int

status

string

orderType

string

marketType

string

userOrderId

int

existingPositionDirection

string

direction

string

reduceOnly

bool

postOnly

bool

immediateOrCancel

bool

triggerCondition

string

auctionDuration

int

padding

array<int>

liquidatePerp

Field
Data Type

marketIndex

int

oraclePrice

int

quoteAssetAmount

double

lpShares

int

fillRecordId

int

userOrderId

int

liquidatorOrderId

int

liquidatorFee

int

ifFee

int

liquidateSpot

Field
Data Type

assetMarketIndex

int

assetPrice

double

liabilityMarketIndex

int

liabilityPrice

int

liabilityTransfer

double

ifFee

int

liquidateBorrowForPerpPnl

Field
Data Type

perpMarketIndex

int

marketOraclePrice

int

pnlTransfer

double

liabilityMarketIndex

int

liabilityPrice

int

liabilityTransfer

double

liquidatePerpPnlForDeposit

Field
Data Type

perpMarketIndex

int

marketOraclePrice

int

pnlTransfer

double

assetMarketIndex

int

assetPrice

int

assetTransfer

double

perpBankruptcy

Filed
Data Type

marketIndex

int

pnl

double

ifPayment

int

clawbackUser

string

clawbackUserPayment

double

cumulativeFundingRateDelta

double

spotBankruptcy

Filed
Data Type

marketIndex

int

borrowAmount

double

ifPayment

double

cumulativeDepositInterestDelta

double

Last updated