BalancerV2 is an automated portfolio manager and liquidity provider for decentralized exchanges (DEXs) on the Ethereum blockchain. It allows users to create and manage self-balancing index funds, called Balancer pools, with multiple tokens. BalancerV2 was founded in 2018 by Mike McDonald and Fernando Martinelli. The Balancer Labs company created the protocol, which went live in March 2020. Its name comes from the concept of balancing portfolios and providing liquidity in the DeFi space.
BalancerV2 offers several benefits compared to its direct competitors in the decentralized finance (DeFi) space. One of the main advantages of using BalancerV2 is its advanced automated portfolio management feature. BalancerV2 allows users to create and manage liquidity pools with multiple tokens, providing a flexible and customizable way to manage their assets. This is particularly beneficial for investors who want to rebalance their portfolios based on market conditions or personal preferences.
Another key benefit of BalancerV2 is its efficient and cost-effective trading mechanism. Unlike traditional exchanges, BalancerV2 uses an algorithmic trading protocol that allows for seamless swapping of tokens within a pool. This eliminates the need for order books and reduces slippage, resulting in lower trading fees and improved execution rates.
Additionally, BalancerV2 supports smart order routing, which enables users to optimize their trades by splitting them across multiple pools. This ensures liquidity across various assets and reduces the impact on token prices. This feature sets BalancerV2 apart from its competitors by providing users with enhanced trading capabilities.
Furthermore, BalancerV2 offers a high degree of decentralization and security. Its smart contracts are audited and undergo rigorous testing, ensuring that user funds are protected. Moreover, BalancerV2 operates on the Ethereum blockchain, benefitting from the network's high level of security and immutability.
While BalancerV2 has several advantages, it's important to note that there are other DeFi platforms such as Uniswap and SushiSwap that also offer similar functionalities. The choice between these platforms ultimately depends on individual preferences, trading strategies, and specific requirements.
BalancerV2 is a decentralized exchange protocol built on the Ethereum blockchain. It operates on the concept of automated portfolio management and offers users the ability to create and manage liquidity pools with multiple tokens.
Underneath the hood, BalancerV2 utilizes smart contracts to enable the creation of programmable liquidity pools. These pools consist of a combination of different tokens, with each token representing a different weight or percentage of the overall pool. This approach allows for the creation of customizable portfolios that can hold multiple tokens in varying ratios.
The protocol calculates and maintains the value of each token in the pool using an automated market maker (AMM) algorithm. This algorithm ensures that the token weights in the pool stay in balance according to the predefined ratios set by the pool creator. When a user performs a trade within a BalancerV2 pool, the AMM algorithm automatically adjusts the token ratios to reflect the new trade, thereby maintaining the desired balance.
BalancerV2 operates on the Ethereum blockchain, leveraging its security and decentralized nature. By utilizing smart contracts, users can interact directly with the protocol without the need for intermediaries.
Overall, BalancerV2 offers users a flexible and efficient way to manage their token portfolios. Its automated portfolio management and AMM algorithm provide liquidity and price stability, making it an attractive choice for traders and liquidity providers within the decentralized finance (DeFi) ecosystem.
DIA fetches trade data from BalancerV2, a decentralized exchange (DEX), using a specific process tailored for DeFi and NFT exchanges.
When collecting data from centralized exchanges like Coinbase, Kraken, and Binance, DIA utilizes scrappers that directly access the exchange databases using Rest APIs or WebSocket APIs. These scrappers record all trades for each asset pair and employ different data collection frequencies based on the exchange, ranging from 1 to 7 seconds. This approach ensures that DIA retrieves trading data as close to the source as possible, enhancing data precision.
In the case of decentralized exchanges (DEXs), DIA retrieves trading data directly from the blockchain itself. By subscribing to swap events in liquidity pools, DIA can access data from various blockchains. This approach guarantees accuracy and eliminates the reliance on unreliable bids and offer data. Examples of decentralized exchange sources that DIA integrates with include Uniswap, curve.finance, and PancakeSwap.
For NFT marketplaces, DIA captures live trading data from integrated marketplaces' smart contracts. It retrieves data at intervals ranging from 20 seconds to 1 minute, covering all real-time NFT transactions. By doing so, DIA ensures precise and comprehensive data from the broader NFT market. Some notable NFT integrated exchange sources for DIA include Blur, X2Y2, OpenSea, and TofuNFT.
In summary, DIA employs a comprehensive data management strategy that encompasses different methods of data collection for DeFi and NFT exchanges. This approach allows DIA to provide highly accurate and customizable price feeds for blockchain-based applications.
DIA utilizes a two-step process to compute trade data from BalancerV2 for building price feed oracles. The process differs depending on whether we are referring to a DeFi exchange or an NFT exchange.
For DeFi exchanges, the first step is data cleaning and outlier detection. This ensures that trades with prices deviating from the current market price are excluded. Outliers can be caused by market manipulation, errors, or flash crashes. DIA applies an Interquartile Range (IR) filter to remove data points and sets that lie outside an acceptable range relative to the interquartile range. Only trades falling into the "middle" quartiles move forward for further processing.
In the second step, DIA applies price determination methodologies to compute the final price. One methodology is the Volume Weighted Average Price (VWAP), which takes into account the different volumes of trades. All trades from the queried time range are collected and weighted by their volume. The moving average with interquartile range filter (MAIR) is another methodology where trades collected in the queried time range are ordered by timestamp. For each second, a block is created, trades are put into it, and a weighted average price is taken to arrive at the final price.
For NFT exchanges, the approach is different. The process involves data cleansing filters to exclude market outliers and manipulation techniques. Then, a pricing methodology is applied to determine the final price point. The simplest methodology is the Floor Price, which provides the lowest sale price of an NFT collection recorded on the blockchain during a given time window. DIA also offers advanced methodologies such as the Moving Average of Floor Price, which returns the moving average of a collection's floor price. Customizable parameters, like the length of the average and the size of the floor window, provide flexibility for specific use cases.
By implementing these methodologies and filters, DIA aims to provide market-representative prices while mitigating market manipulations and outliers.
Instead of distributing pre-calculated data feeds, DIA covers the whole data journey from individual trade collection, and computation to the last mile of the feed delivery.