This guide will show you how to query the Bancor Network for trading volume, or "conversion volume" in Bancor parlance
The Bancor Network is composed of many different liquidity pools that work together in order to create a seamless experience for converting any token to any other token in the network. Querying for all the volume information for these pools requires interacting with each pool separately.
In addition, since the Bancor Network operates on multiple blockchains, querying the volume requires a slightly different process on each blockchain.
The principle is the same for each blockchain:
Query for all conversion events from the network
Normalize the values to a single common denominator (BNT, USD etc.)
Aggregate the data based on the required timeframe (day, week etc.)
Step 1 - Query for Conversion Events
On Ethereum it's possible to simply query the BancorNetwork contract to get all the conversion events in the network:
bancorNetwork = ContractRegistry.addressOf('BancorNetwork') This pulls the BancorNetwork contract address from the contract registry