# Types of price feeds

{% hint style="info" %}
[**Book an audit with Zokyo**](https://www.zokyo.io/)
{% endhint %}

#### Introduction

In the decentralized financial (DeFi) space, the accuracy and reliability of price feeds are paramount. They determine the effectiveness of many financial products, from loans to synthetic assets. Given their centrality, understanding the nuances of different price feed systems is crucial. In this article, we'll delve into the two predominant types: Chainlink price feeds and price feeds sourced from decentralized exchanges (DEXs) and liquidity pools.

\
**What are Price Feeds?**

In essence, a price feed is a continuous stream of market price data for assets, provided by oracles. In the DeFi world, they are used by smart contracts to determine asset values in real-time, allowing for immediate and automated responses to market changes.

#### Chainlink Price Feeds

**How it Works:**

* **Decentralization:** Chainlink uses multiple independent nodes to retrieve data from multiple sources. These data points are then aggregated to form a single price data point, which is fed into smart contracts.
* **Data Quality:** Chainlink sources its data from premium data aggregators, ensuring high-quality, accurate, and timely price information.
* **Cryptographic Security:** Chainlink nodes fetch data in a cryptographically secure manner, ensuring the integrity of data at all times.

**Pros:**

* **Reliability:** Multiple nodes mean no single point of failure.
* **Accuracy:** The use of multiple premium sources reduces the chances of inaccurate data.
* **Security:** Chainlink's decentralized nature ensures it remains resistant to single-point attacks.

**Cons:**

* **Cost:** Utilizing Chainlink can be more expensive than other options because of its decentralized nature and premium data sources.

#### DEXs and Liquidity Pools as Price Feeds

**How it Works:**

* **On-chain Data:** DEXs, especially those that utilize Automated Market Makers (AMM), have their price data on-chain. The price is derived from the ratio of assets in a liquidity pool.
* **Real-time Updates:** As trades occur, assets' ratios in the pools shift, and the prices are updated in real-time.

**Pros:**

* **Tamper-resistant:** Prices are derived from on-chain data, making them less susceptible to external manipulation.
* **Easy Integration:** For DeFi platforms already built on a specific blockchain, integrating on-chain price feeds can be straightforward.
* **Transparency:** All trades and pool ratios are visible on-chain, ensuring full transparency.

**Cons:**

* **Impermanent Loss:** Liquidity providers can face impermanent loss, where they might end up with fewer funds than if they had just held their assets.
* **Potential for Manipulation:** While on-chain data is transparent, it's not immune to manipulation. 'Whale' trades or coordinated actions can artificially skew the price temporarily.
* **Less Diverse Data:** These price feeds are based on the trades within one platform, potentially making them less diverse than aggregated feeds.

#### Comparing the Two:

1. **Reliability:** Chainlink's multi-node, multi-source approach can be seen as more reliable, but DEXs offer the reliability of on-chain data.
2. **Decentralization:** Both offer decentralized solutions, but in different manners. Chainlink's decentralization is in its nodes and data sources, while DEXs offer decentralization through their liquidity pools.
3. **Cost:** Chainlink can be costlier because of its structure and data sourcing. DEX-based solutions might be more economical but come with other trade-offs.

#### Conclusion

The DeFi landscape is still evolving, and the debate over the most effective price feed mechanism remains open. Chainlink offers a robust, decentralized, and highly reliable system, making it a favorite for many projects. On the other hand, DEXs and liquidity pools provide a transparent and on-chain alternative that aligns with the ethos of decentralization.

Choosing between the two boils down to a project's specific requirements and its risk tolerance. But regardless of the choice, the importance of accurate and reliable price feeds in the blossoming world of DeFi cannot be overstated.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://zokyo-auditing-tutorials.gitbook.io/zokyo-tutorials/tutorial-15-oracles/types-of-price-feeds.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
