|
| 1 | +--- |
| 2 | +sidebar_position: 7 |
| 3 | +--- |
| 4 | + |
| 5 | +import VideoPlayer from "../../../src/components/videoplayer.js"; |
| 6 | + |
| 7 | +# PancakeSwap Infinity API |
| 8 | + |
| 9 | +Bitquery provides PancakeSwap Infinity data through APIs, Streams and Data Dumps. |
| 10 | +The below graphQL APIs and Streams are examples of data points you can get with Bitquery for PancakeSwap Infinity on Binance Smart Chain (BSC). |
| 11 | +If you have any question on other data points reach out to [support](https://t.me/Bloxy_info) |
| 12 | + |
| 13 | +Need zero-latency Binance Smart Chain (BSC) data? [Read about our Kafka Streams and Contact us for a Trial](https://docs.bitquery.io/docs/streams/kafka-streaming-concepts/). |
| 14 | + |
| 15 | +You may also be interested in: |
| 16 | + |
| 17 | +- [Four.meme APIs ➤](https://docs.bitquery.io/docs/blockchain/BSC/four-meme-api/) |
| 18 | +- [BSC PancakeSwap APIs ➤](https://docs.bitquery.io/docs/blockchain/BSC/pancake-swap-api/) |
| 19 | + |
| 20 | +:::note |
| 21 | +To query or stream data via graphQL **outside the Bitquery IDE**, you need to generate an API access token. |
| 22 | + |
| 23 | +Follow the steps here to create one: [How to generate Bitquery API token ➤](https://docs.bitquery.io/docs/authorisation/how-to-generate/) |
| 24 | +::: |
| 25 | + |
| 26 | +<head> |
| 27 | + <meta name="title" content="PancakeSwap Infinity API - BSC - Tokens, Trades, Live Prices"/> |
| 28 | + <meta name="description" content="Get on-chain data of any PancakeSwap Infinity based token through our PancakeSwap Infinity API."/> |
| 29 | + <meta name="keywords" content="PancakeSwap Infinity API,PancakeSwap Infinity on-chain data API,PancakeSwap Infinity token data API,BSC blockchain API,PancakeSwap Infinity DEX data API,PancakeSwap Infinity API documentation,PancakeSwap Infinity crypto API,PancakeSwap Infinity web3 API,DEX Trades,BSC,PancakeSwap Infinity,PancakeSwap Infinity memecoins,BSC DEX,PancakeSwap Infinity DEX,token trading,blockchain data,crypto trading"/> |
| 30 | + <meta name="robots" content="index, follow"/> |
| 31 | + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
| 32 | + <meta name="language" content="English"/> |
| 33 | + |
| 34 | +<meta property="og:type" content="website" /> |
| 35 | +<meta |
| 36 | + property="og:title" |
| 37 | + content="PancakeSwap Infinity API - BSC - Tokens, Trades, Live Prices" |
| 38 | +/> |
| 39 | +<meta |
| 40 | + property="og:description" |
| 41 | + content="Get on-chain data of any PancakeSwap Infinity based token through our PancakeSwap Infinity API." |
| 42 | +/> |
| 43 | + |
| 44 | + <meta property="twitter:card" content="summary_large_image"/> |
| 45 | + <meta property="twitter:title" content="PancakeSwap Infinity API - BSC - Tokens, Trades, Live Prices"/> |
| 46 | + <meta property="twitter:description" content="Get on-chain data of any PancakeSwap Infinity based token through our PancakeSwap Infinity API."/> |
| 47 | +</head> |
| 48 | + |
| 49 | +## Get Latest Trades on PancakeSwap Infinity |
| 50 | + |
| 51 | +Below query will subscribe you to the latest DEX Trades on PancakeSwap Infinity. Try out the API [here](https://ide.bitquery.io/pancakeswap-infinity-trades-on-bsc) |
| 52 | + |
| 53 | +```graphql |
| 54 | +query MyQuery { |
| 55 | + EVM(dataset: realtime, network: bsc) { |
| 56 | + DEXTrades( |
| 57 | + where: { |
| 58 | + Trade: { Dex: { ProtocolName: { is: "pancakeswap_infinity" } } } |
| 59 | + } |
| 60 | + limit: { count: 10 } |
| 61 | + orderBy: { descending: Block_Time } |
| 62 | + ) { |
| 63 | + Transaction { |
| 64 | + From |
| 65 | + To |
| 66 | + } |
| 67 | + Trade { |
| 68 | + Dex { |
| 69 | + ProtocolName |
| 70 | + SmartContract |
| 71 | + } |
| 72 | + Buy { |
| 73 | + Currency { |
| 74 | + Name |
| 75 | + } |
| 76 | + Price |
| 77 | + Amount |
| 78 | + } |
| 79 | + Sell { |
| 80 | + Amount |
| 81 | + Currency { |
| 82 | + Name |
| 83 | + } |
| 84 | + Price |
| 85 | + } |
| 86 | + } |
| 87 | + Block { |
| 88 | + Time |
| 89 | + } |
| 90 | + } |
| 91 | + } |
| 92 | +} |
| 93 | +``` |
| 94 | + |
| 95 | +## Get Latest Price of a token on PancakeSwap Infinity |
| 96 | + |
| 97 | +Below query will get you Latest Price of a token on PancakeSwap Infinity. Try out the API [here](https://ide.bitquery.io/Get-Latest-Price-of-a-token-on-PancakeSwap-Infinity_1) |
| 98 | + |
| 99 | +```graphql |
| 100 | +query MyQuery { |
| 101 | + EVM(dataset: realtime, network: bsc) { |
| 102 | + DEXTradeByTokens( |
| 103 | + where: { |
| 104 | + Trade: { |
| 105 | + Currency: { |
| 106 | + SmartContract: { is: "0x9dc44ae5be187eca9e2a67e33f27a4c91cea1223" } |
| 107 | + } |
| 108 | + Dex: { ProtocolName: { is: "pancakeswap_infinity" } } |
| 109 | + } |
| 110 | + } |
| 111 | + limit: { count: 10 } |
| 112 | + orderBy: { descending: Block_Time } |
| 113 | + ) { |
| 114 | + Transaction { |
| 115 | + From |
| 116 | + To |
| 117 | + } |
| 118 | + Block { |
| 119 | + Time |
| 120 | + } |
| 121 | + Trade { |
| 122 | + Price |
| 123 | + PriceInUSD |
| 124 | + Amount |
| 125 | + AmountInUSD |
| 126 | + Currency { |
| 127 | + Name |
| 128 | + Symbol |
| 129 | + SmartContract |
| 130 | + } |
| 131 | + Dex { |
| 132 | + ProtocolName |
| 133 | + SmartContract |
| 134 | + } |
| 135 | + Side { |
| 136 | + Amount |
| 137 | + AmountInUSD |
| 138 | + Currency { |
| 139 | + Name |
| 140 | + Symbol |
| 141 | + SmartContract |
| 142 | + } |
| 143 | + } |
| 144 | + } |
| 145 | + } |
| 146 | + } |
| 147 | +} |
| 148 | +``` |
| 149 | + |
| 150 | +## Get Top Traders of a token on PancakeSwap Infinity |
| 151 | + |
| 152 | +This query will fetch you top traders of a token on PancakeSwap Infinity for the selected network. You can test the query [here](https://ide.bitquery.io/top-traders-of-a-token-on-pancakeswap_1). |
| 153 | + |
| 154 | +```graphql |
| 155 | +query topTraders($network: evm_network, $token: String) { |
| 156 | + EVM(network: $network) { |
| 157 | + DEXTradeByTokens( |
| 158 | + orderBy: {descendingByField: "volumeUsd"} |
| 159 | + limit: {count: 100} |
| 160 | + where: {Trade: {Currency: {SmartContract: {is: $token}}, Dex: {ProtocolName: {is: "pancakeswap_infinity"}}}} |
| 161 | + ) { |
| 162 | + Trade { |
| 163 | + Dex { |
| 164 | + OwnerAddress |
| 165 | + ProtocolFamily |
| 166 | + ProtocolName |
| 167 | + } |
| 168 | + Buyer |
| 169 | + } |
| 170 | + bought: sum(of: Trade_Amount, if: {Trade: {Side: {Type: {is: buy}}}}) |
| 171 | + sold: sum(of: Trade_Amount, if: {Trade: {Side: {Type: {is: sell}}}}) |
| 172 | + volume: sum(of: Trade_Amount) |
| 173 | + volumeUsd: sum(of: Trade_Side_AmountInUSD) |
| 174 | + } |
| 175 | + } |
| 176 | +} |
| 177 | +{ |
| 178 | + "network": "bsc", |
| 179 | + "token": "0x9dc44ae5be187eca9e2a67e33f27a4c91cea1223" |
| 180 | +} |
| 181 | +``` |
| 182 | + |
| 183 | +## OHLC in USD of a Token |
| 184 | + |
| 185 | +This query retrieves the Open, High, Low, and Close (OHLC) prices in USD for a specific token traded on PancakeSwap Infinity over a defined time period and interval. You can try out the API [here](https://ide.bitquery.io/OHLC-on-bsc-pancakeswap-infinity) on Bitquery Playground. |
| 186 | + |
| 187 | +```graphql |
| 188 | +{ |
| 189 | + EVM(network: bsc, dataset: realtime) { |
| 190 | + DEXTradeByTokens( |
| 191 | + orderBy: { descendingByField: "Block_testfield" } |
| 192 | + where: { |
| 193 | + Trade: { |
| 194 | + Currency: { |
| 195 | + SmartContract: { is: "0x9dc44ae5be187eca9e2a67e33f27a4c91cea1223" } |
| 196 | + } |
| 197 | + Side: { |
| 198 | + Currency: { |
| 199 | + SmartContract: { |
| 200 | + is: "0x55d398326f99059ff775485246999027b3197955" |
| 201 | + } |
| 202 | + } |
| 203 | + Type: { is: buy } |
| 204 | + } |
| 205 | + PriceAsymmetry: { lt: 0.1 } |
| 206 | + Dex: { ProtocolName: { is: "pancakeswap_infinity" } } |
| 207 | + } |
| 208 | + } |
| 209 | + limit: { count: 10 } |
| 210 | + ) { |
| 211 | + Block { |
| 212 | + testfield: Time(interval: { in: hours, count: 1 }) |
| 213 | + } |
| 214 | + volume: sum(of: Trade_Amount) |
| 215 | + Trade { |
| 216 | + high: Price(maximum: Trade_Price) |
| 217 | + low: Price(minimum: Trade_Price) |
| 218 | + open: Price(minimum: Block_Number) |
| 219 | + close: Price(maximum: Block_Number) |
| 220 | + } |
| 221 | + count |
| 222 | + } |
| 223 | + } |
| 224 | +} |
| 225 | +``` |
| 226 | + |
| 227 | +## Get trading volume, buy volume, sell volume of a token |
| 228 | + |
| 229 | +This query fetches you the traded volume, buy volume and sell volume of a token `0x9dc44ae5be187eca9e2a67e33f27a4c91cea1223` on PancakeSwap Infinity. Try out the API [here](https://ide.bitquery.io/trade_volume_bsc_pancakeswap_infinity). |
| 230 | + |
| 231 | +```graphql |
| 232 | +query MyQuery { |
| 233 | + EVM(network: bsc) { |
| 234 | + DEXTradeByTokens( |
| 235 | + where: { |
| 236 | + Trade: { |
| 237 | + Currency: { |
| 238 | + SmartContract: { is: "0x9dc44ae5be187eca9e2a67e33f27a4c91cea1223" } |
| 239 | + } |
| 240 | + Dex: { ProtocolName: { is: "pancakeswap_infinity" } } |
| 241 | + } |
| 242 | + TransactionStatus: { Success: true } |
| 243 | + Block: { Time: { since: "2025-02-12T00:00:00Z" } } |
| 244 | + } |
| 245 | + ) { |
| 246 | + Trade { |
| 247 | + Currency { |
| 248 | + Name |
| 249 | + Symbol |
| 250 | + SmartContract |
| 251 | + Decimals |
| 252 | + } |
| 253 | + } |
| 254 | + traded_volume_in_usd: sum(of: Trade_Side_AmountInUSD) |
| 255 | + sell_volume_in_usd: sum( |
| 256 | + of: Trade_Side_AmountInUSD |
| 257 | + if: { Trade: { Side: { Type: { is: buy } } } } |
| 258 | + ) |
| 259 | + buy_volume_in_usd: sum( |
| 260 | + of: Trade_Side_AmountInUSD |
| 261 | + if: { Trade: { Side: { Type: { is: sell } } } } |
| 262 | + ) |
| 263 | + } |
| 264 | + } |
| 265 | +} |
| 266 | +``` |
| 267 | + |
| 268 | +## Get top bought tokens on PancakeSwap Infinity |
| 269 | + |
| 270 | +This query will fetch you the top bought tokens on PancakeSwap Infinity. Try out the query [here](https://ide.bitquery.io/top-bought-tokens-on-pancakeswap_infinity_1). |
| 271 | + |
| 272 | +```graphql |
| 273 | +query timeDiagram($network: evm_network) { |
| 274 | + EVM(network: $network) { |
| 275 | + DEXTradeByTokens( |
| 276 | + orderBy: {descendingByField: "buy"} |
| 277 | + limit: {count: 100} |
| 278 | + where: {Trade: {Dex: {ProtocolName: {is: "pancakeswap_infinity"}}}} |
| 279 | + ) { |
| 280 | + Trade { |
| 281 | + Currency { |
| 282 | + Symbol |
| 283 | + Name |
| 284 | + SmartContract |
| 285 | + } |
| 286 | + Dex { |
| 287 | + ProtocolName |
| 288 | + } |
| 289 | + } |
| 290 | + buy: sum(of: Trade_Side_AmountInUSD, if: {Trade: {Side: {Type: {is: buy}}}}) |
| 291 | + sell: sum(of: Trade_Side_AmountInUSD, if: {Trade: {Side: {Type: {is: sell}}}}) |
| 292 | + } |
| 293 | + } |
| 294 | +} |
| 295 | +{ |
| 296 | + "network": "bsc" |
| 297 | +} |
| 298 | +``` |
| 299 | + |
| 300 | +## Get top sold tokens on PancakeSwap Infinity |
| 301 | + |
| 302 | +This query will fetch you the top bought tokens on PancakeSwap Infinity. Try out the query [here](https://ide.bitquery.io/top-sold-tokens-on-pancake-infinty_1). |
| 303 | + |
| 304 | +```graphql |
| 305 | +query timeDiagram($network: evm_network) { |
| 306 | + EVM(network: $network) { |
| 307 | + DEXTradeByTokens( |
| 308 | + orderBy: {descendingByField: "sell"} |
| 309 | + limit: {count: 100} |
| 310 | + where: {Trade: {Dex: {ProtocolName: {is: "pancakeswap_infinity"}}}} |
| 311 | + ) { |
| 312 | + Trade { |
| 313 | + Currency { |
| 314 | + Symbol |
| 315 | + Name |
| 316 | + SmartContract |
| 317 | + } |
| 318 | + Dex { |
| 319 | + ProtocolName |
| 320 | + } |
| 321 | + } |
| 322 | + buy: sum(of: Trade_Side_AmountInUSD, if: {Trade: {Side: {Type: {is: buy}}}}) |
| 323 | + sell: sum(of: Trade_Side_AmountInUSD, if: {Trade: {Side: {Type: {is: sell}}}}) |
| 324 | + } |
| 325 | + } |
| 326 | +} |
| 327 | +{ |
| 328 | + "network": "bsc" |
| 329 | +} |
| 330 | +``` |
| 331 | + |
| 332 | +## Get Metadata of a token |
| 333 | + |
| 334 | +Use the below query to get Token's metadata like `Name`, `symbol`, `SmartContract Address`, `Decimals`. Try out the API [here](https://ide.bitquery.io/get-metadata-for-bsc-pancakeswap-infnity-token) in the Bitquery Playground. |
| 335 | + |
| 336 | +```graphql |
| 337 | +query MyQuery { |
| 338 | + EVM(network: bsc, dataset: realtime) { |
| 339 | + DEXTradeByTokens( |
| 340 | + limit: { count: 1 } |
| 341 | + orderBy: { descending: Block_Time } |
| 342 | + where: { |
| 343 | + Trade: { |
| 344 | + Currency: { |
| 345 | + SmartContract: { is: "0x9dc44ae5be187eca9e2a67e33f27a4c91cea1223" } |
| 346 | + } |
| 347 | + Dex: { ProtocolName: { is: "pancakeswap_infinity" } } |
| 348 | + } |
| 349 | + } |
| 350 | + ) { |
| 351 | + Trade { |
| 352 | + Currency { |
| 353 | + Name |
| 354 | + Symbol |
| 355 | + SmartContract |
| 356 | + ProtocolName |
| 357 | + HasURI |
| 358 | + Fungible |
| 359 | + Decimals |
| 360 | + } |
| 361 | + } |
| 362 | + } |
| 363 | + } |
| 364 | +} |
| 365 | +``` |
0 commit comments