Core entities
Token
Represents an ERC20 token tradeable on the platform.Copy
type Token {
# Immutable values
id: Bytes! # Token address
symbol: String! # Token symbol
name: String! # Token name
decimals: BigInt! # Token decimals
# Mutable values
priceUSD: BigDecimal! # Current price in USD
volume: BigDecimal! # All-time volume in token units
volumeUSD: BigDecimal! # All-time volume in USD
protocolFees: BigDecimal! # All-time protocol fees in token units
protocolFeesUSD: BigDecimal! # All-time protocol fees in USD
bookCount: BigInt! # Number of books containing this token
totalValueLocked: BigDecimal! # TVL across all books in token units
totalValueLockedUSD: BigDecimal! # TVL across all books in USD
# Derived fields
tokenDayData: [TokenDayData!]! # Daily snapshots
books: [Book!]! # Books where this is the base token
}
Book
Represents an order book for a token pair.Copy
type Book {
# Immutable values
id: ID! # Book ID
createdAtTimestamp: BigInt! # Creation timestamp
createdAtBlockNumber: BigInt! # Block number when created
quote: Token! # Quote token
base: Token! # Base token
unitSize: BigInt! # Minimum order unit size
makerPolicy: BigInt! # Maker fee policy ID
makerFee: BigDecimal! # Maker fee percentage
isMakerFeeInQuote: Boolean! # Whether maker fee is in quote token
takerPolicy: BigInt! # Taker fee policy ID
takerFee: BigDecimal! # Taker fee percentage
isTakerFeeInQuote: Boolean! # Whether taker fee is in quote token
# Mutable values
priceRaw: BigInt! # Current raw price
price: BigDecimal! # Current price (quote per base)
inversePrice: BigDecimal! # Inverse price (base per quote)
tick: BigInt! # Current tick
volumeQuote: BigDecimal! # All-time quote volume
volumeBase: BigDecimal! # All-time base volume
volumeUSD: BigDecimal! # All-time USD volume
protocolFeesQuote: BigDecimal! # All-time protocol fees in quote
protocolFeesBase: BigDecimal! # All-time protocol fees in base
protocolFeesUSD: BigDecimal! # All-time protocol fees in USD
totalValueLocked: BigDecimal! # Total TVL in quote token units
totalValueLockedUSD: BigDecimal! # Total TVL in USD
lastTakenTimestamp: BigInt! # Last trade timestamp
lastTakenBlockNumber: BigInt! # Last trade block number
# Derived fields
depths: [Depth!]! # Order book depths by tick
orders: [Order!]! # All orders (includes historical)
takes: [Take!]! # All taker trades
makerFills: [MakerFill!]! # All maker order fills
}
Depth
Represents aggregated liquidity at a specific tick in a book.Copy
type Depth {
# Immutable values
id: ID! # Format: ${bookId}-${tick}
book: Book! # Parent book
tick: BigInt! # Price tick
priceRaw: BigInt! # Raw price at this tick
price: BigDecimal! # Price (quote per base)
inversePrice: BigDecimal! # Inverse price (base per quote)
# Mutable values
unitAmount: BigInt! # Total units at this tick
baseAmount: BigInt! # Total base amount
quoteAmount: BigInt! # Total quote amount
latestTakenOrderIndex: BigInt! # Index of last taken order
}
OpenOrder
Represents an active limit order. Automatically deleted when fully claimed or canceled. Use this for querying active orders.Copy
type OpenOrder {
id: ID!
book: Book!
owner: Bytes!
referrer: Bytes! # Referrer address for fee sharing
tick: BigInt!
price: BigDecimal!
unitAmount: BigInt!
claimableUnitAmount: BigInt!
cancelableUnitAmount: BigInt!
pendingUnitAmount: BigInt!
timestamp: BigInt!
}
Order
Complete order history record. Never deleted from the subgraph.Copy
type Order {
# Immutable values
id: ID! # Order ID
transaction: Transaction! # Creation transaction
timestamp: BigInt! # Creation timestamp
book: Book! # Parent book
quote: Token! # Quote token
base: Token! # Base token
origin: Bytes! # Transaction origin (EOA)
priceRaw: BigInt! # Raw price
tick: BigInt! # Price tick
orderIndex: BigInt! # Order index within tick
price: BigDecimal! # Price (quote per base)
inversePrice: BigDecimal! # Inverse price (base per quote)
# Mutable values
owner: Bytes! # Current owner address
referrer: Bytes! # Referrer address for fee sharing
# Order size (decreases when cancelled)
amountUSD: BigDecimal! # Order size in USD
unitAmount: BigInt! # Units
baseAmount: BigInt! # Base amount
quoteAmount: BigInt! # Quote amount
# Filled amounts (increases when taken)
filledUnitAmount: BigInt! # Filled units
filledBaseAmount: BigInt! # Filled base amount
filledQuoteAmount: BigInt! # Filled quote amount
# Claimed amounts (increases when claimed)
claimedUnitAmount: BigInt! # Claimed units
claimedBaseAmount: BigInt! # Claimed base amount
claimedQuoteAmount: BigInt! # Claimed quote amount
# Claimable amounts (increases when taken)
claimableUnitAmount: BigInt! # Claimable units
claimableBaseAmount: BigInt! # Claimable base amount
claimableQuoteAmount: BigInt! # Claimable quote amount
# Cancelable amounts (decreases when filled or cancelled)
cancelableUnitAmount: BigInt! # Cancelable units
cancelableBaseAmount: BigInt! # Cancelable base amount
cancelableQuoteAmount: BigInt! # Cancelable quote amount
# Pending amounts (sum of claimable and cancelable)
pendingUnitAmount: BigInt! # Pending units (claimable + cancelable)
pendingBaseAmount: BigInt! # Pending base amount (claimable + cancelable)
pendingQuoteAmount: BigInt! # Pending quote amount (claimable + cancelable)
# Derived fields
fills: [MakerFill!]! # All fills for this order
claims: [Claim!]! # All claims for this order
cancels: [Cancel!]! # All cancels for this order
}
Use
OpenOrder for active orders. Use Order for complete history including
fills, claims, and cancels.Transaction
Represents an on-chain transaction.Copy
type Transaction {
id: ID! # Transaction hash
blockNumber: BigInt! # Block number
timestamp: BigInt! # Block timestamp
gasUsed: BigInt! # Gas used
gasPrice: BigInt! # Gas price
from: Bytes! # Sender address
to: Bytes # Receiver address
value: BigInt! # Transaction value
# Derived fields
takes: [Take!]! # Trades in this transaction
}
Trading events
OrderMovement (Interface)
Common interface for order movements (takes, claims, and cancels).Copy
interface OrderMovement {
id: ID!
transaction: Transaction! # Transaction containing the movement
timestamp: BigInt! # Movement timestamp
book: Book! # Book where movement occurred
quote: Token! # Quote token
base: Token! # Base token
trader: Bytes! # Address executing the movement
logIndex: BigInt! # Log index in transaction
type: String! # Discriminator: "TAKE", "CLAIM", or "CANCEL"
}
Trade (Interface)
Common interface for all trade types (both taker and maker).Copy
interface Trade {
id: ID!
transaction: Transaction! # Transaction containing the trade
timestamp: BigInt! # Trade timestamp
book: Book! # Book where trade occurred
inputToken: Token! # Token received by trader
outputToken: Token! # Token given by trader
trader: Bytes! # The person executing or providing liquidity
inputAmount: BigInt! # Amount received
outputAmount: BigInt! # Amount given
amountUSD: BigDecimal! # Trade value in USD
logIndex: BigInt! # Log index in transaction
type: String! # Discriminator: "TAKE" or "MAKER"
}
Take
Represents a taker trade (market order execution) on a book. Implements theTrade and OrderMovement interfaces.
Copy
type Take implements Trade & OrderMovement {
id: ID! # Format: {txHash}-{logIndex}
transaction: Transaction! # Parent transaction
timestamp: BigInt! # Trade timestamp
book: Book! # Book where trade occurred
quote: Token! # Quote token
base: Token! # Base token
inputToken: Token! # Token sold by taker
outputToken: Token! # Token bought by taker
origin: Bytes! # Transaction origin (EOA)
trader: Bytes! # Alias for origin (implements Trade/OrderMovement interfaces)
referrer: Bytes! # Referrer address for fee sharing
inputAmount: BigInt! # Amount sold
outputAmount: BigInt! # Amount bought
amountUSD: BigDecimal! # Trade value in USD
logIndex: BigInt! # Log index in transaction
type: String! # Always "TAKE"
}
MakerFill
Represents a maker order fill. When a taker executes a trade, it may fill multiple maker orders. Each fill generates aMakerFill record. Implements the Trade interface.
Copy
type MakerFill implements Trade {
id: ID! # Format: {txHash}-{logIndex}-{orderId}
transaction: Transaction! # Transaction that filled this order
timestamp: BigInt! # Fill timestamp
book: Book! # Book where fill occurred
inputToken: Token! # Token received by maker
outputToken: Token! # Token given by maker
trader: Bytes! # Maker address (order owner)
inputAmount: BigInt! # Amount received by maker
outputAmount: BigInt! # Amount given by maker
amountUSD: BigDecimal! # Fill value in USD
logIndex: BigInt! # Log index in transaction
type: String! # Always "MAKER"
# Maker-specific fields
orderIdString: String! # Original order ID
order: Order # Reference to order
take: Take! # Reference to the Take that triggered this fill
maker: Bytes! # Order owner (same as trader)
tick: BigInt! # Price tick
price: BigDecimal! # Fill price (quote per base)
inversePrice: BigDecimal! # Inverse fill price (base per quote)
fillIndex: BigInt! # Sequential fill number (0 = first fill, etc.)
# Amounts filled in this specific fill
amountFilledUnitAmount: BigInt!
amountFilledBaseAmount: BigInt!
amountFilledQuoteAmount: BigInt!
# Remaining amounts after this fill (snapshot)
remainingFilledUnitAmount: BigInt!
remainingFilledBaseAmount: BigInt!
remainingFilledQuoteAmount: BigInt!
remainingClaimedUnitAmount: BigInt!
remainingClaimedBaseAmount: BigInt!
remainingClaimedQuoteAmount: BigInt!
remainingClaimableUnitAmount: BigInt!
remainingClaimableBaseAmount: BigInt!
remainingClaimableQuoteAmount: BigInt!
remainingCancelableUnitAmount: BigInt!
remainingCancelableBaseAmount: BigInt!
remainingCancelableQuoteAmount: BigInt!
}
Claim
Represents a claim event when a maker withdraws filled orders from a book. Implements theOrderMovement interface.
Copy
type Claim implements OrderMovement {
id: ID! # Format: {txHash}-{logIndex}-{orderId}
transaction: Transaction! # Transaction containing the claim
timestamp: BigInt! # Claim timestamp
book: Book! # Book where claim occurred
quote: Token! # Quote token
base: Token! # Base token
claimer: Bytes! # Address that executed the claim
owner: Bytes! # Owner of the order being claimed
trader: Bytes! # Alias for owner (implements OrderMovement interface)
orderId: BigInt! # Order ID as BigInt
orderIdString: String! # Order ID as string
order: Order # Reference to order
tick: BigInt! # Order tick
price: BigDecimal! # Price at claim time (quote per base)
inversePrice: BigDecimal! # Inverse price (base per quote)
# Amounts claimed in this event
claimedUnitAmount: BigInt! # Claimed units
claimedBaseAmount: BigInt! # Claimed base amount
claimedQuoteAmount: BigInt! # Claimed quote amount
claimedAmountUSD: BigDecimal! # USD value of claimed amount
# Remaining amounts after claim (snapshot)
remainingFilledUnitAmount: BigInt!
remainingFilledBaseAmount: BigInt!
remainingFilledQuoteAmount: BigInt!
remainingClaimedUnitAmount: BigInt!
remainingClaimedBaseAmount: BigInt!
remainingClaimedQuoteAmount: BigInt!
remainingClaimableUnitAmount: BigInt!
remainingClaimableBaseAmount: BigInt!
remainingClaimableQuoteAmount: BigInt!
remainingCancelableUnitAmount: BigInt!
remainingCancelableBaseAmount: BigInt!
remainingCancelableQuoteAmount: BigInt!
logIndex: BigInt! # Log index in transaction
type: String! # Always "CLAIM"
}
Cancel
Represents a cancel event when a maker cancels an order. Implements theOrderMovement interface.
Copy
type Cancel implements OrderMovement {
id: ID! # Format: {txHash}-{logIndex}-{orderId}
transaction: Transaction! # Transaction containing the cancel
timestamp: BigInt! # Cancel timestamp
book: Book! # Book where cancel occurred
quote: Token! # Quote token
base: Token! # Base token
canceller: Bytes! # Address that executed the cancel
owner: Bytes! # Owner of the order being canceled
trader: Bytes! # Alias for owner (implements OrderMovement interface)
orderId: BigInt! # Order ID as BigInt
orderIdString: String! # Order ID as string
order: Order # Reference to order
tick: BigInt! # Order tick
price: BigDecimal! # Price at cancel time (quote per base)
inversePrice: BigDecimal! # Inverse price (base per quote)
# Amounts canceled in this event
canceledUnitAmount: BigInt! # Canceled units
canceledBaseAmount: BigInt! # Canceled base amount
canceledQuoteAmount: BigInt! # Canceled quote amount
canceledAmountUSD: BigDecimal! # USD value of canceled amount
# Remaining amounts after cancel (snapshot)
remainingFilledUnitAmount: BigInt!
remainingFilledBaseAmount: BigInt!
remainingFilledQuoteAmount: BigInt!
remainingClaimedUnitAmount: BigInt!
remainingClaimedBaseAmount: BigInt!
remainingClaimedQuoteAmount: BigInt!
remainingClaimableUnitAmount: BigInt!
remainingClaimableBaseAmount: BigInt!
remainingClaimableQuoteAmount: BigInt!
remainingCancelableUnitAmount: BigInt!
remainingCancelableBaseAmount: BigInt!
remainingCancelableQuoteAmount: BigInt!
logIndex: BigInt! # Log index in transaction
type: String! # Always "CANCEL"
}
Chart data
ChartLog
Candlestick chart data for trading pairs.Copy
type ChartLog {
id: ID! # Format: ${baseToken}-${quoteToken}-${intervalType}-${timestamp}
base: Token! # Base token
quote: Token! # Quote token
marketCode: String! # Format: ${baseToken}-${quoteToken}
intervalType: String! # Interval: 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 1d, 1w
timestamp: BigInt! # Candle timestamp (seconds)
open: BigDecimal! # Opening price
high: BigDecimal! # High price
low: BigDecimal! # Low price
close: BigDecimal! # Closing price
baseVolume: BigDecimal! # Total volume in base token
bidBookBaseVolume: BigDecimal! # Bid book volume in base token
askBookBaseVolume: BigDecimal! # Ask book volume in base token
}
Analytics & statistics
User
Represents a user (EOA) interacting with the protocol.Copy
type User {
id: Bytes! # Wallet address (EOA only)
firstSeenTimestamp: BigInt! # First interaction timestamp
firstSeenBlockNumber: BigInt! # First interaction block number
nativeVolume: BigDecimal! # Volume in native token units
# Derived fields
userDayData: [UserDayData!]! # Daily user statistics
}
BookDayData
Daily snapshot of book statistics.Copy
type BookDayData {
id: ID! # Format: ${bookId}-{periodStartUnix}
date: Int! # Day timestamp
book: Book! # Parent book
price: BigDecimal! # Price (quote per base)
inversePrice: BigDecimal! # Inverse price (base per quote)
volumeQuote: BigDecimal! # Daily quote volume
volumeBase: BigDecimal! # Daily base volume
volumeUSD: BigDecimal! # Daily USD volume
protocolFeesQuote: BigDecimal! # Daily protocol fees in quote
protocolFeesBase: BigDecimal! # Daily protocol fees in base
protocolFeesUSD: BigDecimal! # Daily protocol fees in USD
totalValueLocked: BigDecimal! # TVL in quote token units
totalValueLockedUSD: BigDecimal! # TVL in USD
open: BigDecimal! # Opening price
high: BigDecimal! # High price
low: BigDecimal! # Low price
close: BigDecimal! # Closing price
}
TokenDayData
Daily snapshot of token statistics.Copy
type TokenDayData {
id: ID! # Token address concatenated with date
date: Int! # Day timestamp
token: Token! # Parent token
platformDayData: PlatformDayData! # Protocol-wide day data
volume: BigDecimal! # Daily volume in token units
volumeUSD: BigDecimal! # Daily volume in USD
totalValueLocked: BigDecimal! # TVL in token units
totalValueLockedUSD: BigDecimal! # TVL in USD
priceUSD: BigDecimal! # Price in USD
protocolFees: BigDecimal! # Daily protocol fees in token units
protocolFeesUSD: BigDecimal! # Daily protocol fees in USD
open: BigDecimal! # Opening price USD
high: BigDecimal! # High price USD
low: BigDecimal! # Low price USD
close: BigDecimal! # Closing price USD
}
PlatformDayData
Protocol-wide daily statistics.Copy
type PlatformDayData {
id: ID! # Day timestamp
date: Int! # Day timestamp
txCount: BigInt! # Number of daily transactions
walletCount: BigInt! # Number of daily active wallets
newWalletCount: BigInt! # Number of new wallets
# Derived fields
tokenDayData: [TokenDayData!]! # Token daily data
transactionTypes: [TransactionTypeDayData!]! # Transaction type breakdown
routerDayData: [RouterDayData!]! # Router usage data
}
TransactionTypeDayData
Daily transaction count by type.Copy
type TransactionTypeDayData {
id: ID! # Format: ${type}-${dayTimestamp}
date: Int! # Day timestamp
platformDayData: PlatformDayData! # Parent day data
type: String! # Transaction type
txCount: BigInt! # Transaction count
}
RouterDayData
Daily router usage statistics.Copy
type RouterDayData {
id: ID! # Format: ${router}-${dayTimestamp}
date: Int! # Day timestamp
platformDayData: PlatformDayData! # Parent day data
router: Bytes! # Router address
txCount: BigInt! # Transaction count
}
UserDayData
Daily user activity statistics.Copy
type UserDayData {
id: ID! # Format: ${wallet}-{dayTimestamp}
date: Int! # Day timestamp
txCount: BigInt! # Number of daily transactions
user: User! # Parent user
# Derived fields
volumes: [UserDayVolume!]! # Volume by token
}
UserDayVolume
Daily user volume per token.Copy
type UserDayVolume {
id: ID! # Format: ${wallet}-${token}-${dayTimestamp}
date: Int! # Day timestamp
user: Bytes! # User address
userDayData: UserDayData! # Parent user day data
token: Token! # Token
volume: BigDecimal! # Volume in token units
volumeUSD: BigDecimal! # Volume in USD
}
Fee tracking
Provider
Tracks fees collected by the protocol fee recipient (the primary fee recipient address set on the BookManager).Copy
type Provider {
id: Bytes! # Protocol fee recipient address
totalFeesCollectedUSD: BigDecimal! # Total protocol fees in USD across all tokens
orderCount: BigInt! # Number of orders that generated fees
# Derived fields
feesByToken: [ProviderTokenFee!]! # Fees breakdown by token
}
ProviderTokenFee
Protocol fee recipient’s fees per token.Copy
type ProviderTokenFee {
id: ID! # Format: provider-token
provider: Provider! # Protocol fee recipient
token: Token! # Fee token
totalFees: BigDecimal! # Total protocol fees in token units
totalFeesUSD: BigDecimal! # Total protocol fees in USD
}
Referrer
Tracks fees collected by referrers.Copy
type Referrer {
id: Bytes! # Referrer address
totalFeesCollectedUSD: BigDecimal! # Total fees in USD across all tokens
referralCount: BigInt! # Number of referrals
# Derived fields
feesByToken: [ReferrerTokenFee!]! # Fees breakdown by token
}
ReferrerTokenFee
Referrer fees per token.Copy
type ReferrerTokenFee {
id: ID! # Format: referrer-token
referrer: Referrer! # Parent referrer
token: Token! # Fee token
totalFees: BigDecimal! # Total fees in token units
totalFeesUSD: BigDecimal! # Total fees in USD
}
PayerReferrerFee
Tracks fee relationship between payer and referrer.Copy
type PayerReferrerFee {
id: ID! # Format: payer-referrer-token
payer: Bytes! # Address who paid the fee
referrer: Referrer! # Address who received the fee
token: Token! # Fee token
totalFeesPaid: BigDecimal! # Total fees paid in token units
totalFeesPaidUSD: BigDecimal! # Total fees paid in USD
}
UserFee
Tracks total fees paid by users.Copy
type UserFee {
id: ID! # Format: user-token
user: Bytes! # User address
token: Token! # Fee token
totalFeesPaid: BigDecimal! # Total fees (protocol + referrer)
providerFeesPaid: BigDecimal! # Fees paid to protocol fee recipient
referrerFeesPaid: BigDecimal! # Fees paid to referrers
totalFeesPaidUSD: BigDecimal! # Total fees in USD
}