CoinSwap API – Build Charting, Get Latest Trades and Token Price
CoinSwap is a DEX(decentralized exchange) that provides users with a suite of services to help them maximize their returns. The exchange wishes to take on Pancake exchange by delivering lower fees and minimizing slippage through techniques like smart contract routing.
Bitquery recently integrated CoinSwap, which will enable anyone to pull any data for CoinSwap. Let’s see some examples for getting CoinSwap data using Bitquery DEX APIs.
Similar to Uniswap and Pancake, CoinSwap also an AMM without an order book. The way CoinSwap works is that it allows liquidity providers to create token pairs/pools and provide liquidity to them, which will be used to enable trades on the DEX. In return, liquidity providers earn a fee) in every trade. Additionally, It also allows staking to maximize your returns.
Note: If you are not familiar with GraphQL APIs, you can start from here and sign up on our GraphQL IDE to get your API keys. Additionally, if you have any questions related to our APIs, please ask them on the Bitquery community forum.
CoinSwap Volume and Trades
CoinSwap is a pretty new Exchange, only launched in April 2021, and in the last 1 month, they did more than 113,553 trades, totaling more than $85 million in trade volume.
If you run the query below, you will see in the 2nd month of the launch CoinSwap did more than 100K trades and $76 million in trade volume.
All Latest Trades on CoinSwap
Our DEX APIs allow you to pull DEX trading-related data for any DEX from all the blockchains Bitquery supports.
Let’s see how to get the latest trades from the CoinSwap exchanges.
As you can see, you will get USD value for different values, such as buy amount, sell amount, and transaction fee, because we also provide market data with our blockchain APIs.
CoinSwap OHLC Candle Data
OHLC (Open High Low Close) data is essential for charting. We support OHLC data for different timeframes. For example, we are getting WBNB/ BUSD currency pair’s OHLC data for the 5-minute timeframe in the following example.
Price for All tokens Listed on CoinSwap Exchange
Using the following query, you can get the price for all the tokens listed on the CoinSwap exchange in a single API call.
If you look at the query closely, we only mention quote currency (WBNB) to the price for the tokens traded against WBNB on CoinSwap.
Latest CoinSwap Pairs/Pools
As we discussed before, liquidity providers create token pairs/pools on DEX and provide liquidity.
Using the following API, you can pull all newly created Pancake pools. For this, we will use our arguments
API to get the PairCreated
event of the CoinSwap Factory Contract.
Pools are essentially BEP20 tokens. You will get these tokens when you add liquidity to the pool. Similarly, you can get your liquidity back by depositing pool tokens back to the protocol.
Let’s see how to get liquidity and other stats for the CoinSwap pool.
CoinSwap Pool’s Liquidity
Use our balance APIs to get the liquidity of any CoinSwap pool. For example, check the following example.
Additionally, you can get trade volume and count for a given pool using DEX APIs.
All Trades of a CoinSwap Pool
By providing a smart contract address, you can get trades for any given pool token. For example, we will get the latest trades related to the LINK-WBNB pool on the CoinSwap exchange in the query below.
Getting Pool’s Mint Events
You can use our SmartContractEvent
API to get data for any smart contract event. For example, whenever someone adds liquidity to a pool, the contract emits a Mint
event. Similarly, you can use Burn
events to get data whenever liquidity is removed from the pool.
Trades for a specific token on the CoinSwap DEX
To get all the trades for a specific token (ex- WBNB) on the CoinSwap DEX; you need to pass that token’s smart contract address as baseCurrency
in the API. For example, check the following query.
Getting all CoinSwap Pools for a Specific Currency
let’s say if you want to get all the Pair tokens on CoinSwap for a given currency. Then use the following query.
Conclusion
DEX space is growing faster than ever, and more transaction-efficient blockchains will push this growth to new heights. Another reason for this growth is DEX-related tooling. There are multiple projects such as Poocoin, Bogtools that provide a better user experience to traders; this is attracting many new users into the ecosystem.
Many of these DEX-related tools use our APIs and because of our CoinSwap integration, now they can integrate it with their exchange pretty easily.
If you own a DeFi protocol and want us to integrate it with our APIs, please reach out to us at sales@bitquery.io.
Join our Telegram if you have any questions or looking to analyze DEX protocols and building DEX-specific tools.
Also, Read
- PancakeSwap — Querying DEXs
- Price Index for DEX Tokens
- Querying Binance Smart Chain (BSC)
- Ethereum DEX GraphQL APIs with Examples
- Offline Dashboards | Client only Blockchain data visualization and tools
- Analyzing Decentralized Exchange using Bitquery Blockchain Explorer
- Querying Conflux blockchain using GraphQL APIs
- How to use GraphQL Alias and Aggregation?
- How to use GraphQL with Python, Javascript, and Ruby
About Bitquery
Bitquery is a set of software tools that parse, index, access, search, and use information across blockchain networks in a unified way. Our products are:
-
Coinpath® APIs provide blockchain money flow analysis for more than 24 blockchains. With Coinpath’s APIs, you can monitor blockchain transactions, investigate crypto crimes such as bitcoin money laundering, and create crypto forensics tools. Read this to get started with Coinpath®.
-
Digital Assets API provides index information related to all major cryptocurrencies, coins, and tokens.
-
DEX API provides real-time deposits and transactions, trades, and other related data on different DEX protocols like Uniswap, Kyber Network, Airswap, Matching Network, etc.
If you have any questions about our products, ask them on our Telegram channel or email us at sales@bitquery.io. Also, subscribe to our newsletter below, we will keep you updated with the latest in the cryptocurrency world.
Subscribe to our newsletter
Subscribe and never miss any updates related to our APIs, new developments & latest news etc. Our newsletter is sent once a week on Monday.