Documentation Index
Fetch the complete documentation index at: https://docs.gtfo.vc/llms.txt
Use this file to discover all available pages before exploring further.
The subgraph exposes typed entities. Below are working examples aligned with the schema.
Use openOrders for active orders. Use orders for complete history.
Books (paginate)
query Books($first: Int!, $skip: Int!) {
books(first: $first, skip: $skip, orderBy: id) {
id
base {
id
symbol
decimals
}
quote {
id
symbol
decimals
}
unitSize
makerPolicy {
fee
isFeeInQuote
}
takerPolicy {
fee
isFeeInQuote
}
}
}
Depth by price level
query Depth($book: ID!, $first: Int!) {
book(id: $book) {
id
depths(first: $first, orderBy: tick, orderDirection: desc) {
tick
unitAmount
baseAmount
quoteAmount
}
}
}
Active orders for a user
query MyOpenOrders($owner: Bytes!, $book: ID!) {
openOrders(
where: { owner: $owner, book: $book }
orderBy: tick
orderDirection: desc
) {
id
tick
unitAmount
pendingUnitAmount
claimableUnitAmount
cancelableUnitAmount
timestamp
}
}
Recent taker trades (takes) in a book
query RecentTakes($book: ID!, $first: Int!) {
takes(
where: { book: $book }
first: $first
orderBy: timestamp
orderDirection: desc
) {
id
timestamp
trader
inputToken {
id
symbol
}
outputToken {
id
symbol
}
inputAmount
outputAmount
amountUSD
transaction {
id
}
}
}
Order history with fills, claims, and cancels
query OrderHistory($orderId: ID!) {
order(id: $orderId) {
id
tick
price
unitAmount
pendingUnitAmount
fills(orderBy: timestamp, orderDirection: asc) {
id
timestamp
inputAmount
outputAmount
transaction {
id
}
}
claims(orderBy: timestamp, orderDirection: asc) {
id
timestamp
claimedUnitAmount
transaction {
id
}
}
cancels(orderBy: timestamp, orderDirection: asc) {
id
timestamp
canceledUnitAmount
transaction {
id
}
}
}
}
Maker fills for a user across all books
query MakerFillsByUser($maker: Bytes!, $first: Int!) {
makerFills(
where: { maker: $maker }
first: $first
orderBy: timestamp
orderDirection: desc
) {
id
timestamp
book {
id
base {
symbol
}
quote {
symbol
}
}
tick
price
inputAmount
outputAmount
amountUSD
orderIdString
}
}
All trades for a given user in a book
query UserTradesInBook($user: Bytes!, $book: ID!, $first: Int!) {
trades(
where: { trader: $user, book: $book }
first: $first
orderBy: timestamp
orderDirection: desc
) {
id
type
timestamp
trader
book {
id
}
inputToken {
id
symbol
}
outputToken {
id
symbol
}
inputAmount
outputAmount
amountUSD
logIndex
transaction {
id
}
}
}
Cancels for a specific order
query OrderCancels($orderId: ID!) {
order(id: $orderId) {
id
tick
price
cancels(orderBy: timestamp, orderDirection: asc) {
id
timestamp
canceller
owner
canceledUnitAmount
canceledBaseAmount
canceledQuoteAmount
canceledAmountUSD
remainingClaimableUnitAmount
remainingCancelableUnitAmount
transaction {
id
}
}
}
}
Claims by owner across all books
query ClaimsByOwner($owner: Bytes!, $first: Int!) {
claims(
where: { owner: $owner }
first: $first
orderBy: timestamp
orderDirection: desc
) {
id
timestamp
book {
id
base {
symbol
}
quote {
symbol
}
}
claimer
orderIdString
tick
price
claimedUnitAmount
claimedBaseAmount
claimedQuoteAmount
claimedAmountUSD
transaction {
id
}
}
}
Cancels by owner across all books
query CancelsByOwner($owner: Bytes!, $first: Int!) {
cancels(
where: { owner: $owner }
first: $first
orderBy: timestamp
orderDirection: desc
) {
id
timestamp
book {
id
base {
symbol
}
quote {
symbol
}
}
canceller
orderIdString
tick
price
canceledUnitAmount
canceledBaseAmount
canceledQuoteAmount
canceledAmountUSD
transaction {
id
}
}
}
All order movements (takes, claims, cancels) for a user
Using the OrderMovement interface to query all order movements:
query UserOrderMovements($trader: Bytes!, $book: ID!, $first: Int!) {
orderMovements(
where: { trader: $trader, book: $book }
first: $first
orderBy: timestamp
orderDirection: desc
) {
id
type
timestamp
trader
book {
id
}
logIndex
transaction {
id
}
... on Take {
inputToken {
symbol
}
outputToken {
symbol
}
inputAmount
outputAmount
}
... on Claim {
orderIdString
claimedUnitAmount
claimedQuoteAmount
}
... on Cancel {
orderIdString
canceledUnitAmount
canceledQuoteAmount
}
}
}