Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

queryTrades

Read historical trades, optionally filtered by address. Paginated cursor-style.

Signature

function queryTrades(
  client: Client,
  parameters: {
    after?: string
    first?: number
    address?: Address
  },
): Promise<GraphqlQueryResult<Trade>>

Example

import { createPublicClient, createTransport, testnet } from "@left-curve/sdk"
import type { Address } from "@left-curve/sdk"
 
const client = createPublicClient({ chain: testnet, transport: createTransport() })
const user: Address = "0x1234567890abcdef1234567890abcdef12345678"
 
const page = await client.queryTrades({ address: user, first: 50 })

Parameters

afterstring, optional. Cursor for the next page.

firstnumber, optional. Page size.

addressAddress, optional. Filter by trader.

Returns

GraphqlQueryResult<Trade>{ pageInfo, nodes }. Each Trade has addr, denoms, direction, clearing price, and fees.

See also