<100 subscribers
Share Dialog
Share Dialog
In the rapidly evolving world of decentralized finance (DeFi), data visualization is key to understanding protocol growth, adoption, and user behavior.
In this short research piece, I compared the Total Value Locked (TVL) of two leading decentralized exchanges — Uniswap (Ethereum) and PancakeSwap (BNB Chain) — using real-time data from the DeFiLlama API.
This analysis demonstrates how on-chain metrics can reveal competitive trends between ecosystems and help investors or analysts make data-driven conclusions.
For this analysis, I used:
🐍 Python (with requests, pandas, and matplotlib)
📡 DeFiLlama API for protocol TVL data
Query DeFiLlama’s public API endpoints for both protocols.
Extract historical TVL data.
Plot the results to visualize their performance over time.
The process is minimal, open-source, and ideal for quick DeFi data explorations.
Below is the Python script used to fetch and visualize the TVL data.You can run it directly in Google Colab or Jupyter Notebook.
import requests
import pandas as pd
import matplotlib.pyplot as plt
protocol_1 = "uniswap"
protocol_2 = "pancakeswap"
def get_tvl_data(protocol):
url = f"https://api.llama.fi/protocol/{protocol}"
data = requests.get(url).json()
df = pd.DataFrame(data["tvl"])
df["date"] = pd.to_datetime(df["date"], unit="s")
df["protocol"] = data["name"]
return df
tvl1 = get_tvl_data(protocol_1)
tvl2 = get_tvl_data(protocol_2)
merged = pd.concat([tvl1, tvl2])
plt.figure(figsize=(10,6))
for p, d in merged.groupby("protocol"):
plt.plot(d["date"], d["totalLiquidityUSD"], label=p)
plt.title("DeFi TVL Comparison: Uniswap vs PancakeSwap")
plt.xlabel("Date")
plt.ylabel("TVL (USD)")
plt.legend()
plt.grid(True)
plt.tight_layout()
plt.show()
The resulting chart clearly highlights how Uniswap dominates in TVL, maintaining a larger and more stable liquidity base compared to PancakeSwap, which shows more volatility and sharper spikes.
This difference reflects:
Ethereum’s more established liquidity ecosystem
PancakeSwap’s faster but more cyclical activity on BNB Chain
While both DEXes serve massive communities, Uniswap’s TVL remains significantly higher, confirming its role as a leading protocol in decentralized trading.
**Ecosystem Strength:**Uniswap benefits from Ethereum’s composability and deep liquidity pools, while PancakeSwap thrives in a lower-fee, retail-driven environment.
**User Behavior:**PancakeSwap attracts shorter-term capital flows; Uniswap shows more stable, long-term liquidity providers.
**Cross-Chain Future:**Future research could explore how these protocols expand into multichain deployments — e.g., Uniswap on Arbitrum or BNB, PancakeSwap on Ethereum.
This analysis is a simple yet powerful demonstration of how DeFiLlama’s open data can be used to build meaningful on-chain insights.
Even with a few lines of Python, analysts can identify trends in liquidity growth, protocol health, and market sentiment — all key indicators for DeFi decision-making.
Future improvements could include:
Adding volume and fee metrics alongside TVL.
Automating daily data collection with Streamlit dashboards.
Expanding to include more protocols like Curve, Balancer, and SushiSwap.
Marcelo MijlinBusiness graduate specialized in finance and capital markets, passionate about DeFi analytics, on-chain data, and treasury management.Currently building dashboards and research tools to bridge traditional finance and decentralized ecosystems.
📍 Find me on:
In the rapidly evolving world of decentralized finance (DeFi), data visualization is key to understanding protocol growth, adoption, and user behavior.
In this short research piece, I compared the Total Value Locked (TVL) of two leading decentralized exchanges — Uniswap (Ethereum) and PancakeSwap (BNB Chain) — using real-time data from the DeFiLlama API.
This analysis demonstrates how on-chain metrics can reveal competitive trends between ecosystems and help investors or analysts make data-driven conclusions.
For this analysis, I used:
🐍 Python (with requests, pandas, and matplotlib)
📡 DeFiLlama API for protocol TVL data
Query DeFiLlama’s public API endpoints for both protocols.
Extract historical TVL data.
Plot the results to visualize their performance over time.
The process is minimal, open-source, and ideal for quick DeFi data explorations.
Below is the Python script used to fetch and visualize the TVL data.You can run it directly in Google Colab or Jupyter Notebook.
import requests
import pandas as pd
import matplotlib.pyplot as plt
protocol_1 = "uniswap"
protocol_2 = "pancakeswap"
def get_tvl_data(protocol):
url = f"https://api.llama.fi/protocol/{protocol}"
data = requests.get(url).json()
df = pd.DataFrame(data["tvl"])
df["date"] = pd.to_datetime(df["date"], unit="s")
df["protocol"] = data["name"]
return df
tvl1 = get_tvl_data(protocol_1)
tvl2 = get_tvl_data(protocol_2)
merged = pd.concat([tvl1, tvl2])
plt.figure(figsize=(10,6))
for p, d in merged.groupby("protocol"):
plt.plot(d["date"], d["totalLiquidityUSD"], label=p)
plt.title("DeFi TVL Comparison: Uniswap vs PancakeSwap")
plt.xlabel("Date")
plt.ylabel("TVL (USD)")
plt.legend()
plt.grid(True)
plt.tight_layout()
plt.show()
The resulting chart clearly highlights how Uniswap dominates in TVL, maintaining a larger and more stable liquidity base compared to PancakeSwap, which shows more volatility and sharper spikes.
This difference reflects:
Ethereum’s more established liquidity ecosystem
PancakeSwap’s faster but more cyclical activity on BNB Chain
While both DEXes serve massive communities, Uniswap’s TVL remains significantly higher, confirming its role as a leading protocol in decentralized trading.
**Ecosystem Strength:**Uniswap benefits from Ethereum’s composability and deep liquidity pools, while PancakeSwap thrives in a lower-fee, retail-driven environment.
**User Behavior:**PancakeSwap attracts shorter-term capital flows; Uniswap shows more stable, long-term liquidity providers.
**Cross-Chain Future:**Future research could explore how these protocols expand into multichain deployments — e.g., Uniswap on Arbitrum or BNB, PancakeSwap on Ethereum.
This analysis is a simple yet powerful demonstration of how DeFiLlama’s open data can be used to build meaningful on-chain insights.
Even with a few lines of Python, analysts can identify trends in liquidity growth, protocol health, and market sentiment — all key indicators for DeFi decision-making.
Future improvements could include:
Adding volume and fee metrics alongside TVL.
Automating daily data collection with Streamlit dashboards.
Expanding to include more protocols like Curve, Balancer, and SushiSwap.
Marcelo MijlinBusiness graduate specialized in finance and capital markets, passionate about DeFi analytics, on-chain data, and treasury management.Currently building dashboards and research tools to bridge traditional finance and decentralized ecosystems.
📍 Find me on:


No comments yet