From 1dde92c98eb0e3c0c61484c0cbcf78662b15c493 Mon Sep 17 00:00:00 2001 From: Gaurav Agarwal Date: Wed, 9 Sep 2026 21:09:59 +0530 Subject: [PATCH] docs: Trading-first rewrite of all four Meteora pages Chain-level cubes led every Meteora page while the Trading cubes are the house default. Across the set the mix was 33 chain-level query blocks to 6 Trading; it is now 26 Trading to 14, with chain-level kept only for what the Trading cubes cannot do: pool creation, pool reserves, and history older than the ~30-day Trading window. Data bugs fixed: - DBC launch tracking missed initialize_virtual_pool_with_token2022, 425 of 1,208 launches in 24h. Both launch instructions are now matched. - DAMM v2 pool creation filtered the EvtInitializePool event, whose row carries one account and an empty AccountNames list, so the mints and vaults the prose promised were unreadable. Now filters the three real instructions (initialize_pool, initialize_pool_with_dynamic_config, initialize_customizable_pool). - The DYN page led with a pool-creation stream for DAMM v1, which has had no pool-creation instructions at all. That section is replaced with a ranking of the pools that still trade, and the page says plainly that new DAMM v1 pools are no longer created. - DBC carried three dead hardcoded addresses and a query that timed out. Bonding-curve mints are short lived, so examples are placeholders plus a query that returns mints trading right now. - Volume examples used Solana(dataset: combined) with sum(Trade_Side_AmountInUSD). On the same 7-day window that undercounts by 22% against both realtime and the Trading cube, and adding the USD field to a grouped archive query shatters one row per month into hundreds. All four pages now take USD from the Trading cubes and aggregate native amounts on archive, with a caution box explaining it. - Top-trader queries selected Side.Type and Side.Account as dimensions, splitting each wallet into separate buy and sell rows. Replaced with Trading.Trades grouped by Trader.Address. Naming and metadata: - The DYN page is Meteora's DAMM v1; "DYN" is not a Meteora product name and drew 0 clicks at position 13.2. Retitled to Meteora DAMM v1 API, URL unchanged, with a note explaining the rename. - Real titles, descriptions and keywords replace the templated "Solana Meteora Damm V2 API" metadata. DAMM v2 was the worst CTR of the set: 5,603 impressions, 2 clicks, position 6.8. - FAQ blocks added to DBC (9) and DAMM v1 (7); DAMM v2 grows 4 to 9. - Every page gains a program-ID section, a four-program comparison table, a facts-only comparison against Meteora's own APIs, and a pricing section. Meteora publishes no data API for DBC at all. - Existing section slugs are pinned with explicit heading ids so indexed anchors keep resolving. Every query and subscription on all four pages was executed live on 2026-09-09: 29 queries returned rows and 16 subscriptions delivered. Pool-creation and graduation streams stay quiet inside a 25-second window because those events arrive roughly once a minute; each was confirmed with the same filter run as a 24-hour query. Co-Authored-By: Claude Opus 5 --- docs/blockchain/Solana/Meteora-DAMM-v2-API.md | 628 ++++++---- docs/blockchain/Solana/Meteora-DLMM-API.md | 694 +++++------ docs/blockchain/Solana/Meteora-DYN-API.md | 572 ++++++--- docs/blockchain/Solana/index.mdx | 2 +- .../meteora-dynamic-bonding-curve-api.md | 1109 ++++++++--------- 5 files changed, 1602 insertions(+), 1403 deletions(-) diff --git a/docs/blockchain/Solana/Meteora-DAMM-v2-API.md b/docs/blockchain/Solana/Meteora-DAMM-v2-API.md index 049c84a0e..8feef2752 100644 --- a/docs/blockchain/Solana/Meteora-DAMM-v2-API.md +++ b/docs/blockchain/Solana/Meteora-DAMM-v2-API.md @@ -1,348 +1,546 @@ --- -title: "Solana Meteora Damm V2 API" -description: "Solana Meteora Damm V2 API: real-time Solana memecoin and DEX data via Bitquery GraphQL APIs and Kafka streams. Keep queries fast with indexed filters." +title: "Meteora DAMM v2 API: Trades, Prices, OHLC and Pools" +sidebar_label: "Meteora DAMM v2 API" +description: "Meteora DAMM v2 API on Solana: cp_amm swaps with USD price and market cap, OHLC candles, new pools, top traders, volume and pool liquidity via Bitquery." +keywords: + - Meteora DAMM v2 API + - Meteora DAMM v2 + - cp_amm program + - Meteora DAMM v2 program ID + - Meteora DAMM v2 SDK + - Meteora DAMM v2 pools + - Meteora DAMM v2 OHLC + - Meteora API + - does Meteora have an API + - Solana DEX API --- + import FAQ from "@site/src/components/FAQ"; # Meteora DAMM v2 API -:::tip Need real-time Meteora DAMM v2 data or anything from the last ~30 days? -For **real-time + last ~30 days**, use the [**Trading cube**](/docs/trading/trading-data-overview) — [`Trading.Trades`](/docs/trading/crypto-trades-api/trades-api) gives you clean, MEV-filtered Meteora DAMM v2 swaps with **USD price, market cap, and supply on every row** across **9 chains in one API**. Use this page when you need **historical Meteora DAMM v2 data older than ~30 days**, raw per-swap detail, or call / event context. -::: +Meteora DAMM v2 is Meteora's current constant-product AMM on Solana, built on the `cp_amm` program at `cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG`. Positions are NFTs, ranges can be concentrated, and the program carries an anti-sniper fee schedule. Bitquery reads its activity into GraphQL queries, WebSocket subscriptions, Kafka and gRPC streams: swaps with USD price and market cap, new pools, prices, OHLC candles, top traders, volume and pool reserves. Every query below runs as written in the [Bitquery IDE](https://ide.bitquery.io) with a free trial token. -Bitquery provides comprehensive real-time and historical data APIs and Streams for the Solana blockchain, enabling developers and traders to build powerful applications and execute trades based on reliable information from Meteora's Dynamic Automated Market Maker (DAMM) v2. +If you arrived looking for the DAMM v2 SDK or IDL, those build and sign transactions. This page is the other half: reading what those transactions did, across every DAMM v2 pool at once. -## Meteora DAMM v2 API Guide +:::tip Start with the Trading API +Most questions on this page are answered fastest by the [**Trading API**](/docs/trading/trading-data-overview). [`Trading.Trades`](/docs/trading/crypto-trades-api/trades-api) returns **MEV-filtered swaps with USD price, market cap and supply on every row**, across **9 chains in one API**, and [`Trading.Pairs`](/docs/trading/crypto-price-api/pairs) gives pre-aggregated OHLC per pool down to one second. Filter either with `Pair: { Market: { Protocol: { is: "cp_amm" } } }` for DAMM v2. -In this section we will see how to get data on Meteora DAMM v2 trades in real-time. According to the official Meteora documentation, DAMM v2 is a Dynamic Automated Market Maker that provides efficient price discovery and liquidity provision for token pairs on Solana. +Drop to the chain-level cubes further down when you need what the Trading API does not carry: **history older than about 30 days**, pool reserves, or per-instruction detail such as pool creation. +::: :::note -`Trade Side Account` field will not be available as aggregates in Archive and Combined Datasets +To query or stream data via GraphQL **outside the Bitquery IDE**, you need to generate an API access token. + +Follow the steps here to create one: [How to generate Bitquery API token ➤](/docs/authorization/how-to-generate/) ::: -## Subscribe to Realtime DAMM v2 Trades +## What is the Meteora DAMM v2 program ID on Solana? + +The Meteora DAMM v2 program, `cp_amm`, is deployed at `cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG` on Solana mainnet, and Meteora uses the same address on devnet. Its pool authority PDA is `HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC`. + +``` +cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG +``` + +In the Trading cubes DAMM v2 is `Market.Protocol` `cp_amm`. In the Solana chain-level cubes the same rows carry `Dex.ProtocolName` `cp_amm` and `Dex.ProtocolFamily` `Meteora`. + +Meteora runs four trading programs on Solana, each with its own Bitquery page: + +| Meteora program | Program ID | Protocol name | Bitquery page | +| --- | --- | --- | --- | +| DAMM v2, constant-product pools with position NFTs | `cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG` | `cp_amm` | This page | +| DLMM, concentrated liquidity in price bins | `LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo` | `lb_clmm` | [Meteora DLMM API](/docs/blockchain/Solana/Meteora-DLMM-API/) | +| DAMM v1, the legacy Dynamic AMM | `Eo7WjKq67rjJQSZxS6z3YkapzY3eMj6Xy8X5EQVn5UaB` | `amm` | [Meteora DAMM v1 API](/docs/blockchain/Solana/Meteora-DYN-API/) | +| Dynamic Bonding Curve, launches that graduate to a DAMM pool | `dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN` | `dynamic_bonding_curve` | [Meteora DBC API](/docs/blockchain/Solana/meteora-dynamic-bonding-curve-api/) | + +DAMM v2 method names keep the IDL's snake_case spelling, so pool creation is `initialize_pool`, not `initializePool`. DLMM is the odd one out with camelCase. Rows whose method starts with `Evt`, such as `EvtSwap2` and `EvtInitializePool`, are the program's event logs emitted as inner instructions beside the real instruction; they carry no account names, so read accounts from the instruction itself. + +## Does Meteora have an API? + +Yes, for pool-level data. Meteora publishes a free REST [DAMM v2 Data API](https://docs.meteora.ag/developer-guides/damm-v2/api-reference/overview) at `https://damm-v2.datapi.meteora.ag`, limited to 10 requests a second with no key, covering pools and pool groups, per-pool OHLCV and volume history, and protocol stats. It has no per-swap trade endpoint, no per-wallet swap history and no streaming. Bitquery reads the same activity from the chain: swaps as individual rows with the trader and a USD price, new pools the moment they are created, reserves after every liquidity change, and history back to mid-2024. -This query subscribes to real-time trades on the Meteora DAMM v2 (Dynamic Automated Market Maker) on the Solana blockchain by filtering using the program address `cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG`. -You can run the query [here](https://ide.bitquery.io/Real-time-trades-on-MeteoraDAMMv2-DEX-on-Solana) +| | Meteora DAMM v2 Data API | Bitquery Meteora DAMM v2 API | +| --- | --- | --- | +| Access | REST, no key, 10 requests a second | GraphQL, WebSocket, Kafka and gRPC with an access token; seven-day free trial | +| Pools | Paginated pool list and single-pool state | New pools as they are created; reserves after each decoded swap, deposit or withdrawal | +| Trades | No per-swap endpoint | Swaps as individual rows with trader, amounts, USD price, market cap and signature | +| Candles and volume | Per-pool OHLCV and volume history | Pre-built candles from `Trading.Pairs`; any interval from `DEXTradeByTokens` | +| Traders | Not served | Top traders, buy and sell volume per wallet, PnL | +| History | Per-pool candles and volume | About 30 days on the Trading cubes, back to mid-2024 on the Solana archive | +| Rate limits | 10 requests a second | 30, 90 or 240 query requests a minute by plan, custom on Enterprise; streams metered separately | + +## Real-time Meteora DAMM v2 trades + +Stream every decoded DAMM v2 swap with the trader, both amounts, the USD price and the token's market cap and circulating supply. `Side` is the trader's own side. This is the query most integrations start from. ```graphql subscription { - Solana { - DEXTrades( + Trading { + Trades( where: { - Trade: { - Dex: { - ProgramAddress: { - is: "cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG" - } - } - } + Pair: { Market: { Protocol: { is: "cp_amm" }, Network: { is: "Solana" } } } } ) { - Trade { - Dex { - ProgramAddress - ProtocolFamily - ProtocolName - } - Buy { - Currency { - Name - Symbol - MintAddress - Decimals - Fungible - Uri - } - Amount - Account { - Address - } - PriceAgainstSellCurrency: Price - } - Sell { - Account { - Address - } - Amount - Currency { - Name - Symbol - MintAddress - Decimals - Fungible - Uri - } - PriceAgainstBuyCurrency: Price - } - } Block { Time } - Transaction { - Signature + Side + Price + PriceInUsd + Trader { + Address + } + Amounts { + Base + Quote + } + AmountsInUsd { + Base + Quote + } + Supply { + MarketCap + CirculatingSupply + } + TransactionHeader { + Hash + } + Pair { + Market { + Address + Protocol + } + Token { + Symbol + Address + } + QuoteToken { + Symbol + Address + } } } } } ``` -## Latest Pool Creation on Meteora DAMM v2 +Add `Pair: { Token: { Address: { is: "" } } }` to follow one token, or `AmountsInUsd: { Base: { gt: 10000 } }` to watch only large trades. The same body runs as a query with `limit`, `orderBy: { descending: Block_Time }` and a `Block: { Time: { since_relative: { minutes_ago: 10 } } }` filter. -The below query tracks latest pool creation on Meteora DAMM v2. +For the lowest latency the same swaps are on the Kafka topic `solana.dextrades.proto` and the [gRPC DEX trades topic](/docs/grpc/solana/topics/dextrades/); filter on `ProtocolName` `cp_amm` in the consumer. -The `"Program": {"AccountNames"}` includes the order in which account addresses are mentioned in `Accounts` list. +## Latest price and market cap of a token on Meteora DAMM v2 -This includes pool creator, token vaults and token mints for the tokens being used in the pool. +The token examples below use MET (`METvsvVRapdj9cFLzq4Tr43xK4tAjQfwX76z3n6mWQL`), Meteora's own token, which has traded on DAMM v2 since October 2025. `Trading.Pairs` returns the latest interval for the pool with OHLC, average price, volume and market cap already computed. -The mint addresses for the tokens being used in the pool are listed, indicating which tokens the DAMM v2 pool will support. - -You can test the query [here](https://ide.bitquery.io/Track-Latest-created-pools-on-Meteora-DAMM-v2) +`Price: { IsQuotedInUsd: true }` matters: every market publishes each interval twice, once in USD and once in the quote token. ```graphql -subscription MyQuery { - Solana { - Instructions( - where: {Transaction: {Result: {Success: true}}, Instruction: {Program: {Method: {is: "EvtInitializePool"}, Address: {is: "cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG"}}}} +{ + Trading { + Pairs( + limit: { count: 1 } + orderBy: { descending: Block_Time } + where: { + Token: { Address: { is: "METvsvVRapdj9cFLzq4Tr43xK4tAjQfwX76z3n6mWQL" } } + Market: { Protocol: { is: "cp_amm" }, Network: { is: "Solana" } } + Price: { IsQuotedInUsd: true } + Interval: { Time: { Duration: { eq: 60 } } } + } ) { Block { Time } - Instruction { - Accounts { - Address - IsWritable - Token { - Mint - Owner - ProgramId - } + Token { + Symbol + Address + } + QuoteToken { + Symbol + } + Market { + Address + Protocol + } + Price { + Ohlc { + Open + High + Low + Close } - Program { - AccountNames - Address - Arguments { - Name - Type - Value { - ... on Solana_ABI_Integer_Value_Arg { - integer - } - ... on Solana_ABI_String_Value_Arg { - string - } - ... on Solana_ABI_Address_Value_Arg { - address - } - ... on Solana_ABI_BigInt_Value_Arg { - bigInteger - } - ... on Solana_ABI_Bytes_Value_Arg { - hex - } - ... on Solana_ABI_Boolean_Value_Arg { - bool - } - ... on Solana_ABI_Float_Value_Arg { - float - } - ... on Solana_ABI_Json_Value_Arg { - json - } - } - } - Method - Name + Average { + Mean } } - Transaction { - Signature - Signer + Volume { + Usd + Base + } + Supply { + MarketCap + FullyDilutedValuationUsd } } } } ``` -## Latest Price of a Token on Meteora DAMM v2 +This gives the price **on DAMM v2**, which is what you want on a venue page. For a token's price across every venue, weighted to its most liquid market, drop the protocol filter and add `Ranking: { Position: { eq: 1 } }` as described in [most accurate token price](/docs/trading/crypto-price-api/pairs/#most-accurate-token-price). The two differ whenever a token's deepest pool sits on another program: MET itself is priced from a DLMM pool by that measure. -You can use the following query to get the latest price of a token on Meteora DAMM v2 on Solana. This query fetches the most recent trade data for a specific token pair. +## Real-time price feed of a token on Meteora DAMM v2 -You can run this query using this [link](https://ide.bitquery.io/latest-price-of-a-token-on-Damm-v2). +The same filter as a subscription. Each message is one interval of the MET pool on DAMM v2 with fresh OHLC and market cap. ```graphql -{ - Solana { - DEXTradeByTokens( - limit: {count: 1} - orderBy: {descending: Block_Time} - where: {Trade: {Dex: {ProgramAddress: {is: "cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG"}}, Currency: {MintAddress: {is: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"}}, Side: {Currency: {MintAddress: {is: "So11111111111111111111111111111111111111112"}}}}} +subscription { + Trading { + Pairs( + where: { + Token: { Address: { is: "METvsvVRapdj9cFLzq4Tr43xK4tAjQfwX76z3n6mWQL" } } + Market: { Protocol: { is: "cp_amm" }, Network: { is: "Solana" } } + Price: { IsQuotedInUsd: true } + Interval: { Time: { Duration: { eq: 1 } } } + } ) { Block { Time } - Trade { - Price - PriceInUSD + Token { + Symbol + } + QuoteToken { + Symbol + } + Market { + Address + } + Price { + Ohlc { + Open + High + Low + Close + } + } + Volume { + Usd + } + Supply { + MarketCap } } } } ``` -## Realtime Price Feed of a Token on Meteora DAMM v2 - -You can use the following subscription to get real-time price updates of a token on Meteora DAMM v2 on Solana. This provides live price data as new trades occur. +## Meteora DAMM v2 OHLC API -You can run this query using this [link](https://ide.bitquery.io/Realtime-Price-feed-of-a-Token-on-Meteora-DAMM-v2). +`Trading.Pairs` serves candles at any interval you ask for, so there is nothing to aggregate. Set `Interval.Time.Duration` in seconds: 1 for one-second candles, 60 for one-minute, 3600 for hourly. ```graphql -subscription{ - Solana { - DEXTradeByTokens( - where: {Trade: {Dex: {ProgramAddress: {is: "cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG"}}, Currency: {MintAddress: {is: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"}}}} +{ + Trading { + Pairs( + limit: { count: 30 } + orderBy: { descending: Block_Time } + where: { + Token: { Address: { is: "METvsvVRapdj9cFLzq4Tr43xK4tAjQfwX76z3n6mWQL" } } + Market: { Protocol: { is: "cp_amm" }, Network: { is: "Solana" } } + Price: { IsQuotedInUsd: true } + Interval: { Time: { Duration: { eq: 3600 } } } + } ) { Block { Time } - Trade { - Price - PriceInUSD + Market { + Address + } + QuoteToken { + Symbol + } + Price { + Ohlc { + Open + High + Low + Close + } + } + Volume { + Usd + Base + Quote } } } } ``` -## Meteora DAMM v2 OHLC API +## Top traders of a token on Meteora DAMM v2 -If you want to get OHLC (Open, High, Low, Close) data for any specific currency pair on Meteora DAMM v2, you can use this API. This provides technical analysis data for charting and trading strategies. +Ranks wallets by USD volume on DAMM v2 over the last 24 hours, one row per wallet, with the USD each bought and sold. `Trading.Trades` reports `Side` from the trader's point of view, so the split needs no field gymnastics. :::note -Only use this API as a query and not as a subscription websocket, as Aggregates and Time Intervals don't work well with subscriptions. +Run this as a query, not a subscription. Aggregates over WebSocket return partial results. ::: -You can run this query [here](https://ide.bitquery.io/Meteora-DAMM-v2-OHLC-API). +```graphql +query TopTraders($token: String) { + Trading { + Trades( + limit: { count: 100 } + orderBy: { descendingByField: "volumeUsd" } + where: { + Pair: { + Market: { Protocol: { is: "cp_amm" }, Network: { is: "Solana" } } + Token: { Address: { is: $token } } + } + Block: { Time: { since_relative: { hours_ago: 24 } } } + } + ) { + Trader { + Address + } + volumeUsd: sum(of: AmountsInUsd_Base) + bought: sum(of: AmountsInUsd_Base, if: { Side: { is: "Buy" } }) + sold: sum(of: AmountsInUsd_Base, if: { Side: { is: "Sell" } }) + buys: count(if: { Side: { is: "Buy" } }) + sells: count(if: { Side: { is: "Sell" } }) + trades: count + } + } +} +{ + "token": "METvsvVRapdj9cFLzq4Tr43xK4tAjQfwX76z3n6mWQL" +} +``` + +Subtracting `bought` from `sold` gives a rough realised PnL for the window. The [wallet PnL guide](/docs/trading/crypto-trades-api/wallet-pnl/) covers the full method. + +## Trading volume, buy volume and sell volume on Meteora DAMM v2 + +Seven-day totals for MET on DAMM v2: USD volume, the buy and sell split, trade counts and the number of distinct wallets. Change `days_ago` for other windows, up to the roughly 30-day Trading window. ```graphql { + Trading { + Trades( + where: { + Pair: { + Market: { Protocol: { is: "cp_amm" }, Network: { is: "Solana" } } + Token: { + Address: { is: "METvsvVRapdj9cFLzq4Tr43xK4tAjQfwX76z3n6mWQL" } + } + } + Block: { Time: { since_relative: { days_ago: 7 } } } + } + ) { + volumeUsd: sum(of: AmountsInUsd_Base) + buy_volume: sum(of: AmountsInUsd_Base, if: { Side: { is: "Buy" } }) + sell_volume: sum(of: AmountsInUsd_Base, if: { Side: { is: "Sell" } }) + buys: count(if: { Side: { is: "Buy" } }) + sells: count(if: { Side: { is: "Sell" } }) + traders: count(distinct: Trader_Address) + } + } +} +``` + +Drop the `Token` filter to get the same totals for the whole DAMM v2 program. + +## New Meteora DAMM v2 pools in real time + +Pool creation is per-instruction detail, so this one uses the chain-level `Instructions` cube. DAMM v2 creates pools through three instructions: `initialize_pool_with_dynamic_config` carries most of the traffic, with `initialize_pool` and `initialize_customizable_pool` behind it. Match all three. + +`Program.AccountNames` names each entry of `Instruction.Accounts` in order: `creator` and `payer` are the wallets, `pool` is the new pool address, `token_a_mint` and `token_b_mint` the pair, `token_a_vault` and `token_b_vault` the reserves, and `position_nft_mint` the NFT minted for the creator's opening position. + +:::note +Filter the instructions, not the `EvtInitializePool` event. The event fires once per pool as well, but its row carries a single account and an empty `AccountNames` list, so you cannot read the mints or vaults off it. +::: + +```graphql +subscription { Solana { - DEXTradeByTokens( - orderBy: {descendingByField: "Block_Timefield"} - where: {Trade: {Currency: {MintAddress: {is: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"}}, Side: {Currency: {MintAddress: {is: "So11111111111111111111111111111111111111112"}}}, Dex: {ProgramAddress: {is: "cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG"}}, PriceAsymmetry: {lt: 0.1}}} - limit: {count: 10} + Instructions( + where: { + Transaction: { Result: { Success: true } } + Instruction: { + Program: { + Address: { is: "cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG" } + Method: { + in: [ + "initialize_pool" + "initialize_pool_with_dynamic_config" + "initialize_customizable_pool" + ] + } + } + } + } ) { Block { - Timefield: Time(interval: {in: minutes, count: 1}) + Time } - volume: sum(of: Trade_Amount) - Trade { - high: Price(maximum: Trade_Price) - low: Price(minimum: Trade_Price) - open: Price(minimum: Block_Slot) - close: Price(maximum: Block_Slot) + Instruction { + Accounts { + Address + IsWritable + Token { + Mint + Owner + ProgramId + } + } + Program { + AccountNames + Address + Method + Name + } + } + Transaction { + Signature + Signer } - count } } } ``` -## Get the Top Traders of a specific Token on Meteora DAMM v2 DEX +Swap `subscription` for a query and add `Block: { Time: { since_relative: { hours_ago: 24 } } }` with `limit` to list the day's new pools instead of waiting for the next one. + +## Liquidity of a Meteora DAMM v2 pool -The below query gets the Top Traders of the specified Token on Meteora DAMM v2. This provides insights into the most active traders and their trading patterns. +`DEXPools` records a pool's reserves after each swap, deposit or withdrawal it decodes. `Base.PostAmount` and `Quote.PostAmount` are the balances after the event, `PostAmountInUSD` their USD value, and `ChangeAmount` the signed change that event caused. This returns the latest state of the MET/USDC pool. :::note -Keep in mind you can use this API only as a query and not a subscription websocket because aggregates don't work with subscription and you will end up getting wrong results. +`DEXPools` is a realtime-only cube: it keeps roughly the last 12 hours and has no archive dataset, so use it for current reserves and live liquidity events rather than TVL history. See [data coverage and retention](/docs/graphql/data-coverage-retention/). ::: -You can run the query [here](https://ide.bitquery.io/Get-the-Top-Traders-of-a-specific-Token-on-Meteora-DAMM-v2-DEX_1) - ```graphql -query TopTraders($token: String) { +{ Solana { - DEXTradeByTokens( - orderBy: {descendingByField: "volumeUsd"} - limit: {count: 100} - where: {Trade: {Currency: {MintAddress: {is: $token}}, Dex: {ProgramAddress: {is: "cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG"}}}, Transaction: {Result: {Success: true}}} - ) { - Trade { - Account { - Owner + DEXPools( + limit: { count: 1 } + orderBy: { descending: Block_Time } + where: { + Pool: { + Market: { + MarketAddress: { is: "BnztueWcXv93mgW7yJe8WYpnCxpz34nujPhfjQT6SLu1" } + } + Dex: { + ProgramAddress: { is: "cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG" } + } } - Side { - Account { - Address + } + ) { + Block { + Time + } + Pool { + Market { + MarketAddress + BaseCurrency { + Symbol + MintAddress + } + QuoteCurrency { + Symbol + MintAddress } - Type + } + Dex { + ProtocolName + ProtocolFamily + } + Base { + ChangeAmount + PostAmount + PostAmountInUSD + } + Quote { + ChangeAmount + PostAmount + PostAmountInUSD + PriceInUSD } } - bought: sum(of: Trade_Amount, if: {Trade: {Side: {Type: {is: buy}}}}) - sold: sum(of: Trade_Amount, if: {Trade: {Side: {Type: {is: sell}}}}) - volume: sum(of: Trade_Amount) - volumeUsd: sum(of: Trade_Side_AmountInUSD) } } } -{ - "token": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" -} ``` -## Get Trading Volume, Buy Volume, Sell Volume of a Token +To stream liquidity changes across all DAMM v2 pools, subscribe to the same cube and keep rows where either reserve moved, using `any` over `Base` and `Quote`. -This query fetches the traded volume, buy volume and sell volume of a specific token on Meteora DAMM v2. This provides comprehensive volume analytics for trading insights and market analysis. +## Historical Meteora DAMM v2 trades -Try out the API [here](https://ide.bitquery.io/Get-trading-volume-buy-volume-sell-volume-of-a-token_2). +The Trading cubes hold about 30 days. For anything older, use the chain-level `DEXTradeByTokens` cube with `dataset: archive`, which reaches back to mid-2024. This returns monthly trade counts and volume in MET for the token on DAMM v2 since it started trading. + +:::caution Aggregate in native amounts on `archive` and `combined`, not USD +Summing `Trade_Side_AmountInUSD` on the Solana `archive` and `combined` datasets does not aggregate cleanly: adding it to a grouped query shatters one row per month into hundreds of partial rows, and `combined` also returns fewer trades than `realtime` over the same window. Aggregate `Trade_Amount` instead, and take USD figures from the Trading cubes, where every row carries a vetted USD price. +::: ```graphql -query MyQuery { - Solana(dataset: combined) { +{ + Solana(dataset: archive) { DEXTradeByTokens( - where: {Block: {Time: {since: "2025-03-10T07:00:00Z"}}, Transaction: {Result: {Success: true}}, Trade: {Currency: {MintAddress: {is: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"}}, Side: {Currency: {MintAddress: {is: "So11111111111111111111111111111111111111112"}}}, Dex: {ProgramAddress: {is: "cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG"}}}} - ) { - Trade { - Currency { - MintAddress - Decimals - } - Side { - Currency { - Name - MintAddress + orderBy: { descendingByField: "Block_month" } + where: { + Block: { Time: { since: "2025-10-01T00:00:00Z" } } + Transaction: { Result: { Success: true } } + Trade: { + Currency: { + MintAddress: { is: "METvsvVRapdj9cFLzq4Tr43xK4tAjQfwX76z3n6mWQL" } + } + Dex: { + ProgramAddress: { is: "cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG" } } } } - traded_volume_USD: sum(of: Trade_Side_AmountInUSD) - traded_volume: sum(of: Trade_Amount) - buy_volume: sum( - of: Trade_Side_AmountInUSD - if: {Trade: {Side: {Type: {is: buy}}}} - ) - sell_volume: sum( - of: Trade_Side_AmountInUSD - if: {Trade: {Side: {Type: {is: sell}}}} - ) + ) { + Block { + month: Time(interval: { in: months, count: 1 }) + } + volume_met: sum(of: Trade_Amount) + trades: count } } } ``` +The chain-level cubes also carry per-swap detail the Trading cubes leave out, such as the exact instruction that produced a swap and the token accounts on each side. The [Solana DEX Trades API](/docs/blockchain/Solana/solana-dextrades/) covers those fields, and [DEXTrades vs DEXTradeByTokens vs Trading.Trades](/docs/cubes/dextrades-dextradebytokens-trading-trades/) explains when each one is the right tool. + +## API key, free trial and pricing + +Create an access token at [account.bitquery.io](https://account.bitquery.io/) and follow [how to generate a token](/docs/authorization/how-to-generate/). The free trial runs for seven days and includes 1,000 API points, 100 MCP credits and two simultaneous streams. Request rate limits by plan are 30 a minute on Personal, 90 on Pro and 240 on Scale, with custom limits on Enterprise; see [rate limits](/docs/plans/rate-limits/). Points and streams are explained on [how billing works](/docs/plans/how-billing-works/), and plan prices are on the [Solana DEX API product page](https://bitquery.io/products/solana-dex-api) and the [pricing page](https://bitquery.io/pricing). Kafka access is a separate line item from the GraphQL plan. + -## Related Documentation +## Related documentation - [Meteora DLMM API](/docs/blockchain/Solana/Meteora-DLMM-API/) +- [Meteora DAMM v1 API](/docs/blockchain/Solana/Meteora-DYN-API/) +- [Meteora Dynamic Bonding Curve API](/docs/blockchain/Solana/meteora-dynamic-bonding-curve-api/) +- [Trading API overview](/docs/trading/trading-data-overview/), [Trades cube](/docs/trading/crypto-trades-api/trades-api/) and [Pairs cube](/docs/trading/crypto-price-api/pairs/) +- [Wallet PnL](/docs/trading/crypto-trades-api/wallet-pnl/) - [Solana DEX Trades API](/docs/blockchain/Solana/solana-dextrades/) -- [Solana Token Holders API](/docs/blockchain/Solana/solana-token-holders/) -- [Real-time Solana Data Streams](/docs/streams/real-time-solana-data/) +- [DEXTrades vs DEXTradeByTokens vs Trading.Trades](/docs/cubes/dextrades-dextradebytokens-trading-trades/) +- [Data coverage and retention](/docs/graphql/data-coverage-retention/) +- [gRPC DEX trades topic](/docs/grpc/solana/topics/dextrades/) and [real-time Solana streams over Kafka](/docs/streams/real-time-solana-data/) - [Schema overview](/docs/schema/schema-intro/) - [API Authorization](/docs/authorization/how-to-use/) diff --git a/docs/blockchain/Solana/Meteora-DLMM-API.md b/docs/blockchain/Solana/Meteora-DLMM-API.md index f8764cd0b..a6c3c4890 100644 --- a/docs/blockchain/Solana/Meteora-DLMM-API.md +++ b/docs/blockchain/Solana/Meteora-DLMM-API.md @@ -21,10 +21,10 @@ import FAQ from "@site/src/components/FAQ"; Meteora DLMM (Dynamic Liquidity Market Maker) is Meteora's concentrated-liquidity DEX on Solana. It runs on the `lb_clmm` program at `LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo`, holds liquidity in discrete price bins, and raises fees when volatility rises. Bitquery reads that program's activity into GraphQL queries, WebSocket subscriptions, Kafka and gRPC streams: live swaps, new pools, token prices, OHLC candles, pool reserves, top traders and volume. Every query below runs as written in the [Bitquery IDE](https://ide.bitquery.io) with a free trial token. Meteora's own [DLMM Data API](#does-meteora-have-an-api) serves pool state, positions and per-pool candles but has no trade feed and no streaming; the queries below cover both, with history back to mid-2024. -:::tip Want structured trades, OHLC and market cap? Start with the Trading API -The [**Trading API**](/docs/trading/trading-data-overview) is the fastest path to clean Meteora DLMM market data. [`Trading.Trades`](/docs/trading/crypto-trades-api/trades-api) returns **MEV-filtered swaps with USD price, market cap and supply on every row**, across **9 chains in one API**; filter `Pair: { Market: { Protocol: { is: "lb_clmm" } } }` for DLMM. [`Trading.Pairs`](/docs/trading/crypto-price-api/pairs) gives pre-aggregated OHLC per DLMM pool down to one second, so you never build candles yourself. Worked examples are in [DLMM trades with USD price, market cap and supply](#dlmm-trades-with-usd-price-market-cap-and-supply) below. +:::tip Start with the Trading API +The [**Trading API**](/docs/trading/trading-data-overview) answers most questions on this page fastest. [`Trading.Trades`](/docs/trading/crypto-trades-api/trades-api) returns **MEV-filtered swaps with USD price, market cap and supply on every row**, across **9 chains in one API**, and [`Trading.Pairs`](/docs/trading/crypto-price-api/pairs) gives pre-aggregated OHLC per DLMM pool down to one second. -Reach for the chain-level queries on this page when you need what the Trading API does not carry: **history older than the Trading window** (about 30 days), pool reserves, per-instruction detail such as pool creation, or call / event context. +Drop to the chain-level cubes further down for what the Trading API does not carry: **history older than about 30 days**, pool reserves, and per-instruction detail such as pool creation. ::: :::note @@ -70,68 +70,52 @@ Yes, for pool-level data. Meteora publishes a free REST [DLMM Data API](https:// ## Real-time Meteora DLMM trades {#subscribe-to-realtime-dlmm-trades} -This subscription streams DLMM swaps as they land, filtered by the program address `LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo`. `Trade.Buy.Currency` is what the trader received and `Trade.Sell.Currency` what the trader paid; `Trade.Market.MarketAddress` is the DLMM pool and `Transaction.Signer` the wallet that signed. `AmountInUSD` and `PriceInUSD` give the USD view of each side. - -You can run the subscription [in the Bitquery IDE](https://ide.bitquery.io/Real-time-trades-on-MeteoraDLMM-DEX-on-Solana). +Stream every decoded DLMM swap with the trader, both amounts, the USD price and the token's market cap and circulating supply. `Side` is the trader's own side. This is where most integrations start. ```graphql subscription { - Solana { - DEXTrades( + Trading { + Trades( where: { - Trade: { - Dex: { - ProgramAddress: { is: "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" } - } - } - Transaction: { Result: { Success: true } } + Pair: { Market: { Protocol: { is: "lb_clmm" }, Network: { is: "Solana" } } } } ) { Block { Time } - Transaction { - Signature - Signer + Side + Price + PriceInUsd + Trader { + Address } - Trade { - Dex { - ProgramAddress - ProtocolFamily - ProtocolName - } + Amounts { + Base + Quote + } + AmountsInUsd { + Base + Quote + } + Supply { + MarketCap + CirculatingSupply + } + TransactionHeader { + Hash + } + Pair { Market { - MarketAddress + Address + Protocol } - Buy { - Currency { - Name - Symbol - MintAddress - } - Amount - AmountInUSD - Account { - Address - Owner - } - PriceAgainstSellCurrency: Price - PriceInUSD + Token { + Symbol + Address } - Sell { - Currency { - Name - Symbol - MintAddress - } - Amount - AmountInUSD - Account { - Address - Owner - } - PriceAgainstBuyCurrency: Price - PriceInUSD + QuoteToken { + Symbol + Address } } } @@ -139,304 +123,325 @@ subscription { } ``` -For the lowest latency, the same trades are on the Kafka topic `solana.dextrades.proto` and the [gRPC DEX trades topic](/docs/grpc/solana/topics/dextrades/); filter on `ProgramAddress` or on `ProtocolFamily` `Meteora` in the consumer. See the [Solana protobuf reference](/docs/streams/protobuf/chains/Solana-protobuf/) and [real-time Solana streams](/docs/streams/real-time-solana-data/). +Add `Pair: { Token: { Address: { is: "" } } }` to follow one token, or `AmountsInUsd: { Base: { gt: 10000 } }` to watch only large trades. The same body runs as a query with `limit`, `orderBy: { descending: Block_Time }` and a `Block: { Time: { since_relative: { minutes_ago: 10 } } }` filter. -## New Meteora DLMM pools in real time {#latest-pool-creation-on-meteora-dlmm} +For the lowest latency the same swaps are on the Kafka topic `solana.dextrades.proto` and the [gRPC DEX trades topic](/docs/grpc/solana/topics/dextrades/); filter on `ProgramAddress` or on `ProtocolFamily` `Meteora` in the consumer. See the [Solana protobuf reference](/docs/streams/protobuf/chains/Solana-protobuf/) and [real-time Solana streams](/docs/streams/real-time-solana-data/). -Every DLMM pool is an `LbPair` account created by one of the pool-creation instructions: `initializeLbPair2` for standard permissionless pools, `initializeCustomizablePermissionlessLbPair2` for pools with custom parameters, `initializePermissionLbPair` for permissioned launches, and the un-numbered legacy SPL-Token-only forms. This subscription emits one row per new pool. `Program.AccountNames` gives the meaning of each entry in `Instruction.Accounts` in order: the first account is the new pool address (`lbPair`), `tokenMintX` and `tokenMintY` are the two token mints, `reserveX` and `reserveY` the pool vaults, and `funder` the wallet that paid for the pool's creation. Pool creation is far less frequent than swaps, so expect this stream to stay quiet for minutes at a time. To list recent pools instead, run the same filter as a query with `Block: { Time: { since_relative: { hours_ago: 24 } } }`. +:::note Some DLMM swaps are not decoded yet +The trade cubes decode DLMM `swap` and `swap2` instructions, including inside aggregator routes through Jupiter and other routers. Swaps sent as `swapExactOut`, `swapExactOut2` or `swapWithPriceImpact2` do not currently produce trade rows in either the chain-level or the Trading cubes, so DLMM volume read from any cube is lower than the on-chain total. +::: -You can test the subscription [in the Bitquery IDE](https://ide.bitquery.io/Track-Latest-created-pools-on-Meteora-DLMM_1). +## Latest price of a token on Meteora DLMM {#latest-price-of-a-token-on-meteora-dlmm} + +The token examples below use TRUMP (`6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN`), which has traded on Meteora DLMM since its launch in January 2025; where a pool address is needed they use a TRUMP/USDC DLMM pool, `3C5YE97HADPDxZehYq9Cis8AXr9aNyrUsczKzE1nDbW9`. `Trading.Pairs` returns the latest interval for the pool with OHLC, average price, volume and market cap already computed. + +`Price: { IsQuotedInUsd: true }` matters: every market publishes each interval twice, once in USD and once in the quote token. ```graphql -subscription { - Solana { - Instructions( +{ + Trading { + Pairs( + limit: { count: 1 } + orderBy: { descending: Block_Time } where: { - Transaction: { Result: { Success: true } } - Instruction: { - Program: { - Address: { is: "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" } - Method: { - in: [ - "initializeLbPair2", - "initializeCustomizablePermissionlessLbPair2", - "initializePermissionLbPair", - "initializeLbPair", - "initializeCustomizablePermissionlessLbPair" - ] - } - } - } + Token: { Address: { is: "6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN" } } + Market: { Protocol: { is: "lb_clmm" }, Network: { is: "Solana" } } + Price: { IsQuotedInUsd: true } + Interval: { Time: { Duration: { eq: 60 } } } } ) { Block { Time } - Instruction { - Accounts { - Address - IsWritable - Token { - Mint - Owner - ProgramId - } + Token { + Symbol + Address + } + QuoteToken { + Symbol + } + Market { + Address + Protocol + } + Price { + Ohlc { + Open + High + Low + Close } - Program { - AccountNames - Address - Method - Name - Arguments { - Name - Type - Value { - ... on Solana_ABI_Integer_Value_Arg { - integer - } - ... on Solana_ABI_String_Value_Arg { - string - } - ... on Solana_ABI_Address_Value_Arg { - address - } - ... on Solana_ABI_BigInt_Value_Arg { - bigInteger - } - ... on Solana_ABI_Bytes_Value_Arg { - hex - } - ... on Solana_ABI_Boolean_Value_Arg { - bool - } - ... on Solana_ABI_Float_Value_Arg { - float - } - ... on Solana_ABI_Json_Value_Arg { - json - } - } - } + Average { + Mean } } - Transaction { - Signature - Signer + Volume { + Usd + Base + } + Supply { + MarketCap + FullyDilutedValuationUsd } } } } ``` -## Latest price of a token on Meteora DLMM +This gives the price **on DLMM**, which is what you want on a venue page. For a token's price across every venue, weighted to its deepest market, drop the protocol filter and add `Ranking: { Position: { eq: 1 } }` as described in [most accurate token price](/docs/trading/crypto-price-api/pairs/#most-accurate-token-price). -The token examples below use TRUMP (`6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN`), which has traded on Meteora DLMM since its launch in January 2025; where a pool address is needed they use a TRUMP/USDC DLMM pool, `3C5YE97HADPDxZehYq9Cis8AXr9aNyrUsczKzE1nDbW9`. Swap in any mint and quote. `Trade.Currency` is the token you price, `Trade.Side.Currency` the quote it traded against, `Trade.Price` the price in the quote token and `Trade.PriceInUSD` the USD price; `Trade.Market.MarketAddress` tells you which DLMM pool printed the trade. +## Real-time price feed of a token {#realtime-price-feed-of-a-token-on-meteora-dlmm} -You can run this query [in the Bitquery IDE](https://ide.bitquery.io/latest-price-of-a-token-on-DLMM). +The same filter as a subscription, at one-second intervals. ```graphql -{ - Solana { - DEXTradeByTokens( - limit: { count: 1 } - orderBy: { descending: Block_Time } +subscription { + Trading { + Pairs( where: { - Trade: { - Dex: { - ProgramAddress: { is: "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" } - } - Currency: { - MintAddress: { is: "6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN" } - } - Side: { - Currency: { - MintAddress: { is: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" } - } - } - } - Transaction: { Result: { Success: true } } + Token: { Address: { is: "6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN" } } + Market: { Protocol: { is: "lb_clmm" }, Network: { is: "Solana" } } + Price: { IsQuotedInUsd: true } + Interval: { Time: { Duration: { eq: 1 } } } } ) { Block { Time } - Trade { - Price - PriceInUSD - Market { - MarketAddress - } - Currency { - Symbol - } - Side { - Currency { - Symbol - } + Token { + Symbol + } + QuoteToken { + Symbol + } + Market { + Address + } + Price { + Ohlc { + Open + High + Low + Close } } + Volume { + Usd + } + Supply { + MarketCap + } } } } ``` -This is the last DLMM print for that pair. For a token's price across every venue, weighted to its most liquid market, use `Trading.Pairs` with `Ranking.Position` 1 as described in [most accurate token price](/docs/trading/crypto-price-api/pairs/#most-accurate-token-price). - -## Real-time price feed of a token {#realtime-price-feed-of-a-token-on-meteora-dlmm} - -The same filter as a subscription: one message per TRUMP/USDC trade on DLMM with the price of that print. `Side.Type` is `buy` when the trader bought TRUMP and `sell` when they sold it. +## Meteora DLMM OHLC API {#meteora-dlmm-ohlc-api} -You can run the subscription [in the Bitquery IDE](https://ide.bitquery.io/Realtime-Price-feed-of-a-Token-on-Meteora-DLMM). +`Trading.Pairs` serves candles at whatever interval you ask for, so there is nothing to aggregate. Set `Interval.Time.Duration` in seconds: 1 for one-second candles, 60 for one-minute, 3600 for hourly. ```graphql -subscription { - Solana { - DEXTradeByTokens( +{ + Trading { + Pairs( + limit: { count: 30 } + orderBy: { descending: Block_Time } where: { - Trade: { - Dex: { - ProgramAddress: { is: "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" } - } - Currency: { - MintAddress: { is: "6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN" } - } - Side: { - Currency: { - MintAddress: { is: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" } - } - } - } - Transaction: { Result: { Success: true } } + Token: { Address: { is: "6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN" } } + Market: { Protocol: { is: "lb_clmm" }, Network: { is: "Solana" } } + Price: { IsQuotedInUsd: true } + Interval: { Time: { Duration: { eq: 3600 } } } } ) { Block { Time } - Trade { - Market { - MarketAddress - } - Price - PriceInUSD - Amount - Side { - Amount - Type + Market { + Address + } + QuoteToken { + Symbol + } + Price { + Ohlc { + Open + High + Low + Close } } + Volume { + Usd + Base + Quote + } } } } ``` -## Meteora DLMM OHLC API +## Top traders of a token on Meteora DLMM {#get-the-top-traders-of-a-specific-token-on-meteora-dlmm-dex} -One-minute candles for TRUMP/USDC on DLMM built from `DEXTradeByTokens`: `open` and `close` are the prices at the lowest and highest slot in each interval, `high` and `low` the extremes, `volume` the TRUMP amount and `volumeUsd` the USD value. `PriceAsymmetry` is the absolute difference between the two sides' USD prices divided by their sum, computed only when both tokens have a USD price, so `PriceAsymmetry: { lt: 0.1 }` keeps trades whose sides agree to within roughly 20 percent and removes most bad prints. Change `interval` for other timeframes and `limit` for more candles. +Ranks wallets by USD volume on DLMM over the last 24 hours, one row per wallet, with the USD each bought and sold. `Trading.Trades` reports `Side` from the trader's point of view, so the split needs no field gymnastics. :::note -Run this as a query, not a subscription: aggregates and time intervals do not work well over WebSocket. +Run this as a query, not a subscription. Aggregates over WebSocket return partial results. ::: -You can run this query [in the Bitquery IDE](https://ide.bitquery.io/Meteora-DLMM-OHLC-API). - ```graphql -{ - Solana { - DEXTradeByTokens( - orderBy: { descendingByField: "Block_Timefield" } - limit: { count: 10 } +query TopTraders($token: String) { + Trading { + Trades( + limit: { count: 100 } + orderBy: { descendingByField: "volumeUsd" } where: { - Trade: { - Currency: { - MintAddress: { is: "6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN" } - } - Side: { - Currency: { - MintAddress: { is: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" } - } - } - Dex: { - ProgramAddress: { is: "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" } - } - PriceAsymmetry: { lt: 0.1 } + Pair: { + Market: { Protocol: { is: "lb_clmm" }, Network: { is: "Solana" } } + Token: { Address: { is: $token } } } - Transaction: { Result: { Success: true } } + Block: { Time: { since_relative: { hours_ago: 24 } } } } ) { - Block { - Timefield: Time(interval: { in: minutes, count: 1 }) - } - volume: sum(of: Trade_Amount) - volumeUsd: sum(of: Trade_Side_AmountInUSD) - Trade { - high: Price(maximum: Trade_Price) - low: Price(minimum: Trade_Price) - open: Price(minimum: Block_Slot) - close: Price(maximum: Block_Slot) + Trader { + Address } - count + volumeUsd: sum(of: AmountsInUsd_Base) + bought: sum(of: AmountsInUsd_Base, if: { Side: { is: "Buy" } }) + sold: sum(of: AmountsInUsd_Base, if: { Side: { is: "Sell" } }) + buys: count(if: { Side: { is: "Buy" } }) + sells: count(if: { Side: { is: "Sell" } }) + trades: count } } } +{ + "token": "6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN" +} ``` -### Pre-built DLMM candles from the Trading cube +Subtracting `bought` from `sold` gives a rough realised PnL for the window. The [wallet PnL guide](/docs/trading/crypto-trades-api/wallet-pnl/) covers the full method. -`Trading.Pairs` already aggregates every DLMM pool into OHLC, average price, volume and market cap per interval. This query returns the latest one-minute candle for TRUMP on DLMM quoted in USD. `Price: { IsQuotedInUsd: true }` matters: every market publishes each interval twice, once in USD and once in the quote token. +## Trading volume, buy volume and sell volume of a token {#get-trading-volume-buy-volume-sell-volume-of-a-token} + +Seven-day totals for TRUMP on DLMM: USD volume, the buy and sell split, trade counts and the number of distinct wallets. Change `days_ago` for other windows, up to the roughly 30-day Trading window. Drop the `Token` filter for the whole DLMM program. ```graphql { Trading { - Pairs( - limit: { count: 1 } - orderBy: { descending: Block_Time } + Trades( where: { - Token: { Address: { is: "6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN" } } - Market: { Protocol: { is: "lb_clmm" }, Network: { is: "Solana" } } - Price: { IsQuotedInUsd: true } - Interval: { Time: { Duration: { eq: 60 } } } + Pair: { + Market: { Protocol: { is: "lb_clmm" }, Network: { is: "Solana" } } + Token: { Address: { is: "6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN" } } + } + Block: { Time: { since_relative: { days_ago: 7 } } } + } + ) { + volumeUsd: sum(of: AmountsInUsd_Base) + buy_volume: sum(of: AmountsInUsd_Base, if: { Side: { is: "Buy" } }) + sell_volume: sum(of: AmountsInUsd_Base, if: { Side: { is: "Sell" } }) + buys: count(if: { Side: { is: "Buy" } }) + sells: count(if: { Side: { is: "Sell" } }) + traders: count(distinct: Trader_Address) + } + } +} +``` + +## Chain-level DLMM data + +The sections above cover trades, prices, candles, traders and volume through the Trading cubes. Three things live only in the Solana chain-level cubes: pool creation, pool reserves, and history older than the roughly 30-day Trading window. See [DEXTrades vs DEXTradeByTokens vs Trading.Trades](/docs/cubes/dextrades-dextradebytokens-trading-trades/) for the full comparison. + +### New Meteora DLMM pools in real time {#latest-pool-creation-on-meteora-dlmm} + +Every DLMM pool is an `LbPair` account created by one of the pool-creation instructions: `initializeLbPair2` for standard permissionless pools, `initializeCustomizablePermissionlessLbPair2` for pools with custom parameters, `initializePermissionLbPair` for permissioned launches, and the un-numbered legacy SPL-Token-only forms. This subscription emits one row per new pool. `Program.AccountNames` gives the meaning of each entry in `Instruction.Accounts` in order: the first account is the new pool address (`lbPair`), `tokenMintX` and `tokenMintY` are the two token mints, `reserveX` and `reserveY` the pool vaults, and `funder` the wallet that paid for the pool's creation. Pool creation is far less frequent than swaps, so expect this stream to stay quiet for minutes at a time. To list recent pools instead, run the same filter as a query with `Block: { Time: { since_relative: { hours_ago: 24 } } }`. + +You can test the subscription [in the Bitquery IDE](https://ide.bitquery.io/Track-Latest-created-pools-on-Meteora-DLMM_1). + +```graphql +subscription { + Solana { + Instructions( + where: { + Transaction: { Result: { Success: true } } + Instruction: { + Program: { + Address: { is: "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" } + Method: { + in: [ + "initializeLbPair2", + "initializeCustomizablePermissionlessLbPair2", + "initializePermissionLbPair", + "initializeLbPair", + "initializeCustomizablePermissionlessLbPair" + ] + } + } + } } ) { Block { Time } - Token { - Symbol - Address - } - QuoteToken { - Symbol - } - Market { - Address - Protocol - } - Price { - Ohlc { - Open - High - Low - Close + Instruction { + Accounts { + Address + IsWritable + Token { + Mint + Owner + ProgramId + } } - Average { - Mean + Program { + AccountNames + Address + Method + Name + Arguments { + Name + Type + Value { + ... on Solana_ABI_Integer_Value_Arg { + integer + } + ... on Solana_ABI_String_Value_Arg { + string + } + ... on Solana_ABI_Address_Value_Arg { + address + } + ... on Solana_ABI_BigInt_Value_Arg { + bigInteger + } + ... on Solana_ABI_Bytes_Value_Arg { + hex + } + ... on Solana_ABI_Boolean_Value_Arg { + bool + } + ... on Solana_ABI_Float_Value_Arg { + float + } + ... on Solana_ABI_Json_Value_Arg { + json + } + } + } } } - Volume { - Usd - Base - } - Supply { - MarketCap + Transaction { + Signature + Signer } } } } ``` -## Liquidity of a Meteora DLMM pool +### Liquidity of a Meteora DLMM pool -`DEXPools` records a pool's reserves after each swap, deposit or withdrawal it decodes. `Base.PostAmount` and `Quote.PostAmount` are the token balances after the event, `PostAmountInUSD` their USD value, and `ChangeAmount` the signed change the event caused. This query returns the latest state of the TRUMP/USDC DLMM pool. +`DEXPools` records a pool's reserves after each swap, deposit or withdrawal it decodes. `Base.PostAmount` and `Quote.PostAmount` are the balances after the event, `PostAmountInUSD` their USD value, and `ChangeAmount` the signed change that event caused. :::note `DEXPools` is a realtime-only cube: it keeps roughly the last 12 hours and has no archive dataset, so use it for current reserves and live liquidity events rather than TVL history. See [data coverage and retention](/docs/graphql/data-coverage-retention/). @@ -450,12 +455,8 @@ You can run this query [in the Bitquery IDE](https://ide.bitquery.io/Meteora-DLM orderBy: { descending: Block_Time } where: { Pool: { - Market: { - MarketAddress: { is: "3C5YE97HADPDxZehYq9Cis8AXr9aNyrUsczKzE1nDbW9" } - } - Dex: { - ProgramAddress: { is: "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" } - } + Market: { MarketAddress: { is: "3C5YE97HADPDxZehYq9Cis8AXr9aNyrUsczKzE1nDbW9" } } + Dex: { ProgramAddress: { is: "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" } } } } ) { @@ -495,18 +496,14 @@ You can run this query [in the Bitquery IDE](https://ide.bitquery.io/Meteora-DLM } ``` -To stream liquidity changes across all DLMM pools, subscribe to the same cube and keep rows where either reserve moved. DLMM deposits are often one-sided, so filter on `Base` or `Quote` with `any` rather than on `Base` alone. Each message is one reserve change with the pool, both currencies and the post-event balances. +To stream liquidity changes across all DLMM pools, subscribe to the same cube and keep rows where either reserve moved. DLMM deposits are often one-sided, so filter on `Base` or `Quote` with `any` rather than on `Base` alone. ```graphql subscription { Solana { DEXPools( where: { - Pool: { - Dex: { - ProgramAddress: { is: "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" } - } - } + Pool: { Dex: { ProgramAddress: { is: "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" } } } any: [ { Pool: { Base: { ChangeAmount: { ne: "0" } } } } { Pool: { Quote: { ChangeAmount: { ne: "0" } } } } @@ -549,166 +546,39 @@ subscription { } ``` -## Top traders of a token on Meteora DLMM {#get-the-top-traders-of-a-specific-token-on-meteora-dlmm-dex} +### Historical Meteora DLMM trades -Ranks wallets by USD volume traded in TRUMP on DLMM over the last 24 hours, with the amount each wallet bought and sold. `Trade.Account.Owner` is the trader's wallet. On Solana, `Side.Type` is the trader's action on `Trade.Currency`: `buy` rows are purchases of the token in the filter and `sell` rows are sales. +For anything older than the Trading window, use `DEXTradeByTokens` with `dataset: archive`, which reaches back to mid-2024. This returns monthly trade counts and TRUMP volume on DLMM. -:::note -Run this as a query, not a subscription, because aggregates over WebSocket return wrong results. `Trade.Side.Account` is not available as an aggregate dimension on the `archive` and `combined` datasets. +:::caution Aggregate in native amounts on `archive` and `combined`, not USD +Summing `Trade_Side_AmountInUSD` on the Solana `archive` and `combined` datasets does not aggregate cleanly: adding it to a grouped query shatters one row per month into many partial rows, and `combined` also returns fewer trades than `realtime` over the same window. Aggregate `Trade_Amount` instead, and take USD figures from the Trading cubes, where every row carries a vetted USD price. ::: -You can run the query [in the Bitquery IDE](https://ide.bitquery.io/Get-the-Top-Traders-of-a-specific-Token-on-Meteora-DLMM-DEX). - ```graphql -query TopTraders($token: String) { - Solana { - DEXTradeByTokens( - orderBy: { descendingByField: "volumeUsd" } - limit: { count: 100 } - where: { - Trade: { - Currency: { MintAddress: { is: $token } } - Dex: { - ProgramAddress: { is: "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" } - } - } - Transaction: { Result: { Success: true } } - Block: { Time: { since_relative: { hours_ago: 24 } } } - } - ) { - Trade { - Account { - Owner - } - } - bought: sum(of: Trade_Amount, if: { Trade: { Side: { Type: { is: buy } } } }) - sold: sum(of: Trade_Amount, if: { Trade: { Side: { Type: { is: sell } } } }) - volume: sum(of: Trade_Amount) - volumeUsd: sum(of: Trade_Side_AmountInUSD) - trades: count - } - } -} { - "token": "6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN" -} -``` - -## Trading volume, buy volume and sell volume of a token {#get-trading-volume-buy-volume-sell-volume-of-a-token} - -Seven-day totals for TRUMP/USDC on DLMM from the `combined` dataset, which joins realtime and archive: total volume in TRUMP and in USD, USD volume split into buys and sells, and the count of each. Widen `days_ago` for longer windows; the archive reaches back to mid-2024. - -You can run the query [in the Bitquery IDE](https://ide.bitquery.io/Get-trading-volume-buy-volume-sell-volume-of-a-token_3). - -```graphql -query MyQuery { - Solana(dataset: combined) { + Solana(dataset: archive) { DEXTradeByTokens( + orderBy: { descendingByField: "Block_month" } where: { - Block: { Time: { since_relative: { days_ago: 7 } } } + Block: { Time: { since: "2025-01-01T00:00:00Z" } } Transaction: { Result: { Success: true } } Trade: { - Currency: { - MintAddress: { is: "6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN" } - } - Side: { - Currency: { - MintAddress: { is: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" } - } - } - Dex: { - ProgramAddress: { is: "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" } - } + Currency: { MintAddress: { is: "6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN" } } + Dex: { ProgramAddress: { is: "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" } } } } - ) { - Trade { - Currency { - Symbol - MintAddress - Decimals - } - Side { - Currency { - Symbol - MintAddress - } - } - } - traded_volume_USD: sum(of: Trade_Side_AmountInUSD) - traded_volume: sum(of: Trade_Amount) - buy_volume: sum( - of: Trade_Side_AmountInUSD - if: { Trade: { Side: { Type: { is: buy } } } } - ) - sell_volume: sum( - of: Trade_Side_AmountInUSD - if: { Trade: { Side: { Type: { is: sell } } } } - ) - buys: count(if: { Trade: { Side: { Type: { is: buy } } } }) - sells: count(if: { Trade: { Side: { Type: { is: sell } } } }) - } - } -} -``` - -## DLMM trades with USD price, market cap and supply - -The [Trades cube](/docs/trading/crypto-trades-api/trades-api/) (`Trading.Trades`) is trader-centric: one MEV-filtered row per swap, `Side` from the trader's point of view, `PriceInUsd`, `AmountsInUsd`, market cap and circulating supply on every row. Filter `Pair.Market.Protocol` `lb_clmm` to stream DLMM swaps across all pools in one subscription. See [DEXTrades vs DEXTradeByTokens vs Trading.Trades](/docs/cubes/dextrades-dextradebytokens-trading-trades/) for when to use which. - -```graphql -subscription { - Trading { - Trades( - where: { - Pair: { Market: { Protocol: { is: "lb_clmm" }, Network: { is: "Solana" } } } - } ) { Block { - Time - } - Side - Price - PriceInUsd - Trader { - Address - } - Amounts { - Base - Quote - } - AmountsInUsd { - Base - Quote - } - Supply { - MarketCap - CirculatingSupply - } - TransactionHeader { - Hash - } - Pair { - Market { - Address - Protocol - ProtocolFamily - } - Token { - Symbol - Address - } - QuoteToken { - Symbol - Address - } + month: Time(interval: { in: months, count: 1 }) } + volume_trump: sum(of: Trade_Amount) + trades: count } } } ``` -The same body runs as a query with `limit: { count: 10 }`, `orderBy: { descending: Block_Time }` and a `Block: { Time: { since_relative: { minutes_ago: 10 } } }` filter for the latest DLMM swaps. Add `Pair: { Token: { Address: { is: "" } } }` to follow one token, or reuse the PnL leaderboard pattern from the [Meteora DBC page](/docs/blockchain/Solana/meteora-dynamic-bonding-curve-api/#top-traders-by-pnl-for-a-specific-meteora-dbc-token-last-30-minutes) with a DLMM `Market.Address`. +The chain-level cubes also carry per-swap detail the Trading cubes leave out, such as the exact instruction behind a swap and the token accounts on each side; the [Solana DEX Trades API](/docs/blockchain/Solana/solana-dextrades/) documents those fields. ## API key, free trial and pricing diff --git a/docs/blockchain/Solana/Meteora-DYN-API.md b/docs/blockchain/Solana/Meteora-DYN-API.md index 23a0715d3..56e530b27 100644 --- a/docs/blockchain/Solana/Meteora-DYN-API.md +++ b/docs/blockchain/Solana/Meteora-DYN-API.md @@ -1,289 +1,487 @@ --- -title: "Solana Meteora Dyn API" -description: "Solana Meteora Dyn API: real-time Solana memecoin and DEX data via Bitquery GraphQL APIs and Kafka streams. Keep queries fast with indexed filters." +title: "Meteora DAMM v1 API: Dynamic AMM Trades and Pools" +sidebar_label: "Meteora DAMM v1 API" +description: "Meteora DAMM v1 (Dynamic AMM) API on Solana: swaps with USD price, OHLC candles, top traders, volume and pool liquidity on the amm program via Bitquery." +keywords: + - Meteora DAMM v1 API + - Meteora Dynamic AMM + - Meteora DYN API + - Meteora amm program + - Meteora DAMM v1 program ID + - Meteora stable pools + - Meteora LST pools + - Meteora API + - Solana DEX API --- -# Meteora API - DYN -:::tip Need real-time Meteora DYN data or anything from the last ~30 days? -For **real-time + last ~30 days**, use the [**Trading cube**](/docs/trading/trading-data-overview) — [`Trading.Trades`](/docs/trading/crypto-trades-api/trades-api) gives you clean, MEV-filtered Meteora DYN swaps with **USD price, market cap, and supply on every row** across **9 chains in one API**. Use this page when you need **historical Meteora DYN data older than ~30 days**, raw per-swap detail, or call / event context. +import FAQ from "@site/src/components/FAQ"; + +# Meteora DAMM v1 API + +Meteora DAMM v1 is the Dynamic AMM, Meteora's original constant-product pool program on Solana, at `Eo7WjKq67rjJQSZxS6z3YkapzY3eMj6Xy8X5EQVn5UaB`. It runs stable pools for pegged assets, LST pools for staked SOL, and full-range pools whose idle reserves can earn extra yield through Meteora's Dynamic Vaults. Bitquery reads its swaps, prices, candles, traders and reserves over GraphQL, WebSocket, Kafka and gRPC. + +Meteora files DAMM v1 under legacy products. The pools that exist keep trading, and the deepest of them are still meaningful markets for staked SOL and stablecoins, but **new DAMM v1 pools are no longer being created**: new launches go to DAMM v2, and Dynamic Bonding Curve graduations now migrate into DAMM v2 as well. Plan integrations around the pools that exist rather than around pool creation. + +:::note This page was previously published as the Meteora DYN API +"DYN" was our shorthand, not a Meteora product name. The program, the URL and every query here are unchanged; only the naming now matches [Meteora's own documentation](https://docs.meteora.ag/legacy-products/damm-v1/what-is-damm-v1). ::: -import VideoPlayer from "../../../src/components/videoplayer.js"; +:::tip Start with the Trading API +The [**Trading API**](/docs/trading/trading-data-overview) answers most questions on this page fastest. [`Trading.Trades`](/docs/trading/crypto-trades-api/trades-api) returns **MEV-filtered swaps with USD price, market cap and supply on every row**, and [`Trading.Pairs`](/docs/trading/crypto-price-api/pairs) gives pre-aggregated OHLC per pool down to one second. Filter either with `Market: { Protocol: { is: "amm" } }` and `Network: { is: "Solana" }` for DAMM v1. -## Track Latest created pools on Meteora DYN +Drop to the chain-level cubes for pool reserves and for history older than about 30 days. +::: -Below query will give you the latest created Meteora DYN pools in realtime. You can test the query [here](https://ide.bitquery.io/Track-Latest-created-pools-on-MeteoraDYN) +:::note +To query or stream data via GraphQL **outside the Bitquery IDE**, you need to generate an API access token. + +Follow the steps here to create one: [How to generate Bitquery API token ➤](/docs/authorization/how-to-generate/) +::: + +## What is the Meteora DAMM v1 program ID on Solana? {#track-latest-created-pools-on-meteora-dyn} + +The Dynamic AMM program is `Eo7WjKq67rjJQSZxS6z3YkapzY3eMj6Xy8X5EQVn5UaB` on Solana mainnet, and Meteora uses the same address on devnet. Two related programs sit beside it: Dynamic Vault at `24Uqj9JCLxUeoC3hGfh5W3s9FM9uCHDS2SG3LYwBpyTi`, which earns yield on idle reserves, and Farming at `FarmuwXPWXvefWUeqFAa5w6rifLkq5X6E8bimYvrhCB1`. + +``` +Eo7WjKq67rjJQSZxS6z3YkapzY3eMj6Xy8X5EQVn5UaB +``` + +In the Trading cubes DAMM v1 is `Market.Protocol` `amm`. In the Solana chain-level cubes the rows carry `Dex.ProtocolName` `amm` and `Dex.ProtocolFamily` `Meteora`. Method names on this program are camelCase, as on DLMM: swaps are `swap`, liquidity moves are `addBalanceLiquidity` and `removeBalanceLiquidity`. DAMM v2 and DBC use snake_case instead, so do not copy method spellings between Meteora pages. + +Meteora runs four trading programs on Solana, each with its own Bitquery page: + +| Meteora program | Program ID | Protocol name | Bitquery page | +| --- | --- | --- | --- | +| DAMM v1, the legacy Dynamic AMM | `Eo7WjKq67rjJQSZxS6z3YkapzY3eMj6Xy8X5EQVn5UaB` | `amm` | This page | +| DAMM v2, constant-product pools with position NFTs | `cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG` | `cp_amm` | [Meteora DAMM v2 API](/docs/blockchain/Solana/Meteora-DAMM-v2-API/) | +| DLMM, concentrated liquidity in price bins | `LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo` | `lb_clmm` | [Meteora DLMM API](/docs/blockchain/Solana/Meteora-DLMM-API/) | +| Dynamic Bonding Curve, launches that graduate to a DAMM pool | `dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN` | `dynamic_bonding_curve` | [Meteora DBC API](/docs/blockchain/Solana/meteora-dynamic-bonding-curve-api/) | + +## Does Meteora have an API? + +Yes, for pool-level data. Meteora publishes a free REST [DAMM v1 Data API](https://docs.meteora.ag/developer-guides/damm-v1/api-reference/overview) at `https://damm-api.meteora.ag`, limited to 10 requests a second with no key, covering pool state and related vault data. It has no per-swap trade endpoint, no per-wallet swap history and no streaming. Bitquery reads the same activity from the chain: swaps as individual rows with the trader and a USD price, reserves after every liquidity change, and history back to mid-2024. + +## Which DAMM v1 pools are still active + +Since new pools are not being created, the useful starting point is a ranking of the pools that exist. This returns the busiest DAMM v1 markets over the last 24 hours by USD volume. ```graphql -subscription MyQuery { - Solana { - Instructions( - where: {Transaction: {Result: {Success: true}}, Instruction: {Program: {Method: {is: "initializePermissionlessConstantProductPoolWithConfig2"}, Address: {is: "Eo7WjKq67rjJQSZxS6z3YkapzY3eMj6Xy8X5EQVn5UaB"}}}} +{ + Trading { + Pairs( + limit: { count: 25 } + orderBy: { descendingByField: "usd" } + where: { + Market: { Protocol: { is: "amm" }, Network: { is: "Solana" } } + Price: { IsQuotedInUsd: true } + Interval: { Time: { Duration: { eq: 3600 } } } + Block: { Time: { since_relative: { hours_ago: 24 } } } + } ) { - Block { - Time + Market { + Address } - Instruction { - Accounts { - Address - IsWritable - Token { - Mint - Owner - ProgramId - } - } - Program { - AccountNames - Address - Arguments { - Name - Type - Value { - ... on Solana_ABI_Integer_Value_Arg { - integer - } - ... on Solana_ABI_String_Value_Arg { - string - } - ... on Solana_ABI_Address_Value_Arg { - address - } - ... on Solana_ABI_BigInt_Value_Arg { - bigInteger - } - ... on Solana_ABI_Bytes_Value_Arg { - hex - } - ... on Solana_ABI_Boolean_Value_Arg { - bool - } - ... on Solana_ABI_Float_Value_Arg { - float - } - ... on Solana_ABI_Json_Value_Arg { - json - } - } - } - Method - Name - } + Token { + Symbol + Address } - Transaction { - Signature - Signer + QuoteToken { + Symbol } + usd: sum(of: Volume_Usd) } } } - ``` -## Meteora DYN Trades in Real-Time +The examples below use JitoSOL (`J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn`), whose WSOL pool `ERgpKaq59Nnfm9YRVAAhnq16cZhHxGcDoDWCzXbhiaNw` is the deepest DAMM v1 market and one of the LST pools the program was built for. -The below query gets real-time information whenever there's a new trade on the Meteora DYN DEX including detailed information about the trade, including the buy and sell details, the block information, and the transaction specifics. -You can run the query [here](https://ide.bitquery.io/Real-time-trades-on-MeteoraDYN-DEX-on-Solana#) +## Meteora DAMM v1 trades in real time {#meteora-dyn-trades-in-real-time} + +Stream every decoded DAMM v1 swap with the trader, both amounts and the USD price. ```graphql subscription { - Solana { - DEXTrades( + Trading { + Trades( where: { - Trade: { - Dex: { - ProgramAddress: { - is: "Eo7WjKq67rjJQSZxS6z3YkapzY3eMj6Xy8X5EQVn5UaB" - } - } - } + Pair: { Market: { Protocol: { is: "amm" }, Network: { is: "Solana" } } } } ) { - Trade { - Dex { - ProgramAddress - ProtocolFamily - ProtocolName + Block { + Time + } + Side + Price + PriceInUsd + Trader { + Address + } + Amounts { + Base + Quote + } + AmountsInUsd { + Base + Quote + } + TransactionHeader { + Hash + } + Pair { + Market { + Address + Protocol } - Buy { - Currency { - Name - Symbol - MintAddress - } - Amount - Account { - Address - } - PriceAgainstSellCurrency: Price + Token { + Symbol + Address } - Sell { - Account { - Address - } - Amount - Currency { - Name - Symbol - MintAddress - } - PriceAgainstBuyCurrency: Price + QuoteToken { + Symbol + Address } } - Block { - Time - } } } } ``` -## Latest Price of a Token on Meteora DYN +Add `Pair: { Token: { Address: { is: "" } } }` to follow one token. For the lowest latency the same swaps are on the Kafka topic `solana.dextrades.proto` and the [gRPC DEX trades topic](/docs/grpc/solana/topics/dextrades/); filter on `ProtocolName` `amm` in the consumer. -You can use the following query to get the latest price of a token on Meteora DYN on Solana. +## Latest price of a token on Meteora DAMM v1 {#latest-price-of-a-token-on-meteora-dyn} -You can run this query using this [link](https://ide.bitquery.io/latest-price-of-a-token-on-DYN#). +`Trading.Pairs` returns the latest interval for the pool with OHLC, average price and volume already computed. `Price: { IsQuotedInUsd: true }` matters: every market publishes each interval twice, once in USD and once in the quote token. ```graphql { - Solana { - DEXTradeByTokens( - limit: {count: 1} - orderBy: {descending: Block_Time} - where: {Trade: {Dex: {ProgramAddress: {is: "Eo7WjKq67rjJQSZxS6z3YkapzY3eMj6Xy8X5EQVn5UaB"}}, Currency: {MintAddress: {is: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"}}, Side: {Currency: {MintAddress: {is: "So11111111111111111111111111111111111111112"}}}}} + Trading { + Pairs( + limit: { count: 1 } + orderBy: { descending: Block_Time } + where: { + Token: { Address: { is: "J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn" } } + Market: { Protocol: { is: "amm" }, Network: { is: "Solana" } } + Price: { IsQuotedInUsd: true } + Interval: { Time: { Duration: { eq: 60 } } } + } ) { Block { Time } - Trade { - Price - PriceInUSD + Token { + Symbol + Address + } + QuoteToken { + Symbol + } + Market { + Address + } + Price { + Ohlc { + Open + High + Low + Close + } + Average { + Mean + } + } + Volume { + Usd + Base } } } } ``` -## Realtime Price feed of a Token on Meteora DYN +This is the price **on DAMM v1**. For a token's price across every venue, weighted to its deepest market, drop the protocol filter and add `Ranking: { Position: { eq: 1 } }` as described in [most accurate token price](/docs/trading/crypto-price-api/pairs/#most-accurate-token-price). On a legacy program the two often differ, because the token's main market has usually moved elsewhere. -You can use the following query to get the latest price of a token on Meteora DYN on Solana. +## Real-time price feed of a token on Meteora DAMM v1 {#realtime-price-feed-of-a-token-on-meteora-dyn} -You can run this query using this [link](https://ide.bitquery.io/Realtime-Price-feed-of-a-Token-on-Meteora-DYN#). +The same filter as a subscription, at one-second intervals. ```graphql -subscription{ - Solana { - DEXTradeByTokens( - where: {Trade: {Dex: {ProgramAddress: {is: "Eo7WjKq67rjJQSZxS6z3YkapzY3eMj6Xy8X5EQVn5UaB"}}, Currency: {MintAddress: {is: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"}}}} +subscription { + Trading { + Pairs( + where: { + Token: { Address: { is: "J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn" } } + Market: { Protocol: { is: "amm" }, Network: { is: "Solana" } } + Price: { IsQuotedInUsd: true } + Interval: { Time: { Duration: { eq: 1 } } } + } ) { Block { Time } - Trade { - Price - PriceInUSD + Token { + Symbol + } + QuoteToken { + Symbol + } + Market { + Address + } + Price { + Ohlc { + Open + High + Low + Close + } + } + Volume { + Usd } } } } ``` -## Meteora DYN OHLC API +## Meteora DAMM v1 OHLC API {#meteora-dyn-ohlc-api} -If you want to get OHLC data for any specific currency pair on Meteora DYN, you can use this api. Only use [this API](https://ide.bitquery.io/Meteora-DYN-OHLC-API#) as query and not subscription websocket as Aggregates and Time Intervals don't work well with subscriptions. +Candles come pre-built from `Trading.Pairs`. Set `Interval.Time.Duration` in seconds: 1, 60 or 3600. ```graphql { - Solana { - DEXTradeByTokens( - orderBy: {descendingByField: "Block_Timefield"} - where: {Trade: {Currency: {MintAddress: {is: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"}}, Side: {Currency: {MintAddress: {is: "So11111111111111111111111111111111111111112"}}}, Dex: {ProgramAddress: {is: "Eo7WjKq67rjJQSZxS6z3YkapzY3eMj6Xy8X5EQVn5UaB"}}, PriceAsymmetry: {lt: 0.1}}} - limit: {count: 10} + Trading { + Pairs( + limit: { count: 30 } + orderBy: { descending: Block_Time } + where: { + Token: { Address: { is: "J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn" } } + Market: { Protocol: { is: "amm" }, Network: { is: "Solana" } } + Price: { IsQuotedInUsd: true } + Interval: { Time: { Duration: { eq: 3600 } } } + } ) { Block { - Timefield: Time(interval: {in: minutes, count: 1}) + Time } - volume: sum(of: Trade_Amount) - Trade { - high: Price(maximum: Trade_Price) - low: Price(minimum: Trade_Price) - open: Price(minimum: Block_Slot) - close: Price(maximum: Block_Slot) + Market { + Address + } + QuoteToken { + Symbol + } + Price { + Ohlc { + Open + High + Low + Close + } + } + Volume { + Usd + Base + Quote } - count } } } ``` -## Get the Top Traders of a specific Token on Meteora DYN DEX +## Top traders of a token on Meteora DAMM v1 {#get-the-top-traders-of-a-specific-token-on-meteora-dyn-dex} + +Ranks wallets by USD volume over the last 24 hours, one row per wallet, with the USD each bought and sold. -The below query gets the Top Traders of the specified Token `EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v` on Meteora DYN. Keep in mind you can use this API only as a query and not a subscription websocket because aggregates don't work with subscription and you will end up getting wrong results. You can run the query [here](https://ide.bitquery.io/Get-the-Top-Traders-of-a-specific-Token-on-Meteora-DYN-DEX#) +:::note +Run this as a query, not a subscription. Aggregates over WebSocket return partial results. +::: ```graphql query TopTraders($token: String) { - Solana { - DEXTradeByTokens( - orderBy: {descendingByField: "volumeUsd"} - limit: {count: 100} - where: {Trade: {Currency: {MintAddress: {is: $token}}, Dex: {ProgramAddress: {is: "Eo7WjKq67rjJQSZxS6z3YkapzY3eMj6Xy8X5EQVn5UaB"}}}, Transaction: {Result: {Success: true}}} - ) { - Trade { - Account { - Owner - } - Side { - Account { - Address - } - Type + Trading { + Trades( + limit: { count: 100 } + orderBy: { descendingByField: "volumeUsd" } + where: { + Pair: { + Market: { Protocol: { is: "amm" }, Network: { is: "Solana" } } + Token: { Address: { is: $token } } } + Block: { Time: { since_relative: { hours_ago: 24 } } } + } + ) { + Trader { + Address } - bought: sum(of: Trade_Amount, if: {Trade: {Side: {Type: {is: buy}}}}) - sold: sum(of: Trade_Amount, if: {Trade: {Side: {Type: {is: sell}}}}) - volume: sum(of: Trade_Amount) - volumeUsd: sum(of: Trade_Side_AmountInUSD) + volumeUsd: sum(of: AmountsInUsd_Base) + bought: sum(of: AmountsInUsd_Base, if: { Side: { is: "Buy" } }) + sold: sum(of: AmountsInUsd_Base, if: { Side: { is: "Sell" } }) + buys: count(if: { Side: { is: "Buy" } }) + sells: count(if: { Side: { is: "Sell" } }) + trades: count } } } { - "token": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" + "token": "J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn" } ``` -## Get trading volume, buy volume, sell volume of a token +## Trading volume, buy volume and sell volume {#get-trading-volume-buy-volume-sell-volume-of-a-token} -This query fetches you the traded volume, buy volume and sell volume of a token `EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v`. Try out the API [here](https://ide.bitquery.io/Get-trading-volume-buy-volume-sell-volume-of-a-token_4#). +Seven-day totals on DAMM v1: USD volume, the buy and sell split, trade counts and distinct wallets. Drop the `Token` filter for the whole program. ```graphql -query MyQuery { - Solana(dataset: combined) { - DEXTradeByTokens( - where: {Block: {Time: {since: "2025-03-10T07:00:00Z"}}, Transaction: {Result: {Success: true}}, Trade: {Currency: {MintAddress: {is: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"}}, Side: {Currency: {MintAddress: {is: "So11111111111111111111111111111111111111112"}}}, Dex: {ProgramAddress: {is: "Eo7WjKq67rjJQSZxS6z3YkapzY3eMj6Xy8X5EQVn5UaB"}}}} +{ + Trading { + Trades( + where: { + Pair: { + Market: { Protocol: { is: "amm" }, Network: { is: "Solana" } } + Token: { + Address: { is: "J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn" } + } + } + Block: { Time: { since_relative: { days_ago: 7 } } } + } ) { - Trade { - Currency { - MintAddress - Decimals + volumeUsd: sum(of: AmountsInUsd_Base) + buy_volume: sum(of: AmountsInUsd_Base, if: { Side: { is: "Buy" } }) + sell_volume: sum(of: AmountsInUsd_Base, if: { Side: { is: "Sell" } }) + buys: count(if: { Side: { is: "Buy" } }) + sells: count(if: { Side: { is: "Sell" } }) + traders: count(distinct: Trader_Address) + } + } +} +``` + +## Liquidity of a Meteora DAMM v1 pool + +`DEXPools` records reserves after each swap, deposit or withdrawal it decodes. This returns the latest state of the JitoSOL/WSOL pool. + +:::note +`DEXPools` is a realtime-only cube: it keeps roughly the last 12 hours and has no archive dataset. See [data coverage and retention](/docs/graphql/data-coverage-retention/). +::: + +```graphql +{ + Solana { + DEXPools( + limit: { count: 1 } + orderBy: { descending: Block_Time } + where: { + Pool: { + Market: { + MarketAddress: { is: "ERgpKaq59Nnfm9YRVAAhnq16cZhHxGcDoDWCzXbhiaNw" } + } + Dex: { + ProgramAddress: { is: "Eo7WjKq67rjJQSZxS6z3YkapzY3eMj6Xy8X5EQVn5UaB" } + } } - Side { - Currency { - Name + } + ) { + Block { + Time + } + Pool { + Market { + MarketAddress + BaseCurrency { + Symbol + MintAddress + } + QuoteCurrency { + Symbol MintAddress } } + Dex { + ProtocolName + ProtocolFamily + } + Base { + ChangeAmount + PostAmount + PostAmountInUSD + } + Quote { + ChangeAmount + PostAmount + PostAmountInUSD + PriceInUSD + } + } + } + } +} +``` + +Liquidity still moves on DAMM v1 through `addBalanceLiquidity` and `removeBalanceLiquidity`, though rarely. To watch it, subscribe to the same cube filtered by the program and keep rows where either reserve moved, using `any` over `Base` and `Quote`. + +## Historical Meteora DAMM v1 trades + +The Trading cubes hold about 30 days. For older data use `DEXTradeByTokens` with `dataset: archive`, which reaches back to mid-2024. This returns monthly trade counts and JitoSOL volume on DAMM v1. + +:::caution Aggregate in native amounts on `archive` and `combined`, not USD +Summing `Trade_Side_AmountInUSD` on the Solana `archive` and `combined` datasets does not aggregate cleanly: adding it to a grouped query shatters one row per month into many partial rows, and `combined` also returns fewer trades than `realtime` over the same window. Aggregate `Trade_Amount` instead, and take USD figures from the Trading cubes. +::: + +```graphql +{ + Solana(dataset: archive) { + DEXTradeByTokens( + orderBy: { descendingByField: "Block_month" } + where: { + Block: { Time: { since: "2025-01-01T00:00:00Z" } } + Transaction: { Result: { Success: true } } + Trade: { + Currency: { + MintAddress: { is: "J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn" } + } + Dex: { + ProgramAddress: { is: "Eo7WjKq67rjJQSZxS6z3YkapzY3eMj6Xy8X5EQVn5UaB" } + } + } } - traded_volume_USD: sum(of: Trade_Side_AmountInUSD) - traded_volume: sum(of: Trade_Amount) - buy_volume: sum( - of: Trade_Side_AmountInUSD - if: {Trade: {Side: {Type: {is: buy}}}} - ) - sell_volume: sum( - of: Trade_Side_AmountInUSD - if: {Trade: {Side: {Type: {is: sell}}}} - ) + ) { + Block { + month: Time(interval: { in: months, count: 1 }) + } + volume_jitosol: sum(of: Trade_Amount) + trades: count } } } ``` + +## API key, free trial and pricing + +Create an access token at [account.bitquery.io](https://account.bitquery.io/) and follow [how to generate a token](/docs/authorization/how-to-generate/). The free trial runs for seven days and includes 1,000 API points, 100 MCP credits and two simultaneous streams. Request rate limits by plan are 30 a minute on Personal, 90 on Pro and 240 on Scale, with custom limits on Enterprise; see [rate limits](/docs/plans/rate-limits/). Plan prices are on the [Solana DEX API product page](https://bitquery.io/products/solana-dex-api) and the [pricing page](https://bitquery.io/pricing). + + + +## Related documentation + +- [Meteora DAMM v2 API](/docs/blockchain/Solana/Meteora-DAMM-v2-API/), the current AMM +- [Meteora DLMM API](/docs/blockchain/Solana/Meteora-DLMM-API/) +- [Meteora Dynamic Bonding Curve API](/docs/blockchain/Solana/meteora-dynamic-bonding-curve-api/) +- [Trading API overview](/docs/trading/trading-data-overview/), [Trades cube](/docs/trading/crypto-trades-api/trades-api/) and [Pairs cube](/docs/trading/crypto-price-api/pairs/) +- [Solana DEX Trades API](/docs/blockchain/Solana/solana-dextrades/) +- [Data coverage and retention](/docs/graphql/data-coverage-retention/) +- [gRPC DEX trades topic](/docs/grpc/solana/topics/dextrades/) and [real-time Solana streams over Kafka](/docs/streams/real-time-solana-data/) +- [API Authorization](/docs/authorization/how-to-use/) + +## Support + +For technical support and questions contact our support team via telegram or create a ticket [here](https://support.bitquery.io/) diff --git a/docs/blockchain/Solana/index.mdx b/docs/blockchain/Solana/index.mdx index 18ffcff09..b01480f5e 100644 --- a/docs/blockchain/Solana/index.mdx +++ b/docs/blockchain/Solana/index.mdx @@ -99,7 +99,7 @@ Bitquery supports websocket and webhooks, you can convert most of the graphQL AP - [Meteora DAMM v2 API](/docs/blockchain/Solana/Meteora-DAMM-v2-API) - [Meteora DLMM API](/docs/blockchain/Solana/Meteora-DLMM-API) -- [Meteora DYN API](/docs/blockchain/Solana/Meteora-DYN-API) +- [Meteora DAMM v1 API](/docs/blockchain/Solana/Meteora-DYN-API) - [Meteora Dynamic Bonding Curve API](/docs/blockchain/Solana/meteora-dynamic-bonding-curve-api) ## Solana DEX APIs diff --git a/docs/blockchain/Solana/meteora-dynamic-bonding-curve-api.md b/docs/blockchain/Solana/meteora-dynamic-bonding-curve-api.md index e7b951b68..157760075 100644 --- a/docs/blockchain/Solana/meteora-dynamic-bonding-curve-api.md +++ b/docs/blockchain/Solana/meteora-dynamic-bonding-curve-api.md @@ -1,821 +1,754 @@ --- -title: "Meteora Dynamic Bonding Curve API" -description: "Meteora Dynamic Bonding Curve API: real-time Solana memecoin and DEX data via Bitquery GraphQL APIs and Kafka streams. See examples in the Bitquery IDE." +title: "Meteora Dynamic Bonding Curve (DBC) API: Launches, Trades" +sidebar_label: "Meteora DBC API" +description: "Meteora Dynamic Bonding Curve API: stream DBC launches, curve trades with USD price and market cap, graduations to DAMM, top traders and migrations." +keywords: + - Meteora Dynamic Bonding Curve API + - Meteora DBC API + - Meteora DBC + - dynamic_bonding_curve program + - Meteora DBC program ID + - Meteora DBC launchpad + - Meteora DBC migration + - Meteora token graduation + - Solana launchpad API + - Meteora API --- + +import FAQ from "@site/src/components/FAQ"; +import VideoPlayer from "../../../src/components/videoplayer.js"; + # Meteora Dynamic Bonding Curve API -:::tip Need real-time Meteora DBC data or anything from the last ~30 days? -For **real-time + last ~30 days**, use the [**Trading cube**](/docs/trading/trading-data-overview) — [`Trading.Trades`](/docs/trading/crypto-trades-api/trades-api) gives you clean, MEV-filtered Meteora DBC swaps with **USD price, market cap, and supply on every row** across **9 chains in one API**. Use this page when you need **historical Meteora DBC data older than ~30 days**, raw per-swap detail, or call / event context. -::: +The Meteora Dynamic Bonding Curve (DBC) is Meteora's launch program on Solana, at `dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN`. A team configures a curve, buyers trade against it, and once the quote threshold is met the token graduates into a DAMM pool. Launchpads including Jupiter Studio and Believe run on it. Bitquery reads that whole lifecycle: new launches, every curve trade with a USD price and market cap, graduations, top traders and migrations, over GraphQL, WebSocket, Kafka and gRPC. + +Meteora publishes REST data APIs for DLMM, DAMM v1 and DAMM v2, but **none for the Dynamic Bonding Curve**. There is an SDK and an IDL for building transactions, and nothing that serves launches, trades or curve state. That gap is what this page fills. + +:::tip Start with the Trading API +DBC tokens live and die in hours, so the fastest path is the [**Trading API**](/docs/trading/trading-data-overview). [`Trading.Trades`](/docs/trading/crypto-trades-api/trades-api) returns **MEV-filtered curve trades with USD price, market cap and supply on every row**, and [`Trading.Pairs`](/docs/trading/crypto-price-api/pairs) gives OHLC and market cap per curve down to one second. Filter either with `Market: { Protocol: { is: "dynamic_bonding_curve" } }`. -In this section we will see some API examples on tracking tokens on Meteora's dynamic bonding curve. +Use the chain-level `Instructions` cube further down for the events the Trading cubes do not model: launches, graduations and migration checks. +::: :::note -To query or stream data via graphQL **outside the Bitquery IDE**, you need to generate an API access token. +To query or stream data via GraphQL **outside the Bitquery IDE**, you need to generate an API access token. Follow the steps here to create one: [How to generate Bitquery API token ➤](/docs/authorization/how-to-generate/) ::: -import VideoPlayer from "../../../src/components/videoplayer.js"; +## What is the Meteora DBC program ID on Solana? + +The Dynamic Bonding Curve program is `dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN` on Solana mainnet, and Meteora uses the same address on devnet. Its pool authority PDA is `FhVo3mqL8PW5pH5U2CN4XE33DokiyZnUwuGpH2hmHLuM`. + +``` +dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN +``` -## Meteora DBC Trades in Real-Time +In the Trading cubes DBC is `Market.Protocol` `dynamic_bonding_curve`. In the Solana chain-level cubes the rows carry `Dex.ProtocolName` `dynamic_bonding_curve` and `Dex.ProtocolFamily` `Meteora`. DBC method names keep the IDL's snake_case spelling. Rows whose method starts with `Evt`, such as `EvtSwap` and `EvtCurveComplete`, are event logs emitted beside the real instruction. -The below query gets real-time information whenever there's a new trade on the Meteora DBC including detailed information about the trade, including the buy and sell details, the block information, and the transaction specifics. -You can run the query [here](https://ide.bitquery.io/Real-time-trades-on-Meteora-Dynamic-Bonding-Curve-on-Solana) +Meteora runs four trading programs on Solana, each with its own Bitquery page: + +| Meteora program | Program ID | Protocol name | Bitquery page | +| --- | --- | --- | --- | +| Dynamic Bonding Curve, launches that graduate to a DAMM pool | `dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN` | `dynamic_bonding_curve` | This page | +| DAMM v2, constant-product pools with position NFTs | `cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG` | `cp_amm` | [Meteora DAMM v2 API](/docs/blockchain/Solana/Meteora-DAMM-v2-API/) | +| DLMM, concentrated liquidity in price bins | `LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo` | `lb_clmm` | [Meteora DLMM API](/docs/blockchain/Solana/Meteora-DLMM-API/) | +| DAMM v1, the legacy Dynamic AMM | `Eo7WjKq67rjJQSZxS6z3YkapzY3eMj6Xy8X5EQVn5UaB` | `amm` | [Meteora DAMM v1 API](/docs/blockchain/Solana/Meteora-DYN-API/) | + +## Picking an example token + +Every query below that takes a mint uses a placeholder, because a bonding curve that is busy this hour is usually empty tomorrow. Run this first and paste one of the mints it returns into the examples. ```graphql -subscription { - Solana { - DEXTrades( +{ + Trading { + Trades( + limit: { count: 10 } + orderBy: { descendingByField: "usd" } where: { - Trade: { - Dex: { - ProgramAddress: { - is: "dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN" - } + Pair: { + Market: { + Protocol: { is: "dynamic_bonding_curve" } + Network: { is: "Solana" } } } + Block: { Time: { since_relative: { minutes_ago: 10 } } } } ) { - Trade { - Dex { - ProgramAddress - ProtocolFamily - ProtocolName + Pair { + Token { + Symbol + Address } - Buy { - Currency { - Name - Symbol - MintAddress - } - Amount - Account { - Address - } - PriceAgainstSellCurrency: Price + QuoteToken { + Symbol } - Sell { - Account { - Address - } - Amount - Currency { - Name - Symbol - MintAddress - } - PriceAgainstBuyCurrency: Price + Market { + Address } } - Block { - Time - } + usd: sum(of: AmountsInUsd_Base) + trades: count } } } ``` -## Track Latest created pools on Meteora DBC +`Pair.Token.Address` is the mint and `Pair.Market.Address` the curve. -Below query will give you the latest created Meteora DBC in realtime. You can test the query [here](https://ide.bitquery.io/token-creations-on-meteora-DBC) +## Meteora DBC trades in real time {#meteora-dbc-trades-in-real-time} + +Stream every decoded curve trade with the trader, both amounts, the USD price and the token's market cap. This one subscription covers all DBC launches at once, so it is the usual starting point for launch bots and screeners. ```graphql -subscription MyQuery { - Solana { - Instructions( +subscription { + Trading { + Trades( where: { - Instruction: { - Program: { - Address: { is: "dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN" } - Method: { is: "initialize_virtual_pool_with_spl_token" } + Pair: { + Market: { + Protocol: { is: "dynamic_bonding_curve" } + Network: { is: "Solana" } } } - Transaction: { - Result: { Success: true } - } } ) { Block { Time } - Instruction { - Accounts { - Token { - ProgramId - Owner - Mint - } - IsWritable + Side + Price + PriceInUsd + Trader { + Address + } + Amounts { + Base + Quote + } + AmountsInUsd { + Base + Quote + } + Supply { + MarketCap + CirculatingSupply + TotalSupply + } + TransactionHeader { + Hash + FeePayer + } + Pair { + Market { Address + Protocol } - Program { - Parsed + Token { + Symbol Name - Method - Arguments { - Value { - ... on Solana_ABI_Json_Value_Arg { - json - } - ... on Solana_ABI_Float_Value_Arg { - float - } - ... on Solana_ABI_Boolean_Value_Arg { - bool - } - ... on Solana_ABI_Bytes_Value_Arg { - hex - } - ... on Solana_ABI_BigInt_Value_Arg { - bigInteger - } - ... on Solana_ABI_Address_Value_Arg { - address - } - ... on Solana_ABI_String_Value_Arg { - string - } - ... on Solana_ABI_Integer_Value_Arg { - integer - } - } - Type - Name - } Address - AccountNames } - } - Transaction { - Fee - FeeInUSD - FeePayer - Signature + QuoteToken { + Symbol + Address + } } } } } ``` -## Track latest migrated Meteora DBC tokens +Add `AmountsInUsd: { Base: { gt: 1000 } }` to watch only meaningful size, or `Pair: { Token: { Address: { is: "" } } }` to follow one curve. -Below query will give you the latest migrated tokens Meteora DBC in realtime. You can test the query [here](https://ide.bitquery.io/meteora-DBC-token-migrations-to-Meteors-DEX) +## Market cap and price of a Meteora DBC token {#market-cap-trading-api} + +`Trading.Pairs` carries market cap, fully diluted valuation, supply, OHLC and volume per curve, already computed. Replace the mint with one from the [example query above](#picking-an-example-token). + +`Price: { IsQuotedInUsd: true }` matters: every market publishes each interval twice, once in USD and once in the quote token. DBC curves are quoted in SOL, USDC, JUP and other tokens, so without that filter you may read a price in the wrong unit. ```graphql -subscription MyQuery { - Solana { - Instructions( +{ + Trading { + Pairs( + limit: { count: 1 } + orderBy: { descending: Block_Time } where: { - Instruction: { - Program: { - Address: { is: "dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN" } - Method: { in: ["migrate_meteora_damm","migration_damm_v2"] } - } - } - Transaction: { - Result: { Success: true } + Token: { Address: { is: "" } } + Market: { + Protocol: { is: "dynamic_bonding_curve" } + Network: { is: "Solana" } } + Price: { IsQuotedInUsd: true } + Interval: { Time: { Duration: { eq: 60 } } } } ) { Block { Time } - Instruction { - Accounts { - Token { - ProgramId - Owner - Mint - } - IsWritable - Address - } - Program { - Parsed - Name - Method - Arguments { - Value { - ... on Solana_ABI_Json_Value_Arg { - json - } - ... on Solana_ABI_Float_Value_Arg { - float - } - ... on Solana_ABI_Boolean_Value_Arg { - bool - } - ... on Solana_ABI_Bytes_Value_Arg { - hex - } - ... on Solana_ABI_BigInt_Value_Arg { - bigInteger - } - ... on Solana_ABI_Address_Value_Arg { - address - } - ... on Solana_ABI_String_Value_Arg { - string - } - ... on Solana_ABI_Integer_Value_Arg { - integer - } - } - Type - Name - } - Address - AccountNames - } + Token { + Symbol + Name + Address } - Transaction { - Fee - FeeInUSD - FeePayer - Signature + QuoteToken { + Symbol } - } - } -} -``` - -## Track Meteora DBC, LetsBonk.fun, Raydium Launchlab, Boop.fun and Moonit Token Migrations in a single subscription - -Use this single subscription to stream real-time token migration events across Boop.fun, Raydium Launchlab, Meteora DBC, and Moonshot. It filters by the respective program IDs and migration methods, returning block time, program details, involved accounts, and transaction signatures as events occur. - -Try out the [API](https://ide.bitquery.io/Raydium-Launchlab-Meteora-DBC-BoopFun-Moonshot-LetsBonkfun-token-migrations-in-realtime_2) here on IDE. - -```graphql -subscription{ - Solana { - Instructions( - where: {any: [{Instruction: {Program: {Address: {is: "LanMV9sAd7wArD4vJFi2qDdfnVhFxYSUg6eADduJ3uj"}, Method: {is: "initialize_v2"}}}}, {Instruction: {Program: {Address: {is: "boop8hVGQGqehUK2iVEMEnMrL5RbjywRzHKBmBE7ry4"}, Method: {is: "graduate"}}}}, {Instruction: {Program: {Address: {is: "MoonCVVNZFSYkqNXP6bxHLPL6QQJiMagDL3qcqUQTrG"}, Method: {is: "migrateFunds"}}}}, {Instruction: {Program: {Address: {is: "dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN"}, Method: {in: ["migrate_meteora_damm", "migration_damm_v2"]}}}}, {Instruction: {Program: {Address: {is: "LanMV9sAd7wArD4vJFi2qDdfnVhFxYSUg6eADduJ3uj"}, Method: {in: ["migrate_to_amm", "migrate_to_cpswap"]}}, Accounts: {includes: {Address: {is: "FfYek5vEz23cMkWsdJwG2oa6EphsvXSHrGpdALN4g6W1"}}}}}], Transaction: {Result: {Success: true}}} - ) { - Block { - Time + Market { + Address } - Instruction { - Accounts { - Address - IsWritable - Token { - Mint - Owner - ProgramId - } + Price { + Ohlc { + Open + High + Low + Close } - Program { - AccountNames - # LanMV9sAd7wArD4vJFi2qDdfnVhFxYSUg6eADduJ3uj - Launchlab - # boop8hVGQGqehUK2iVEMEnMrL5RbjywRzHKBmBE7ry4 - boop.fun - # MoonCVVNZFSYkqNXP6bxHLPL6QQJiMagDL3qcqUQTrG - Moonshot/Moonit - # dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN - Meteora DBC - # LanMV9sAd7wArD4vJFi2qDdfnVhFxYSUg6eADduJ3uj - Program Address and FfYek5vEz23cMkWsdJwG2oa6EphsvXSHrGpdALN4g6W1(letsbonk.fun platform config addr) is present in Accounts array then its Letsbonk.fun migration - Address - Arguments { - Name - Type - Value { - ... on Solana_ABI_Integer_Value_Arg { - integer - } - ... on Solana_ABI_String_Value_Arg { - string - } - ... on Solana_ABI_Address_Value_Arg { - address - } - ... on Solana_ABI_BigInt_Value_Arg { - bigInteger - } - ... on Solana_ABI_Bytes_Value_Arg { - hex - } - ... on Solana_ABI_Boolean_Value_Arg { - bool - } - ... on Solana_ABI_Float_Value_Arg { - float - } - ... on Solana_ABI_Json_Value_Arg { - json - } - } - } - Method - Name + Average { + Mean } } - Transaction { - Signature - Signer + Volume { + Usd + Base + } + Supply { + MarketCap + FullyDilutedValuationUsd + TotalSupply } } } } - ``` -## Check if the list of tokens has migrated from Meteora DBC +### Stream Meteora DBC tokens above a market cap threshold -Below query will give you the response for each token in the list if the token has graduated from Meteora DBC. Try out the query [here](https://ide.bitquery.io/Check-if-the-tokens-have-migrated-from-Meteora-DBC_1). +The screener query: every DBC curve whose market cap crosses your floor, live. Change `gt` to move the threshold. ```graphql -query MyQuery($tokenAddresses: [String!]) { - Solana { - Instructions( - where: {Instruction: {Program: {Address: {is: "dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN"}, Method: {in: ["migrate_meteora_damm", "migration_damm_v2"]}}, Accounts: {includes: {Address: {in: $tokenAddresses}}}}, Transaction: {Result: {Success: true}}} +subscription { + Trading { + Pairs( + where: { + Market: { + Protocol: { is: "dynamic_bonding_curve" } + Network: { is: "Solana" } + } + Price: { IsQuotedInUsd: true } + Supply: { MarketCap: { gt: 10000 } } + Interval: { Time: { Duration: { eq: 60 } } } + } ) { Block { Time } - Instruction { - Accounts { - Token { - ProgramId - Owner - Mint - } - IsWritable - Address - } - Program { - Parsed - Name - Method - Arguments { - Value { - ... on Solana_ABI_Json_Value_Arg { - json - } - ... on Solana_ABI_Float_Value_Arg { - float - } - ... on Solana_ABI_Boolean_Value_Arg { - bool - } - ... on Solana_ABI_Bytes_Value_Arg { - hex - } - ... on Solana_ABI_BigInt_Value_Arg { - bigInteger - } - ... on Solana_ABI_Address_Value_Arg { - address - } - ... on Solana_ABI_String_Value_Arg { - string - } - ... on Solana_ABI_Integer_Value_Arg { - integer - } - } - Type - Name - } - Address - AccountNames + Token { + Symbol + Name + Address + } + QuoteToken { + Symbol + } + Market { + Address + } + Supply { + MarketCap + FullyDilutedValuationUsd + TotalSupply + } + Price { + Ohlc { + Close } } - Transaction { - Fee - FeeInUSD - FeePayer - Signature + Volume { + Usd } } } } -{ - "tokenAddresses":["token mint address-1","token mint address-2","token mint address-3"] -} ``` -## Market cap (Trading API) - -Use **Trading** **`Pairs`** with **`Market.Protocol`** **`dynamic_bonding_curve`** for aggregated **market cap**, **FDV**, **supply**, **price**, and **volume** on Meteora DBC. Replace **`solana:`** in **`Token.Id`** with your token. - -### Get latest market cap for a specific Meteora DBC token +## Meteora DBC OHLC API {#meteora-dbc-ohlc-api} -**`limit: { count: 1 }`**, **`orderBy: { descending: Block_Time }`**, **`Token.Id`** with **`includesCaseInsensitive`**, interval duration **> 1** second, **`Market.Protocol`** **`dynamic_bonding_curve`**. - -Run the query [in the Bitquery IDE](https://ide.bitquery.io/specific-meteora-dbc-token-latest-marketcap#). - -
- Click to expand GraphQL query +`Trading.Pairs` serves candles at whatever interval you ask for, so there is nothing to aggregate. Set `Interval.Time.Duration` in seconds: 1 for one-second candles, 60 for one-minute. One-second candles matter on a bonding curve, where a token's whole life can be shorter than an hour. ```graphql { Trading { Pairs( - limit: { count: 1 } + limit: { count: 30 } orderBy: { descending: Block_Time } where: { - Token: { - Id: { - includesCaseInsensitive: "solana:7GMB7XbtTdvnHkPjH6yEwTUB3HYf5dqC3FKyr2sueMEh" - } + Token: { Address: { is: "" } } + Market: { + Protocol: { is: "dynamic_bonding_curve" } + Network: { is: "Solana" } } - Interval: { Time: { Duration: { gt: 1 } } } - Market: { Protocol: { is: "dynamic_bonding_curve" } } + Price: { IsQuotedInUsd: true } + Interval: { Time: { Duration: { eq: 1 } } } } ) { - Token { - Name - Id - Address - Symbol - } Block { Time } Market { - Program - Protocol - ProtocolFamily + Address } - Supply { - TotalSupply - FullyDilutedValuationUsd - MarketCap + QuoteToken { + Symbol } Price { - Average { - Mean - } Ohlc { Open - Low High + Low Close } } Volume { - Base - BaseAttributedToUsd - Quote Usd + Base } } } } ``` -
- -### Stream Meteora DBC tokens with market cap above $10K +## Top traders of a Meteora DBC token {#get-the-top-traders-of-a-specific-token-on-meteora-dbc} -Subscribe when the token is on **Solana**, **`Market.Protocol`** is **`dynamic_bonding_curve`**, **`Supply.MarketCap`** **> 10,000** (USD), and interval duration **> 1** second. Adjust **`gt`** to change the threshold. +Ranks wallets on one curve by USD volume, one row per wallet, with the USD each bought and sold and a realised PnL for the window. `Trading.Trades` reports `Side` from the trader's own point of view, so no field gymnastics are needed. -Run the subscription [in the Bitquery IDE](https://ide.bitquery.io/realtime-meteora-dbc-tokens-with-marketcap-10k). - -
- Click to expand GraphQL subscription +:::note +Run this as a query, not a subscription. Aggregates over WebSocket return partial results. +::: ```graphql -subscription { +query TopTraders($token: String) { Trading { - Pairs( + Trades( + limit: { count: 100 } + orderBy: { descendingByField: "pnl" } where: { - Token: { Id: { includesCaseInsensitive: "solana" } } - Interval: { Time: { Duration: { gt: 1 } } } - Supply: { MarketCap: { gt: 10000 } } - Market: { Protocol: { is: "dynamic_bonding_curve" } } + Pair: { + Market: { + Protocol: { is: "dynamic_bonding_curve" } + Network: { is: "Solana" } + } + Token: { Address: { is: $token } } + } } ) { - Currency { - Name - Id - Symbol - } - Token { - Name - Symbol - Id + Trader { Address - Network - } - Market { - Protocol - ProtocolFamily - } - Supply { - TotalSupply - FullyDilutedValuationUsd - MarketCap } + bought: sum(of: AmountsInUsd_Base, if: { Side: { is: "Buy" } }) + sold: sum(of: AmountsInUsd_Base, if: { Side: { is: "Sell" } }) + pnl: calculate(expression: "$sold - $bought") + buys: count(if: { Side: { is: "Buy" } }) + sells: count(if: { Side: { is: "Sell" } }) + volumeUsd: sum(of: AmountsInUsd_Base) } } } +{ + "token": "" +} ``` -
+`pnl` here is realised in the window only: a wallet still holding its bag shows a negative number. The [wallet PnL guide](/docs/trading/crypto-trades-api/wallet-pnl/) covers unrealised positions. -## Latest Price of a Token on Meteora DBC +## Track new Meteora DBC launches {#track-latest-created-pools-on-meteora-dbc} -You can use the following query to get the latest price of a token on Meteora DBC on Solana. +Launches are per-instruction detail, so this uses the chain-level `Instructions` cube. A curve is created by one of two instructions, and **you need both**: `initialize_virtual_pool_with_spl_token` for standard SPL tokens and `initialize_virtual_pool_with_token2022` for Token-2022 mints. Token-2022 launches are a large minority of DBC traffic, so filtering only the SPL variant silently hides a third of new tokens. -You can run this query using this [link](https://ide.bitquery.io/latest-price-of-a-meteora-dbc-token). +`Program.AccountNames` names each entry of `Instruction.Accounts` in order: `base_mint` is the new token, `quote_mint` the token the curve is priced in, `pool` the curve address, `creator` the launching wallet, and `base_vault` and `quote_vault` the reserves. ```graphql -{ +subscription { Solana { - DEXTradeByTokens( - limit: {count: 1} - orderBy: {descending: Block_Time} - where: {Trade: {Dex: {ProgramAddress: {is: "dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN"}}, Currency: {MintAddress: {is: "token mint address"}}}} + Instructions( + where: { + Instruction: { + Program: { + Address: { is: "dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN" } + Method: { + in: [ + "initialize_virtual_pool_with_spl_token" + "initialize_virtual_pool_with_token2022" + ] + } + } + } + Transaction: { Result: { Success: true } } + } ) { Block { Time } - Trade { - Price - PriceInUSD + Instruction { + Accounts { + Address + IsWritable + Token { + Mint + Owner + ProgramId + } + } + Program { + AccountNames + Address + Method + Name + } + } + Transaction { + Signature + Signer + FeePayer } } } } ``` -## Meteora DBC OHLC API +## Track Meteora DBC graduations {#track-latest-migrated-meteora-dbc-tokens} -If you want to get OHLC data for any specific currency pair on Meteora DBC, you can use this api. Only use [this API](https://ide.bitquery.io/Meteora-DBC-OHLC-API) as query and not subscription websocket as Aggregates and Time Intervals don't work well with subscriptions. +When a curve completes, a keeper migrates the liquidity into a DAMM pool. `migration_damm_v2` is the instruction in use today; `migrate_meteora_damm` is the older path into DAMM v1 and still appears in historical data, so keep both when querying the archive. ```graphql -{ +subscription { Solana { - DEXTradeByTokens( - orderBy: {descendingByField: "Block_Timefield"} - where: {Trade: {Currency: {MintAddress: {is: "token mint address"}}, Side: {Currency: {MintAddress: {is: "So11111111111111111111111111111111111111112"}}}, Dex: {ProgramAddress: {is: "dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN"}}, PriceAsymmetry: {lt: 0.1}}} - limit: {count: 10} + Instructions( + where: { + Instruction: { + Program: { + Address: { is: "dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN" } + Method: { in: ["migration_damm_v2", "migrate_meteora_damm"] } + } + } + Transaction: { Result: { Success: true } } + } ) { Block { - Timefield: Time(interval: {in: minutes, count: 1}) + Time } - volume: sum(of: Trade_Amount) - Trade { - high: Price(maximum: Trade_Price) - low: Price(minimum: Trade_Price) - open: Price(minimum: Block_Slot) - close: Price(maximum: Block_Slot) + Instruction { + Accounts { + Address + IsWritable + Token { + Mint + Owner + ProgramId + } + } + Program { + AccountNames + Address + Method + Name + } + } + Transaction { + Signature + Signer } - count } } } ``` -## Get the Top Traders of a specific Token on Meteora DBC +Meteora runs the migration keepers itself, so the signer is usually a Meteora address rather than the token creator. Graduation thresholds are set per curve config; Meteora's published keeper `Asi5DTGEeiso6k7ya6ndDabEZ7DRCgfTpCBLPH5E3aQs` handles configs with a threshold of 10 SOL, 750 USDC or 1500 JUP. -The below query gets the Top Traders of the specified Token `4kJkgxzuk1gcjsgRSVhdeSiC15ibQLRDKTuqtf2i16Dm` on Meteora DBC. Keep in mind you can use this API only as a query and not a subscription websocket because aggregates don't work with subscription and you will end up getting wrong results. You can run the query [here](https://ide.bitquery.io/Get-the-Top-Traders-of-a-specific-Token-on-Meteora-DBC) +## Track migrations across DBC, LetsBonk.fun, Raydium LaunchLab, Boop.fun and Moonit {#track-meteora-dbc-letsbonkfun-raydium-launchlab-boopfun-and-moonit-token-migrations-in-a-single-subscription} + +One subscription covering graduations on five launchpads. Each branch matches that program's own migration method, and the LetsBonk.fun branch is identified by its platform config address appearing in the accounts of a Raydium LaunchLab migration. ```graphql -query TopTraders($token: String) { +subscription { Solana { - DEXTradeByTokens( - orderBy: {descendingByField: "volumeUsd"} - limit: {count: 100} - where: {Trade: {Currency: {MintAddress: {is: $token}}, Dex: {ProgramAddress: {is: "dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN"}}}, Transaction: {Result: {Success: true}}} - ) { - Trade { - Account { - Owner - } - Side { - Account { - Address + Instructions( + where: { + any: [ + { + Instruction: { + Program: { + Address: { is: "LanMV9sAd7wArD4vJFi2qDdfnVhFxYSUg6eADduJ3uj" } + Method: { is: "initialize_v2" } + } + } } - Type - } + { + Instruction: { + Program: { + Address: { is: "boop8hVGQGqehUK2iVEMEnMrL5RbjywRzHKBmBE7ry4" } + Method: { is: "graduate" } + } + } + } + { + Instruction: { + Program: { + Address: { is: "MoonCVVNZFSYkqNXP6bxHLPL6QQJiMagDL3qcqUQTrG" } + Method: { is: "migrateFunds" } + } + } + } + { + Instruction: { + Program: { + Address: { is: "dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN" } + Method: { in: ["migrate_meteora_damm", "migration_damm_v2"] } + } + } + } + { + Instruction: { + Program: { + Address: { is: "LanMV9sAd7wArD4vJFi2qDdfnVhFxYSUg6eADduJ3uj" } + Method: { in: ["migrate_to_amm", "migrate_to_cpswap"] } + } + Accounts: { + includes: { + Address: { is: "FfYek5vEz23cMkWsdJwG2oa6EphsvXSHrGpdALN4g6W1" } + } + } + } + } + ] + Transaction: { Result: { Success: true } } } - bought: sum(of: Trade_Amount, if: {Trade: {Side: {Type: {is: buy}}}}) - sold: sum(of: Trade_Amount, if: {Trade: {Side: {Type: {is: sell}}}}) - volume: sum(of: Trade_Amount) - volumeUsd: sum(of: Trade_Side_AmountInUSD) - } - } -} -{ - "token": "token mint address" -} -``` - -## Get trading volume, buy volume, sell volume of a token - -This query fetches you the traded volume, buy volume and sell volume of a token `4kJkgxzuk1gcjsgRSVhdeSiC15ibQLRDKTuqtf2i16Dm`. Try out the API [here](https://ide.bitquery.io/Get-trading-volume-buy-volume-sell-volume-of-a-token). - -```graphql -query MyQuery { - Solana(dataset: combined) { - DEXTradeByTokens( - where: {Block: {Time: {since: "2025-05-23T09:00:00Z", till: "2025-05-23T11:00:00Z"}}, Transaction: {Result: {Success: true}}, Trade: {Currency: {MintAddress: {is: "token mint address"}}, Side: {Currency: {MintAddress: {is: "So11111111111111111111111111111111111111112"}}}, Dex: {ProgramAddress: {is: "dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN"}}}} ) { - Trade { - Currency { - MintAddress - Decimals - } - Side { - Currency { - Name - MintAddress + Block { + Time + } + Instruction { + Accounts { + Address + IsWritable + Token { + Mint + Owner + ProgramId } } + Program { + AccountNames + Address + Method + Name + } + } + Transaction { + Signature + Signer } - traded_volume_USD: sum(of: Trade_Side_AmountInUSD) - traded_volume: sum(of: Trade_Amount) - buy_volume: sum( - of: Trade_Side_AmountInUSD - if: {Trade: {Side: {Type: {is: buy}}}} - ) - sell_volume: sum( - of: Trade_Side_AmountInUSD - if: {Trade: {Side: {Type: {is: sell}}}} - ) } } } - ``` -## Volatility of a Pair on Meteora Dynamic +Read the program address on each row to tell the launchpads apart: `dbcij3…` is Meteora DBC, `LanMV9…` is Raydium LaunchLab, `boop8h…` is Boop.fun, `MoonCV…` is Moonit, and a LaunchLab row carrying `FfYek5vEz23cMkWsdJwG2oa6EphsvXSHrGpdALN4g6W1` in its accounts is a LetsBonk.fun graduation. -Volatility is an important factor in trading world as it determines the fluctuation in price that implies the possibility of profit and risk of loss. Lesser volatility denotes that the pair is stable. +## Check whether a list of tokens has graduated from Meteora DBC {#check-if-the-list-of-tokens-has-migrated-from-meteora-dbc} -[Here](https://ide.bitquery.io/Volatility-of-a-Pair-on-Meteora-Dynamic) is the query to get the volatility for a selected pair in the last 24 hours. +Pass up to a few hundred mints and get back a row for each one that has migrated. Tokens with no row have not graduated. Add `Block: { Time: { since_relative: { days_ago: 7 } } }` to bound the scan. ```graphql -query Volatility { +query MyQuery($tokenAddresses: [String!]) { Solana { - DEXTrades( + Instructions( where: { - Trade: { - Dex: { - ProgramAddress: { - is: "dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN" - } - } - Buy: { Currency: { MintAddress: { is: "token mint address" } } } - Sell: { - Currency: { - MintAddress: { is: "So11111111111111111111111111111111111111112" } - } + Instruction: { + Program: { + Address: { is: "dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN" } + Method: { in: ["migration_damm_v2", "migrate_meteora_damm"] } } + Accounts: { includes: { Address: { in: $tokenAddresses } } } } - Block: { - Time: { - after: "2025-05-23T09:00:00Z" - before: "2025-05-23T11:00:00Z" + Transaction: { Result: { Success: true } } + } + ) { + Block { + Time + } + Instruction { + Accounts { + Address + Token { + Mint } } + Program { + AccountNames + Method + } + } + Transaction { + Signature } - ) { - volatility: standard_deviation(of: Trade_Buy_Price) } } } +{ + "tokenAddresses": ["", "", ""] +} ``` ---- - -## Trader-Focused Trade APIs (with USD Price, Market Cap & Supply) - -The queries below use the **[Trades cube](/docs/trading/crypto-trades-api/trades-api/)** (`Trading { Trades }`) which is trader-focused and provides reliable USD prices including for all tokens. See [DEXTrades vs DEXTradeByTokens vs Trades cube](/docs/cubes/dextrades-dextradebytokens-trading-trades) for when to use which. - -### Get All DEX Trades on Meteora DBC With Price, Market Cap, and Supply +## Latest price of a token on Meteora DBC {#latest-price-of-a-token-on-meteora-dbc} -Stream **all Meteora DBC DEX trades** in real time with **USD price**, **market cap**, **FDV**, **circulating supply**, and **transaction fee** data. Filter by **`Pair.Market.Protocol: dynamic_bonding_curve`** to capture every swap across Meteora DBC in a single subscription. - -You can run this subscription [in the Bitquery IDE](https://ide.bitquery.io/Get-All-DEX-Trades-on-DBC-With-Price-Market-Cap-and-Supply). - -
- Click to expand GraphQL query +If you want a single price rather than a candle, read the last trade from `Trading.Trades`. `PriceInUsd` is the USD price of that print and `Supply.MarketCap` the market cap at that moment. ```graphql -subscription { +{ Trading { Trades( - where: { Pair: { Market: { Protocol: { is: "dynamic_bonding_curve" } } } } + limit: { count: 1 } + orderBy: { descending: Block_Time } + where: { + Pair: { + Market: { + Protocol: { is: "dynamic_bonding_curve" } + Network: { is: "Solana" } + } + Token: { Address: { is: "" } } + } + } ) { + Block { + Time + } + Price + PriceInUsd Side Supply { - MaxSupply - TotalSupply - FullyDilutedValuationUsd - CirculatingSupply MarketCap } - Trader { - Address - } - TransactionHeader { - Fee - FeePayer - Sender - To - Hash - Index - } - Amounts { - Base - Quote - } - AmountsInUsd { - Base - Quote - } - Block { - Date - Time - Timestamp - } Pair { - Currency { - Id - Name - Symbol - } - Market { - Address - Program - Network - } - Currency { - Symbol - Id - Name - } - QuoteCurrency { - Id - Name - Symbol - } Token { - Address - Id - IsNative Symbol - TokenId - Network } QuoteToken { - Address - Id - IsNative Symbol - TokenId - Network + } + Market { + Address } } - Price - PriceInUsd } } } ``` -
- -### Top Traders by PnL for a Specific Meteora DBC Token (Last 30 Minutes) - -Rank traders by **`PnL`** on one bonding curve: filter **`Pair.Market.Address`**, last **30 minutes**, **`limit: 10`**, and **`orderBy`** **`PnL`** descending. Useful for **leaderboards**, **smart-money screens**, and **curve-specific trader analytics**. - -You can run this query [in the Bitquery IDE](https://ide.bitquery.io/Top-Traders-by-PnL-of-a-specific-meteora-DBC-token-curve_2). +## Raw curve trades and history -
- Click to expand GraphQL query +The chain-level cubes carry per-swap detail the Trading cubes leave out, such as the exact instruction behind a trade and the token accounts on each side. `Solana.DEXTrades` keeps roughly 12 hours; `Solana.DEXTradeByTokens` keeps about 7 days on `realtime` and reaches back to mid-2024 on `archive`. ```graphql -{ - Trading { - Trades( - limit: { count: 10 } - orderBy: { descendingByField: "PnL" } +subscription { + Solana { + DEXTrades( where: { - Block: { Time: { since_relative: { minutes_ago: 30 } } } - Pair: { - Market: { - Address: { is: "GowkHeDkWv5zvw7RmF9SHeNgxZVDzrVhn9MGBAk1Kfcn" } + Trade: { + Dex: { + ProgramAddress: { is: "dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN" } } } + Transaction: { Result: { Success: true } } } ) { - Trader { - Address + Block { + Time + } + Transaction { + Signature + Signer + } + Trade { + Dex { + ProgramAddress + ProtocolName + ProtocolFamily + } + Market { + MarketAddress + } + Buy { + Currency { + Name + Symbol + MintAddress + } + Amount + AmountInUSD + Account { + Address + Owner + } + Price + PriceInUSD + } + Sell { + Currency { + Name + Symbol + MintAddress + } + Amount + AmountInUSD + Account { + Address + Owner + } + Price + PriceInUSD + } } - Amount_Bought: sum(of: AmountsInUsd_Base, if: { Side: { is: "Buy" } }) - Amount_Sold: sum(of: AmountsInUsd_Base, if: { Side: { is: "Sell" } }) - Amount_Bought_native: sum(of: Amounts_Base, if: { Side: { is: "Buy" } }) - Amount_Sold_native: sum(of: Amounts_Base, if: { Side: { is: "Sell" } }) - PnL: calculate(expression: "$Amount_Sold - $Amount_Bought") - buys: count(if: { Side: { is: "Buy" } }) - sells: count(if: { Side: { is: "Sell" } }) } } } ``` -
+:::caution Aggregate in native amounts on `archive` and `combined`, not USD +Summing `Trade_Side_AmountInUSD` on the Solana `archive` and `combined` datasets does not aggregate cleanly: adding it to a grouped query shatters one row into many partial rows, and `combined` also returns fewer trades than `realtime` over the same window. Aggregate `Trade_Amount` instead, and take USD figures from the Trading cubes, where every row carries a vetted USD price. +::: ---- +## API key, free trial and pricing + +Create an access token at [account.bitquery.io](https://account.bitquery.io/) and follow [how to generate a token](/docs/authorization/how-to-generate/). The free trial runs for seven days and includes 1,000 API points, 100 MCP credits and two simultaneous streams. Request rate limits by plan are 30 a minute on Personal, 90 on Pro and 240 on Scale, with custom limits on Enterprise; see [rate limits](/docs/plans/rate-limits/). Points and streams are explained on [how billing works](/docs/plans/how-billing-works/), and plan prices are on the [Solana DEX API product page](https://bitquery.io/products/solana-dex-api) and the [pricing page](https://bitquery.io/pricing). + + + +## Related documentation + +- [Meteora DAMM v2 API](/docs/blockchain/Solana/Meteora-DAMM-v2-API/), where graduated DBC tokens land +- [Meteora DLMM API](/docs/blockchain/Solana/Meteora-DLMM-API/) +- [Meteora DAMM v1 API](/docs/blockchain/Solana/Meteora-DYN-API/) +- [Jupiter Studio API](/docs/blockchain/Solana/jupiter-studio-api/) and [Believe API](/docs/blockchain/Solana/Believe-API/), launchpads built on DBC +- [Trading API overview](/docs/trading/trading-data-overview/), [Trades cube](/docs/trading/crypto-trades-api/trades-api/) and [Pairs cube](/docs/trading/crypto-price-api/pairs/) +- [Wallet PnL](/docs/trading/crypto-trades-api/wallet-pnl/) +- [Solana DEX Trades API](/docs/blockchain/Solana/solana-dextrades/) +- [Data coverage and retention](/docs/graphql/data-coverage-retention/) +- [gRPC DEX trades topic](/docs/grpc/solana/topics/dextrades/) and [real-time Solana streams over Kafka](/docs/streams/real-time-solana-data/) +- [API Authorization](/docs/authorization/how-to-use/) + +## Support + +For technical support and questions contact our support team via telegram or create a ticket [here](https://support.bitquery.io/)