Aktionariat Documentation
  • Introduction to Aktionariat
    • ⚡Quick Start
  • 🛠️APIs
    • 📊Subgraph
      • Schema
      • Query Examples
        • Platform data
        • Token Data
        • Brokerbot Data
        • Swaps Data
    • ⚙️External API
      • ⚙️External API (Gitbook)
  • 🌐Web
    • Integrate with Ethers.js
      • Brokerbot Quoter
    • Integrate Aktionariat Widgets
  • ⛓️Smart Contracts
    • 📔Contracts Overview
    • 👷‍♂️Guides
      • Implement A Trade
        • Direct Trades
        • Multihop Trades
      • Get Brokerbot Contract for Token
      • Buy Shares
      • Sell Shares
    • Technical Reference
      • Allowlist
      • Brokerbot
      • Drag-Along
      • Infinite Allowances
      • Multi-Signature Contract
      • Recovery
      • Shareholder Registry
  • 📖Reference
    • Brokerbot Architecture
    • Github
    • Whitepaper
    • Brokerbot Analytics
  • 💬Socials
    • Twitter
    • Telegram
    • LinkedIn
    • Youtube
Powered by GitBook
On this page
  • Get latest Swaps from Token
  • General Swap Data by Id

Was this helpful?

Edit on GitHub
  1. APIs
  2. Subgraph
  3. Query Examples

Swaps Data

PreviousBrokerbot DataNextExternal API

Last updated 1 year ago

Was this helpful?

If you are interested in a particular transaction or swap you can query them with the following example queries This is the reference for the full .

Get latest Swaps from Token

You can query for the latest swaps from a token by setting the where field to the token contract address.

This example query fetches multiple swap data about the sender, amounts, timestamp and transaction data for the DAKS token.

{
swaps(orderBy: timestamp, orderDirection: desc, where:
 { token: "0x6f38e0f1a73c96cb3f42598613ea3474f09cb200" }
  ) {
   id
    token {
      id
      symbol
    }
    base {
      id
      symbol
    }
    sender
    amountToken
    amountBase
    amountUSD
    timestamp
    transaction {
      id
      blockNumber
      gasUsed
      gasPrice
    }
  }
}

General Swap Data by Id

To query data about a particular swap, input the transaction hash + "-" + the index in the swaps transaction array as id ( or use an id from the latest swaps query response).

{
swaps(id: "0x7953dc2cdb8a27cbc5aa04002eca387368ea0aa0c06a46fca69e595a9ea333b7-70" ) {
  id
  token {
    id
    symbol
  }
  base {
    id
    symbol
  }
  sender
  amountToken
  amountBase
  amountUSD
  timestamp
  transaction {
    id
    blocknumber
    gasUsed
    gasPrice
 }
}

🛠️
📊
swap schema