# Polygon (Matic) APIs

**URL:** <https://community.bitquery.io/t/polygon-matic-apis/398>\
**Category:** GraphQL Tutorials\
**Tags:** matic, polygon\
**Created:** [August 12, 2021, 3:55pm UTC](https://community.bitquery.io/t/polygon-matic-apis/398 "2021-08-12T15:55:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gaurav](https://avatars.discourse-cdn.com/v4/letter/g/b487fb/32.png) [@gaurav](https://community.bitquery.io/u/gaurav)\
**Post date:** [August 12, 2021, 3:55pm UTC](https://community.bitquery.io/t/polygon-matic-apis/398/1 "2021-08-12T15:55:13Z")

</div>

![Querying Polygon Network](https://us1.discourse-cdn.com/flex016/uploads/bitquery/original/1X/8aefe007f0371be78462540eac59e159dd9bd68d.png)

## **Polygon (MATIC) APIs | Transfers, Trades, Tokens & DEX**

Last month, we [announced the grant](https://bitquery.io/blog/bitquery-polygon) from the Polygon team. Soon after, our team started the Polygon integration in our products.

Today we are happy to announce that we have integrated Polygon on all Bitquery products. Additionally, we have parsed 100s of DEXs on Polygon such as QuickSwap, ApeSwap, WaultSwap, etc. Therefore now you can query them using our [GraphQl APIs](https://graphql.bitquery.io/).

- Checkout [Polygon Explorer](https://explorer.bitquery.io/matic/dex)
- [Query Polygon network using GraphQL IDE](https://graphql.bitquery.io/ide)
- Polygon’s Money Tracing APIs ([Example](https://explorer.bitquery.io/matic/smart_contract/0x39d316aa7cd6ccf176c8407198412e28877f6c7c/graph))

In this article, we will talk about how to query the Polygon network using Bitquery APIs and access trading data for DEXs on Polygon.

[Polygon](https://polygon.technology/) is a protocol and framework for building and connecting Ethereum-compatible blockchain networks. It is a 2nd layer solution that is designed to solve blockchain scalability issues. MATIC is the Polygon’s native token that powers the Polygon network.

Users can deposit Ethereum tokens to a Polygon smart contract, interact with them within Polygon, and later withdraw them back to the Ethereum main chain. The MATIC token is used to pay transaction fees and participate in proof-of-stake consensus.

## **Monthly Transaction Volume**

In the following query, we’ll be querying the [monthly transaction volume of the Polygon network](https://graphql.bitquery.io/ide/t6UQzJ9Vsm).

```auto
{
  ethereum(network: matic) {
    transactions(options: {asc: "date.month"}, date: {since: "2021–01–01"}) {
      date {
        month
        year
      }
      count: count
      gasValue
    }
  }
}

```

As you can see in the following visualization, Polygon did more than 200 million transactions in June, at its peak, which is 577% of what Ethereum did in June 2021. In the same month, the Binance Smart chain processed more than 130 million transactions.

If you want the latest Polygon transactions, [use this API](https://graphql.bitquery.io/ide/YcHloUi2L0).

 ![image](https://us1.discourse-cdn.com/flex016/uploads/bitquery/original/1X/6d2204516c3c02edc4dfc112b680a3c86a10844b.png)

Monthly Transaction Volume on Polygon

## **Monthly Transfer Count on Polygon**

A transfer is when a token gets transferred. One transaction can contain none or multiple transfers. Using the following query, you can check [monthly transfers on the Polygon network](https://graphql.bitquery.io/ide/3cfIOhaHUH).

```auto
{
  ethereum(network: matic) {
    transfers(options: {asc: "date.month"}, date: {since: "2021-01-01"}) {
      date {
        month
        year
      }
      transfer_count: count
    }
  }
}

```

Polygon saw more than 140 million transfers in July 2021. In the same month, Ethereum saw 61 million transfers, and BSC saw 328 million transfers.

 ![image](https://us1.discourse-cdn.com/flex016/uploads/bitquery/original/1X/873ea8c0eecb193f4c7de0960409c0cf51874be6.png)

## Monthly Transfers on Polygon

You can use the [following GraphQL API](https://graphql.bitquery.io/ide/5o601ZK43m) to get the latest Polygon transfers.

```auto
{
  ethereum(network: matic) {
    transfers(
      options: {desc: "block.height", limit: 10, offset: 0}
      date: {since: "2021-08-11", till: null}
      amount: {gt: 0}
    ) {
      block {
        timestamp {
          time(format: "%Y-%m-%d %H:%M:%S")
        }
        height
      }
      sender {
        address
      }
      receiver {
        address
      }
      currency {
        address
        symbol
      }
      amount
      transaction {
        hash
      }
      external
    }
  }
}

```

## **Top Tokens on Polygon based on number of transfers**

Let’s also see the top currencies on the Polygon network based on the number of transfers. You can get this data using [this GraphQL API](https://graphql.bitquery.io/ide/e2yk1qih3P).

 ![image](https://us1.discourse-cdn.com/flex016/uploads/bitquery/original/1X/048d9bf305c5e8d49da6a531c858f7f581769160.jpeg)  
Top Tokens Traded on Polygon

## Smart Contracts on Polygon

Polygon saw a whopping [1.75 billion smart contract calls](https://explorer.bitquery.io/matic/calls) in July 2021, almost equal to Binance smart chain’s [1.76 billion smart contract call](https://explorer.bitquery.io/bsc/calls).

On the other hand, Ethereum processed around [132 million smart contract calls](https://explorer.bitquery.io/ethereum/calls) in July.

You can use [the following query](https://graphql.bitquery.io/ide/ly7EfKLdbw) to get smart contract calls a month on month basis.

```auto
{
  ethereum(network: bsc) {
    smartContractCalls(options: {asc: "date.date"}, date: {since: null, till: null}) {
      date: date {
        date(format: "%Y-%m")
      }
      count: count
      contracts: count(uniq: smart_contracts)
      callers: count(uniq: senders)
      methods: count(uniq: smart_contract_methods)
    }
  }
}

```

## DEXs on Polygon

Defi is growing on the Polygon network, 100s of DEXs and other DApps are deployed on Polygon. In addition, Aave, Sushiswap, and other famous Dapps are now also integrated with Polygon.

Since its launch, Polygon saw more than 53 million trades, totaling around $24 billion in trade volume, and [all these trades came in the last four months](https://graphql.bitquery.io/ide/VsjSYAJhf8).

DEXs like QuickSwap and SushiSwap on Polygon saw more than 6 billion in trade amount in just a few months.

Use [this API](https://graphql.bitquery.io/ide/Bfg59xekSl) to get the top Polygon DEXs based on trade volume.

 ![image](https://us1.discourse-cdn.com/flex016/uploads/bitquery/original/1X/aa78a4687683cf3cf692840b6f0dce28e4df55e3.jpeg)

Top Polygon DEXs based on trade volume

## Top Tokens Trades on Polygon

As we have seen with other blockchains, stablecoin is also ruling the Polygon network. The top[5 tokens](https://graphql.bitquery.io/ide/hhvsSeGmUH) are involved in more than 95% of trades, and USDC is more popular than USDT.

 ![image](https://us1.discourse-cdn.com/flex016/uploads/bitquery/original/1X/cbbbb30bbad92f6bcc86a5cb00f563a78ff627d1.png)

## **All Latest Trades on Polygon**

You can use our [DEX APIs](https://bitquery.io/products/dex) to get all the latest trades on Polygon for any DEX we support.

For example, check [the following API](https://graphql.bitquery.io/ide/mRWw74nkcf) to get the latest Polygon trade.

```auto
{
  ethereum(network: matic) {
    dexTrades(
      options: {desc: ["block.height", "tradeIndex"], limit: 10}
      date: {since: null, till: null}
    ) {
      block {
        timestamp {
          time(format: "%Y-%m-%d %H:%M:%S")
        }
        height
      }
      tradeIndex
      protocol
      exchange {
        fullName
      }
      smartContract {
        address {
          address
        }
      }
      buyAmountInUSD: buyAmount(in: USD)
      buyCurrency {
        address
        symbol
      }
      sellAmountInUSD: sellAmount(in: USD)
      sellCurrency {
        address
        symbol
      }
      transaction {
        hash
      }
    }
  }
}

```

You can also get trades for specific DEX, check the following example for getting [latest trades from QuickSwap](https://graphql.bitquery.io/ide/dlPiotaij5).

```auto
{
  ethereum(network: matic) {
    dexTrades(
      options: {desc: ["block.height", "tradeIndex"], limit: 10}
      exchangeName: {is: "QuickSwap"}
      date: {since: null, till: null}
    ) {
      block {
        timestamp {
          time(format: "%Y-%m-%d %H:%M:%S")
        }
        height
      }
      tradeIndex
      protocol
      exchange {
        fullName
      }
      smartContract {
        address {
          address
        }
      }
      buyAmountInUSD: buyAmount(in: USD)
      buyCurrency {
        address
        symbol
      }
      sellAmountInUSD: sellAmount(in: USD)
      sellCurrency {
        address
        symbol
      }
      transaction {
        hash
      }
    }
  }
}

```

## Showing Polygon’s DEXs data on TradingView

We provide flexible OHLC data APIs for all the DEXs and all the blockchains we support. Therefore you can easily integrate DEX trading data with the TradingView library to build charts for traders. We have also written tutorials on integrating Bitquery APIs with the TradingView library using [**React**](https://community.bitquery.io/t/bitquery-api-integration-with-tradingview-technical-analysis-charts-dex-apis/244) and [**VueJS**](https://community.bitquery.io/t/integrating-tradingview-s-technical-analysis-charts-with-bitquery-graphql-api-using-vuejs/343).

For example, checkout following query in which we get [CHI-WMATIC pair’s OHLC](https://graphql.bitquery.io/ide/sSiLO6zNQE) data for a minute timeframe.

```auto
{
  ethereum(network: matic) {
    dexTrades(
      options: {limit: 100, asc: "timeInterval.minute"}
      date: {since: "2021-08-11"}
      exchangeName: {is: "QuickSwap"}
      baseCurrency: {is: "0x0000000000004946c0e9f43f4dee607b0ef1fa1c"}
      quoteCurrency: {is: "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270"}
    ) {
      timeInterval {
        minute(count: 5)
      }
      baseCurrency {
        symbol
        address
      }
      baseAmount
      quoteCurrency {
        symbol
        address
      }
      quoteAmount
      trades: count
      quotePrice
      maximum_price: quotePrice(calculate: maximum)
      minimum_price: quotePrice(calculate: minimum)
      open_price: minimum(of: block, get: quote_price)
      close_price: maximum(of: block, get: quote_price)
    }
  }
}

```

## Latest Trades for a given token on Polygon

Let’s say you want the latest trades for a given token on the Polygon network; you can use the following query, where we are getting the latest trades for [the DINO token](https://graphql.bitquery.io/ide/hkDXhVo3z1).

Just replace the baseCurrency with your token’s address.

```auto
{
  ethereum(network: matic) {
    dexTrades(
      options: {desc: ["block.height", "tradeIndex"], limit: 10}
      baseCurrency: {is: "0xaa9654becca45b5bdfa5ac646c939c62b527d394"}
      date: {after: "2021-03-28"}
    ) {
      transaction {
        hash
      }
      exchange {
        name
      }
      tradeIndex
      date {
        date
      }
      block {
        height
      }
      buyAmount
      buyAmountInUsd: buyAmount(in: USD)
      buyCurrency {
        symbol
        address
      }
      sellAmount
      sellAmountInUsd: sellAmount(in: USD)
      sellCurrency {
        symbol
        address
      }
      sellAmountInUsd: sellAmount(in: USD)
      tradeAmount(in: USD)
      transaction {
        gasValue
        gasPrice
        gas
      }
    }
  }
}

```

## Conclusion

In the upcoming days, we will write more tutorials on Polygon and how to get different types of data from the Polygon networks using Bitquery APIs.

If you have any specific queries, please comment below.

---

<div class="post-metadata">

**Author:** ![benmcd555](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@benmcd555](https://community.bitquery.io/u/benmcd555)\
**Post date:** [December 31, 2021, 5:47pm UTC](https://community.bitquery.io/t/polygon-matic-apis/398/2 "2021-12-31T17:47:07Z")

</div>

Could you do a query for Mint and burn data of liquidity pools?  
Thanks

---

<div class="post-metadata">

**Author:** ![aman](https://avatars.discourse-cdn.com/v4/letter/a/90ced4/32.png) [@aman](https://community.bitquery.io/u/aman)\
**Post date:** [January 2, 2022, 7:56pm UTC](https://community.bitquery.io/t/polygon-matic-apis/398/3 "2022-01-02T19:56:52Z")

</div>

> **[burn and mint](https://graphql.bitquery.io/ide/psLxt4XnsJ)**
>
> Bitquery is analytical engine for blockchains
