abi-decoder: Function and event signatures decoded
- defillama.abi_decoder.get_contract_signature_abi(chain: str, address: str, func_sign: List, events_sign: Optional[List] = None) Dict[str, Dict[str, any]]
Returns the verbose Application Binary Interface for a function or event signature for a particular contract.
Endpoint: GET /fetch/contract/{chain}/{address}
- Parameters:
chain (str) – Chain the smart contract is located on. Can be either ‘arbitrum’, ‘avalanche’, ‘bsc’, ‘celo’, ‘ethereum’, ‘fantom’, ‘optimism’, ‘polygon’, ‘tron’, ‘xdai’, ‘heco’
address (str) – Address of the smart contract
func_sign (List) – List of function signatures from the first 4 bytes of the Keccak-256 hash
events_sign (List) – List of event signatures
- Returns:
Requested data
- Return type:
Dict[str, Dict[str, any]]
- defillama.abi_decoder.get_signature_abi(func_sign: List, events_sign: Optional[List] = None) Dict[str, Dict[str, any]]
Returns the Application Binary Interface for a function or event signature.
Endpoint: GET /fetch/signature
- Parameters:
func_sign (List) – List of function signatures from the first 4 bytes of the Keccak-256 hash
events_sign (List) – List of event signatures
- Returns:
Requested data
- Return type:
Dict[str, Dict[str, any]]
bridges: Data from DeFiLlama’s bridges dashboard
- defillama.bridges.get_bridge_by_id(id: int) Dict[str, any]
Returns the summary of a bridge volume and volume breakdown by chain with the given ID.
Function returns the following data:
id: Bridge ID
name: Bridge name
displayName: Birdge name as displayed on DeFiLlama
lastHourlyVolume: Bridge volume in the last hour
currentDayVolume: Bridge volume in the current day
lastDailyVolume: Bridge volume in the last day
dayBeforeLastVolume: Bridge volume in the day before last day
weeklyVolume: Bridge volume in the last week
monthlyVolume: Bridge volume in the last month
lastHourlyTxs: Number of deposits and withdrawls in the last hour
currentDayTxs: Number of deposits and withdrawls in the current day
prevDayTxs: Number of deposits and withdrawls in the last day
dayBeforeLastTxs: Number of deposits and withdrawls in the day before last day
weeklyTxs: Number of deposits and withdrawls in the last week
monthlyTxs: Number of deposits and withdrawls in the last month
chainBreakdown: Volume and transaction breakdown by chain
destinationChain: Destination chain of the bridge
Endpoint: GET /bridges/{id}
- Parameters:
id (int) – Bridge ID
- Returns:
Requested data
- Return type:
Dict[str, any]
- defillama.bridges.get_bridges(include_chains: bool = True) List[Dict[str, any]]
Returns a list of bridges with summaries of their recent volumes.
Function returns the following data:
id: Bridge ID
name: Bridge name
displayName: Birdge name as displayed on DeFiLlama
icon: Icon link as on the parent server
volumePrevDay: Bridge volume on previous day
volumePrev2Day: Bridge volume on day before previous day
lastHourlyVolume: Bridge volume in the last hour
currentDayVolume: Bridge volume in the current day
lastDailyVolume: Bridge volume in the last day
dayBeforeLastVolume: Bridge volume in the day before last day
weeklyVolume: Bridge volume in the last week
monthlyVolume: Bridge volume in the last month
chains: Number of chains supported by the bridge
destinationChain: Destination chain of the bridge
Endpoint: GET /bridges
- Parameters:
include_chains (bool) – Whether to include a list of chains. Defaults to True.
include_chains – bool: (Default value = True)
- Returns:
Requested data
- Return type:
List[Dict[str, any]]
- defillama.bridges.get_stats(timestamp: int, chain: str, id: Optional[int] = None) Dict[str, any]
Returns a 24 hour token and address volume breakdown for a bridge.
Function returns the following data:
date: Timestamp of the data
totalTokensDeposited: Dictionary containing token address as the key and the total volume and amount in USD deposited as the value
totalTokensWithdrawn: Dictionary containing token address as the key and the total volume and amount in USD withdrawn as the value
totalAddressesDeposited: Dictionary containing address as the key and the total volume deposited in USD and number of transactions as the value.
Endpoint: GET /bridgestats/{timestamp}/{chain}
- Parameters:
timestamp (int) – UNIX timestamp requested. Data returned will be for the 24hr period starting at 00: 00 UTC that the timestamp lands in.
chain (str) – Chain slug
id (int) – Bridge ID. Defaults to None.
- Returns:
Requested data
- Return type:
Dict[str, any]
- defillama.bridges.get_transactions(id: int, chain: str, address: dict, start: int, end: int, limit: int = 100) List[Dict[str, any]]
Returns all the transactions for a bridge within a date range.
Transactions are only returned that are bridging from the specified source chain and with specified address as from or to.
Function returns the following data:
tx_hash: Transaction hash address
ts: Transaction timestamp
tx_block: Transaction block number
tx_from: Transaction from address
tx_to: Transaction to address
token: Token address
amount: Amount of token transferred
chain: Chain where the transaction occurred
bridge_name: Bridge name that the transaction occurred on
usd_value: USD value of the transaction
sourceChain: Source chain of the token transfer
Endpoint: GET /transactions/{id}
- Parameters:
id (int) – Bridge ID
chain (str) – Chain slug
address (dict) – Chain name and from/to address as key-value pair
start (int) – Start timestamp for date range
end (int) – End timestamp for date range
limit (int) – Number of transactions to return. Defaults to 100.
- Returns:
Requested data
- Return type:
List[Dict[str, any]]
- defillama.bridges.get_volume(chain: str = 'all', id: Optional[int] = None) List[Dict[str, any]]
Returns histirical volume data for a bridge, chain, or bridge on a particular chain.
Function returns the following data:
date: Timestmap of the data
depositUSD: Deposited volume in USD
withdrawUSD: Volume withdrawn in USD
depositTxs: Number of deposits
withdrawTxs: Number of withdrawls
Endpoint: GET /bridgevolume/{chain}
- Parameters:
chain (str) – Chain slug. Defaults to ‘all’ for volumes on all chain.
id (int) – Bridge ID. Defaults to None.
- Returns:
Requested data
- Return type:
List[Dict[str, any]]
coins: General blockchain data used by DeFiLlama
- defillama.coins.get_charts(tokens: List[Dict[str, str]], start: Optional[int] = None, end: int = 1692459425, span: int = 0, period: str = '24h', search_width: str = '3h') Dict[str, Dict[str, any]]
Returns the token prices at regular time intervals.
Function returns a dictionary where the key is the requested token(s) with the contract address and the value is a dictionary containing the following data:
symbol: Trading symbol of the token
confidence: Depth of liquidity of the token indicating quality of price
decimals: Smallest unit of the token that can be traded or transferred
prices: List of dictionaries having the requested timestamps and respective prices
Endpoint: GET /chart/{coins}
- Parameters:
tokens (List[Dict[str, str]]) – List of dictionaries having the tokens and their contract addresses in the form of {chain}: {address}. Can also use ‘coingecko’: {protocol} for tokens listed on coingecko.
start (int) – UNIX timestamp of the earliest data point requested. Defaults to None.
end (int) – UNIX timestamp of the latest data point requested. Defaults to the current timestamp.
span (int) – Number of data points returned. Defaults to 0.
period (str) – Duration between data points. Defaults to ‘24h’.
search_width (str) – Time period on either side to find price data. Follows regular chart notion where W = Week, D = day, H = hour, M = minute (not case sensitive). Defaults to ‘6h’.
- Returns:
Requested data
- Return type:
Dict[str, Dict[str, any]]
- defillama.coins.get_current_prices(tokens: List[Dict[str, str]], search_width: str = '6h') Dict[str, Dict[str, any]]
Returns current prices of tokens using their contract addresses.
Function returns a dictionary where the key is the requested token(s) with the contract address and the value is a dictionary containing the following data:
price: Current price of the token
symbol: Trading symbol of the token
timestamp: Timestamp of the current price
confidence: Depth of liquidity of the token indicating quality of price
Endpoint: GET /prices/current/{coins}
- Parameters:
tokens (List[Dict[str, str]]) – List of dictionaries having the tokens and their contract addresses in the form of {chain}: {address}. Can also use ‘coingecko’: {protocol} for tokens listed on coingecko.
search_width (str) – Time period on either side to find price data. Follows regular chart notion where W = Week, D = day, H = hour, M = minute (not case sensitive). Defaults to ‘6h’.
- Returns:
Requested data
- Return type:
Dict[str, Dict[str, any]]
- defillama.coins.get_first_prices(tokens: List[Dict[str, str]]) Dict[str, Dict[str, any]]
Returns the earliest timestamp price record for the token.
Function returns a dictionary where the key is the requested token(s) with the contract address and the value is a dictionary containing the following data:
symbol: Trading symbol of the token
price: Earliest recorded price of the token
timestamp: Timestamp of the earliest recorded price of the token
Endpoint: GET /prices/first/{coins}
- Parameters:
tokens (List[Dict[str, str]]) – List of dictionaries having {token}:{address} as the key-value pairs. Can also use ‘coingecko’: {protocol} for tokens listed on coingecko.
- Returns:
Requested data
- Return type:
Dict[str, Dict[str, any]]
- defillama.coins.get_historical_batch(tokens: Dict[str, List], search_width: str = '6h') Dict[str, Dict[str, any]]
Returns historical prices of tokens at multiple timestamps.
Function returns a dictionary where the key is the requested token(s) with the contract address and the value is a dictionary containing the following data:
symbol: Trading symbol of the token
prices: List of dictionaries having the requested timestamps, prices and confidence of the token
Endpoint: GET /batchHistorical
- Parameters:
tokens (Dict[str, List]) – List of dictionaries having the tokens and their contract addresses in the form of {chain}: {address}. Can also use ‘coingecko’: {protocol} for tokens listed on coingecko.
search_width (str) – Time period on either side to find price data. Follows regular chart notion where W = Week, D = day, H = hour, M = minute (not case sensitive). Defaults to ‘6h’.
- Returns:
Requested data
- Return type:
Dict[str, Dict[str, any]]
- defillama.coins.get_historical_prices(tokens: List[Dict[str, str]], timestamp: int = 1692459425, search_width: str = '6h') Dict[str, Dict[str, any]]
Returns historical prices of tokens using their contract addresses.
Function returns a dictionary where the key is the requested token(s) with the contract address and the value is a dictionary containing the following data:
price: Historical price of the token
symbol: Trading symbol of the token
timestamp: Timestamp of the historical price
confidence: Depth of liquidity of the token indicating quality of price
Endpoint: GET /prices/historical/{timestamp}/{coins}
- Parameters:
tokens (List[Dict[str, str]]) – List of dictionaries having the tokens and their contract addresses in the form of {chain}: {address}. Can also use ‘coingecko’: {protocol} for tokens listed on coingecko.
timestamp (int) – UNIX timestamp when the historical price is requested. Defaults to the current timestamp.
search_width (str) – Time period on either side to find price data. Follows regular chart notion where W = Week, D = day, H = hour, M = minute (not case sensitive). Defaults to ‘6h’.
- Returns:
Requested data
- Return type:
Dict[str, Dict[str, any]]
- defillama.coins.get_nearest_block(chain: str, timestamp: int) Dict[str, int]
Returns the nearest block to the timestamp.
Function runs a binary search over a blockchain’s blocks to get the closest one to a timestamp. Every time this is run new data is added to DeFiLlama’s database, so each query permanently speeds up future queries. The height and the timestamp of the block are returned.
Endpoint: GET /block/{chain}/{timestamp}
- Parameters:
chain (str) – Chain slug
timestamp (int) – Timestamp of the block
- Returns:
Requested data
- Return type:
Dict[str, int]
- defillama.coins.get_percentage(tokens: List[Dict[str, str]], timestamp: int, look_forward: bool = False, period: str = '24h') Dict[str, any]
Returns the percentage change of the token prices over time.
Function returns a dictionary having {tokens}:{percentage change} as the key-value pairs.
Endpoint: GET /percentage/{coins}
- Parameters:
tokens (List[Dict[str, str]]) – List of dictionaries having the tokens and their contract addresses in the form of {chain}: {address}. Can also use ‘coingecko’: {protocol} for tokens listed on coingecko.
timestamp (int) – UNIX timestamp when the historical price is requested. Defaults to the current timestamp.
look_forward (bool) – Whether to request the duration after the provided timestamp. Defaults to False (looking back).
period (str) – Duration between data points. Follows regular chart notion where W = Week, D = day, H = hour, M = minute (not case sensitive). Defaults to ‘24h’.
- Returns:
Requested data
- Return type:
Dict[str, any]
fees and revenue: Data from DeFiLlama’s fees and revenue dashboard
- defillama.fees_revenue.get_overview(exclude_total_data_chart: bool = False, exclude_total_data_chart_breakdown: bool = False, data: str = 'daily', type: str = 'fees', chain: Optional[str] = None) Dict[str, any]
Returns a list of protocols alongwith summaries of their fees and revenue data and fees/revenue historical data.
Chain name is optional and if provided, the function returns the data for the specified chain only.
Function returns the following data:
totalDataChart: List of aggregated chart data with their timestamp
totalDataChartBreakdown: List of aggregated chart data broken down by chains with their timestamp
protocols: List of dictionaries that may contain the following data -
name: Name of the protocol
disabled: Whether the protocol is disabled or not
displayName: Protocol name as displayed on DeFiLlama
module: Name of the protocol as mentioned on adapter API
category: Category to which the protocol belongs
logo: Protocol logo URL
change_1d: Change in the protocol’s fees/revenue in the last 24 hours
change_7d: Change in the protocol’s fees/revenue in the last 7 days
change_1m: Change in the protocol’s fees/revenue in the last 30 days
change_7dover7d: Change in the protocol’s fees/revenue in the last 7 days over the change in the protocol’s fees/revenue in the last 7 days
change_30dover30d: Change in the protocol’s fees/revenue in the last 30 days over the change in the protocol’s fees/revenue in the last 30 days
total24h: Total fees/revenue collected by the protocol in the last 24 hours
total48hto24h: Total fees/revenue collected by the protocol in the last 48 hours to the last 24 hours
total7d: Total fees/revenue collected by the protocol in the last 7 days
total30d: Total fees/revenue collected by the protocol in the last 30 days
total14dto7d: Total fees/revenue collected by the protocol in the last 14 days to the last 7 days
total60dto30d: Total fees/revenue collected by the protocol in the last 60 days to the last 30 days
totalAllTime: Total fees/revenue collected by the protocol since the beginning
breakdown24h: Total fees/revenue collected by the protocol in the last 24 hours broken down by chains
chains: List of chains supported by the protocol
protocolType: Whether its a protocol or a chain
methodologyURL: URL of the methodology used to calculate the fees
methodology: Dictionary containing the methodology used to calculate the fees
parentProtocol: Name of the parent protocol
latestFetchIsOk: Whether the latest fetch was successful or not
dailyRevenue: Daily revenue of the protocol
dailyUserFees: Daily user fees of the protocol
dailyHoldersRevenue: Daily holders revenue of the protocol
dailyCreatorRevenue: Daily creator revenue of the protocol
dailySupplySideRevenue: Daily supply side revenue of the protocol
dailyProtocolRevenue: Daily protocol revenue of the protocol
dailyFees: Daily fees collected by the protocol
totalFees: Totoal fees collected by the protocol
totalUserFees: Total user fees collected by the protocol
totalRevenue: Total revenue collected by the protocol
totalHoldersRevenue: Total holders revenue collected by the protocol
totalCreatorRevenue: Total creator revenue collected by the protocol
allChains: List of all the chains that are tracked on DeFiLlama
total24h: Total fees collected in the last 24 hours
total48hto24h: Total fees collected in the last 48 hours to the
last 24 hours
total7d: Total fees collected in the last 7 days
total14dto7d: Total fees collected in the last 14 days to the last 7 days
total60dto30d: Total fees collected in the last 60 days to the last 30 days
total30d: Total fees collected in the last 30 days
change_1d: Change in the total fees in the last 24 hours
change_7d: Change in the total fees in the last 7 days
change_1m: Change in the total fees in the last 30 days
change_7dover7d: Change in the total fees in the last 7 days over the
change in the total fees in the last 7 days
change_30dover30d: Change in the total fees in the last 30 days over the
change in the total fees in the last 30 days
breakdown24h: Total fees collected in the last 24 hours broken down by chains
dailyRevenue: Daily revenue collected by all the protocols
dailyUserFees: Daily user fees collected by all the protocols
dailyHoldersRevenue: Daily holders revenue collected by all the protocols
dailyCreatorRevenue: Daily creator revenue collected by all the protocols
dailySupplySideRevenue: Daily supply side revenue collected by all the protocols
dailyProtocolRevenue: Daily protocol revenue collected by all the protocols
Endpoints: GET /overview/fees, GET /overview/fees/{chain}
- Parameters:
exclude_total_data_chart (bool) – To exclude aggregated chart from response. Defaults to False.
exclude_total_data_chart_breakdown (bool) – To exclude broken down chart from response. Defaults to False.
data (str) – Request ‘daily’ or ‘total’ data. Defaults to ‘daily’.
type (str) – Request ‘fees’ or ‘revenue’ data. Defaults to ‘fees’.
chain (str) – Chain slug. Defaults to None.
- Returns:
Requested data
- Return type:
Dict[str, any]
- defillama.fees_revenue.get_summary(protocol: str, data: str = 'daily', type: str = 'fees') Dict[str, any]
Returns a summary of the fees/revenue collected by a protocol with historical data.
Function may return the following data:
id: Protocol ID
name: Protocol name
url: Protocol URL
description: Protocol description
logo: Protocol logo URL
chains: List of chains supported by the protocol
gecko_id: CoinGecko ID of the protocol
cmcId: CoinMarketCap ID of the protocol
twitter: Twitter handle of the protocol
governanceID: Governance ID of the protocol
displayName: Protocol name as displayed on DeFiLlama
total24h: Total fees/revenue collected by the protocol in the last 24 hours
totalAllTime: Total fees/revenue collected by the protocol since the beginning
latestFetchIsOk: Whether the latest fetch was successful or not
disabled: Whether the protocol is disabled or not
change_1d: Change in the total fees/revenue in the last 24 hours
methodologyURL: URL of the methodology used to calculate the fees
module: Name of the protocol as mentioned on adapter API
totalDataChart: List of aggregated chart data with their timestamp. This data is only available for total data
totalDataChartBreakdown: List of aggregated chart data broken down by chains with their timestamp. This data is only available for total data childProtocols: Protocols derived from this protocol
Endpoint: GET /summary/fees/{protocol}
- Parameters:
protocol (str) – Protocol slug
data (str) – Request ‘daily’ or ‘total’ data. Defaults to ‘daily’.
type (str) – Request ‘fees’ or ‘revenue’ data. Defaults to ‘fees’.
- Returns:
Requested data
- Return type:
Dict[str, any]
stablecoins: Data from DeFiLlama’s stablecoins dashboard
- defillama.stablecoins.get_chains() List[Dict[str, any]]
Returns current market cap sum of all stablecoins on each chain.
Function requires no arguments and returns the following data:
gecko_id: CoinGecko ID of the stablecoin
totalCirculatingUSD: Market cap of all circulating pegged currencies in USD
tokenSymbol: Trading symbol of the stablecoin
name: Name of the chain on which the stablecoin is available
Endpoint: GET /stablecoinchains
- Returns:
Requested data
- Return type:
List[Dict[str, any]]
- defillama.stablecoins.get_charts(type: str = 'all', chain: Optional[str] = None, stablecoin: Optional[int] = None) List[Dict[str, any]]
Returns historical market cap sum of all stablecoins or on a given chain.
Function returns the following data:
date: Timestamp of the data
totalCirculating: Market cap of all circulating pegged currencies
totalUnreleased: Market cap of all unreleased circulating pegged currencies
totalCirculatingUSD: Market cap of all circulating pegged currencies in USD
totalMintedUSD: Market cap of all minted pegged currencies in USD
totalBridgedToUSD: Market cap of all pegged currencies bridged to USD
Endpoints: GET /stablecoincharts/all, GET /stablecoincharts/{chain}
- Parameters:
type (str) – Request data for ‘all’ stablecoins or those in ‘chain’. Defaults to “all”.
chain (str) – Chain slug. Requires type argument to be ‘chain’. Defaults to None.
stablecoin (int) – Stablecoin ID. Requires type argument to be ‘chain’. Defaults to None.
- Returns:
Requested data
- Return type:
List[Dict[str, any]]
- defillama.stablecoins.get_distribution(stablecoin: int) Dict[str, any]
Returns the historical market cap and historical chain distribution of a stablecoin.
Function returns the following data:
id: Stablecoin ID as per DeFiLlama
name: Name of the stablecoin
address: Stablecoin address
symbol: Trading symbol of the stablecoin
url: Link to the stablecoin’s website
description: Short summary describing the stablecoin
mintRedeemDescription: Short description describing the minting and exchange of the stablecoin
onCoinGecko: Whether the stablecoin is listed on CoinGecko
gecko_id: CoinGecko ID of the stablecoin
cmcId: CoinMarketCap ID of the stablecoin
pegType: Currency pegged to
pegMechanism: Type of currency pegged (fiat or crypto backed)
priceSource: Major source of price data
auditLinks: List of URL to the audit reports
twitter: Twitter link of the stablecoin
wiki: DeFiLlama wiki page for the stablecoin
chainBalances: Dictionary containing the chains on which the stablecoin is available alongwith their ‘tokens’, ‘circulating’, ‘minted’, ‘unreleased’ and ‘bridgedTo’ amounts.
Endpoint: GET /stablecoin/{asset}
- Parameters:
stablecoin (int) – Stablecoin ID.
- Returns:
Requested data
- Return type:
Dict[str, any]
- defillama.stablecoins.get_prices() List[Dict[str, any]]
Returns historical prices of all stablecoins.
Function requires no arguments and returns the following data:
date: Timestamp of the data
prices: Dictionary containing the stablecoin name and its price in USD
Endpoint: GET /stablecoinprices
- Returns:
Requested data
- Return type:
List[Dict[str, any]]
- defillama.stablecoins.get_stablecoins(include_prices: bool = True) List[Dict[str, any]]
Returns a list of all stablecoins alongwith their circulating amounts.
Function returns the following data:
id: Stablecoin ID as per DeFiLlama
name: Name of the stablecoin
symbol: Trading symbol of the stablecoin
gecko_id: CoinGecko ID of the stablecoin
pegType: Currency pegged to
pegMechanism: Type of currency pegged (fiat or crypto backed)
priceSource: Major source of price data
circulating: Current circulating amount in pegged currency
circulatingPrevDay: Circulating amount previous day in pegged currency
circulatingPrevWeek: Circulating amount previous week in pegged currency
circulatingPrevMonth: Circulating amount previous month in pegged currency
chainCirculating: Chains circulating the stablecoin alongwith their ‘circulating’, ‘circulatingPrevDay’, ‘circulatingPrevWeek’ and ‘circulatingPrevMonth’.
chains: List of chains on which the stablecoin is available
Endpoint: GET /stablecoins
- Parameters:
include_prices (bool) – whether to include current stablecoin prices. Defaults to True.
- Returns:
Requested data
- Return type:
List[Dict[str, any]]
tvl: Retrieve TVL data
- defillama.tvl.get_chains() List[Dict]
Returns basic information about all chains.
Function returns the following data for each chain:
gecko_id: CoinGecko ID of the chain
tvl: Current TVL in the chain
tokenSymbol: Chain symbol (e.g. ETH)
cmcId: CoinMarketCap ID of the chain
name: Given name of the chain
chainId: DeFillama ID of the chain
Endpoint: GET /chains
- Returns:
Requested data
- Return type:
List[Dict]
- defillama.tvl.get_charts(chain: Optional[str] = None) List[Dict]
Returns historical TVL of all or a specified chain.
Passing a chain is optional as historical TVL for all chains is returned by default.
Function returns the following data:
date: Date of the TVL
tvl: Historical TVL
Endpoints: GET /charts, GET /charts/{chain}
- Parameters:
chain (str) – Chain slug. Defaults to None.
- Returns:
Requested data
- Return type:
List[Dict]
- defillama.tvl.get_historical_chains_tvl(chain: Optional[str] = None) List[Dict]
Returns historical TVL (excludes liquid staking and double counted TVL) for all or a specified chain.
Passing a chain is optional as historical TVL (excluding liquid staking and double counted TVL) for all chains is returned by default.
Function returns the following data:
date: Date of the TVL
tvl: Historical TVL (excluding liquid staking and double counted TVL)
Endpoints: GET /historicalChainTVL, GET /historicalChainTVL/{chain}
- Parameters:
chain (str) – Chain slug. Defaults to None.
- Returns:
Requested data
- Return type:
List[Dict]
- defillama.tvl.get_protocol_tvl(protocol: str) int
Returns the current TVL of a specified protocol.
Endpoint: GET /tvl/{protocol}
- Parameters:
protocol (str) – Protocol slug
- Returns:
Current TVL of the specified protocol
- Return type:
int
- defillama.tvl.get_protocols(protocol: Optional[str] = None) Union[List[Dict], Dict]
Returns basic protocol data with their total TVL and TVL in each chain.
When no protocol is specified, function returns basic data for all protocols alongwith their TVL. When a protocol is specified, function returns basic data and additional protocol specific data.
Function may return the following data when no protocol is specified:
id: DeFiLlama ID of the protocol
name: Registered protocol name
address: Protocol address
symbol: Protocol symbol
url: URL of the protocol website
description: Summary of the prtocol
chain: Chain the protocol is deployed on
logo: URL to the protocol logo
audits: Audits done on the protocol
audit_note: Audit note for the protocol
gecko_id: CoinGecko ID of the protocol
cmcId: CoinMarketCap ID of the chain
category: Type of the protocol
chains: List of chains where the protocol is deployed.
module: ???
twitter: Twitter username associated with the protocol
forkedFrom: Parent protocol of the protocol
oracles: List of oracles used by the protocol
listedAt: Timestamp when the protocol was listed
slug: Protocol slug name
tvl: Current TVL in the protocol
chainTvls: Current TVL in each chain on which the protocol is deployed. Note that this property changes to currentChainTvls when a chain is specified.
change_1h: Change in TVL within 1 hour
change_1d: Change in TVL within 1 day
change_7d: Change in TVL within 7 days
mcap: Current market cap of the protocol
If a protocol is specified the following data maybe returned:
audit_links: Links to the audits done on the protocol
treasury: Treasury address of the protocol
openSource: Whether the protocol is open source or not (True/False)
governanceID: Snapshot of the ENS address of the protocol
currentChainTvls: Current TVL in each deployed chain of the deployed.
chainTvls: Historical TVL in each chain on which the protocol is deployed
tokens: History of TVL of associated tokens
tvl: History of TVL of the protocol
isParentProtocol: Whether the protocol is derived or not (True/False)
metrics: Historical data of the protocol’s metrics
raises: Historical data of the protocol’s funding rounds
tokenBreakdowns: Token TVL history
otherProtocols: List of protocols derived from the protocol
hallmarks: Hitory of the protocol’s hallmarks
Endpoints: GET /protocols, GET /protocol/{protocol}
- Parameters:
protocol (str) – Protocol slug. Defaults to None.
- Returns:
Requested data
- Return type:
List[Dict] | Dict
volumes: Data from DeFiLlama’s volumes dashboards
- defillama.volumes.get_dex_overview(exclude_total_data_chart: bool = False, exclude_total_data_chart_breakdown: bool = False, data: str = 'daily', chain: Optional[str] = None) Dict[str, any]
Returns all dexs with their volume summaries and history for all or specified chain.
Function may return the following data:
totalDataChart: List of aggregated chart data with their timestamp
totalDataChartBreakdown: List of aggregated chart data broken down by chains with their timestamp
protocols: List of dictionaries that may contain the following data -
name: Name of the protocol
disabled: Whether the protocol is disabled or not
displayName: Protocol name as displayed on DeFiLlama
module: Name of the protocol as mentioned on adapter API
category: Category to which the protocol belongs
logo: Protocol logo URL
change_1d: Change in the protocol’s volume in the last 24 hours
change_7d: Change in the protocol’s volume in the last 7 days
change_1m: Change in the protocol’s volume in the last 30 days
change_7dover7d: Change in the protocol’s volume in the last 7 days over the change in the protocol’s fees in the last 7 days
change_30dover30d: Change in the protocol’s volume in the last 30 days over the change in the protocol’s volume in the last 30 days
total24h: Total volume collected by the protocol in the last 24 hours
total48hto24h: Total volume collected by the protocol in the last 48 hours to the last 24 hours
total7d: Total volume collected by the protocol in the last 7 days
total30d: Total volume collected by the protocol in the last 30 days
total14dto7d: Total volume collected by the protocol in the last 14 days to the last 7 days
total60dto30d: Total volume collected by the protocol in the last 60 days to the last 30 days
totalAllTime: Total volume collected by the protocol since the beginning
breakdown24h: Total volume collected by the protocol in the last 24 hours broken down by chains
chains: List of chains supported by the protocol
protocolType: Whether its a protocol or a chain
methodologyURL: URL of the methodology used to calculate the fees
methodology: Dictionary containing the methodology used to calculate the fees
latestFetchIsOk: Whether the latest fetch was successful or not
dailyVolume: Daily volume of the protocol
totalVolume: Total volume of the protocol
Endpoint: GET /overview/dexs, GET /overview/dexs/{chain}
- Parameters:
exclude_total_data_chart (bool) – To exclude aggregated chart from response. Defaults to False.
exclude_total_data_chart_breakdown (bool) – To exclude broken down chart from response. Defaults to False.
data (str) – Request ‘daily’ or ‘total’ volume data. Defaults to ‘daily’.
chain (str) – Chain slug. Defaults to None.
- Returns:
Requested data
- Return type:
Dict[str, any]
- defillama.volumes.get_dex_summary(protocol: str, exclude_total_data_chart: bool = False, exclude_total_data_chart_breakdown: bool = False, data: str = 'daily') Dict[str, any]
Returns summary of a dex volume with historical data.
Function may return the following data:
name: Name of the protocol
displayName: Protocol name as displayed on DeFiLlama
disabled: Whether the protocol is disabled or not
logo: URL to the logo of the protocol
address: Protocol address on the blockchain
url: Protocol logo URL
description: Protocol description
audits: List of audits
category: Category to which the protocol belongs
twitter: Twitter handle of the protocol
audit_links: List of audit links
forkedFrom: Parent protocol from which this protocol was forked
gecko_id: CoinGecko ID of the protocol
totalDataChart: List of aggregated chart data with their timestamp
totalDataChartBreakdown: List of aggregated chart data broken down by chains with their timestamp
total24h: Total volume collected by the protocol in the last 24 hours
total48hto24h: Total volume collected by the protocol in the last 48 hours to the last 24 hours
total14dto7d: Total volume collected by the protocol in the last 14 days to the last 7 days
totalAllTime: Total volume collected by the protocol since the beginning
change_1d: Change in the protocol’s volume in the last 24 hours
module: Name of the protocol as mentioned on adapter API
protocolType: Whether its a protocol or a chain
chains: List of chains supported by the protocol
methodologyURL: URL of the methodology used to calculate the fees
latestFetchIsOk: Whether the latest fetch was successful or not
childProtocols: Protocols derived from this protocol
Endpoint: GET /summary/dexs/{protocol}
- Parameters:
protocol (str) – Protocol slug
exclude_total_data_chart (bool) – To exclude aggregated chart from response. Defaults to False.
exclude_total_data_chart_breakdown (bool) – To exclude broken down chart from response. Defaults to False.
data (str) – Request ‘daily’ or ‘total’ volume data. Defaults to ‘daily’.
- Returns:
Requested data
- Return type:
Dict[str, any]
- defillama.volumes.get_options_overview(exclude_total_data_chart: bool = False, exclude_total_data_chart_breakdown: bool = False, data: str = 'daily', type: str = 'premium', chain: Optional[str] = None) Dict[str, any]
Returns all options dexs with their volume summaries and history for all or specified chain.
Function may return the following data:
totalDataChart: List of aggregated chart data with their timestamp
totalDataChartBreakdown: List of aggregated chart data broken down by chains with their timestamp
protocols: List of dictionaries that may contain the following data -
name: Name of the protocol
disabled: Whether the protocol is disabled or not
displayName: Protocol name as displayed on DeFiLlama
module: Name of the protocol as mentioned on adapter API
category: Category to which the protocol belongs
logo: Protocol logo URL
change_1d: Change in the protocol’s volume in the last 24 hours
change_7d: Change in the protocol’s volume in the last 7 days
change_1m: Change in the protocol’s volume in the last 30 days
change_7dover7d: Change in the protocol’s volume in the last 7 days over the change in the protocol’s fees in the last 7 days
change_30dover30d: Change in the protocol’s volume in the last 30 days over the change in the protocol’s volume in the last 30 days
total24h: Total volume collected by the protocol in the last 24 hours
total48hto24h: Total volume collected by the protocol in the last 48 hours to the last 24 hours
total7d: Total volume collected by the protocol in the last 7 days
total30d: Total volume collected by the protocol in the last 30 days
total14dto7d: Total volume collected by the protocol in the last 14 days to the last 7 days
total60dto30d: Total volume collected by the protocol in the last 60 days to the last 30 days
totalAllTime: Total volume collected by the protocol since the beginning
breakdown24h: Total volume collected by the protocol in the last 24 hours broken down by chains
chains: List of chains supported by the protocol
protocolType: Whether its a protocol or a chain
methodologyURL: URL of the methodology used to calculate the fees
methodology: Dictionary containing the methodology used to calculate the fees
latestFetchIsOk: Whether the latest fetch was successful or not
dailyPremiumVolume: Daily premium volume of the protocol
totalNotionalVolume: Total notional volume of the protocol
Endpoint: GET /overview/options, GET /overview/options/{chain}
- Parameters:
exclude_total_data_chart (bool) – To exclude aggregated chart from response. Defaults to False.
exclude_total_data_chart_breakdown (bool) – To exclude broken down chart from response. Defaults to False.
data (str) – Request ‘daily’ or ‘total’ volume data. Defaults to ‘daily’.
type (str) – Request ‘premium’ or ‘notional’ volume data. Defaults to ‘premium’.
chain (str) – Chain slug. Defaults to None.
- Returns:
Requested data
- Return type:
Dict[str, any]
- defillama.volumes.get_options_summary(protocol: str, data: str = 'daily', type: str = 'premium') Dict[str, any]
Returns summary of an options dex volume with historical data.
Function may return the following data:
name: Name of the protocol
displayName: Protocol name as displayed on DeFiLlama
disabled: Whether the protocol is disabled or not
logo: ‘https://icons.llama.fi/0x.png’,
address: Protocol address on the blockchain
url: Protocol logo URL
description: Protocol description
audits: List of audits
category: Category to which the protocol belongs
twitter: Twitter handle of the protocol
audit_links: List of audit links
gecko_id: CoinGecko ID of the protocol
totalDataChart: List of aggregated chart data with their timestamp
totalDataChartBreakdown: List of aggregated chart data broken down by chains with their timestamp
total24h: Total volume collected by the protocol in the last 24 hours
total48hto24h: Total volume collected by the protocol in the last 48 hours to the last 24 hours
total14dto7d: Total volume collected by the protocol in the last 14 days to the last 7 days
totalAllTime: Total volume collected by the protocol since the beginning
change_1d: Change in the protocol’s volume in the last 24 hours
module: Name of the protocol as mentioned on adapter API
protocolType: Whether its a protocol or a chain
chains: List of chains supported by the protocol
methodologyURL: URL of the methodology used to calculate the fees
latestFetchIsOk: Whether the latest fetch was successful or not
childProtocols: Protocols derived from this protocol
Endpoint: GET /summary/options/{protocol}
- Parameters:
protocol (str) – Protocol name
data (str) – Request ‘daily’ or ‘total’ volume data. Defaults to ‘daily’.
type (str) – Request ‘premium’ or ‘notional’ volume data. Defaults to ‘premium’.
- Returns:
Requested data
- Return type:
Dict[str, any]
yields: Data from DeFiLlama’s yields/APY dashboard
- defillama.yields.get_pool_chart(pool: str) List[Dict[str, any]]
Returns the historical APY and TVL data for a pool.
Function returns the following data:
timestamp: Timestmap of the data
tvlUsd: Current TVL in USD in the pool
apy: Annual Percent Yield of the pool
apyBase: Annual Percent Yield from pool fees/supplying in %
apyReward: Annual Percent Yield from pool LM rewards in %
il7d: Impermanent Loss within 7 days
apyBase7d: Annual Percent Yield from pool fees/supplying in % within 7 days
Endpoint: GET /chart/{pool}
- Parameters:
pool (str) – Pool ID.
- Returns:
Requested data
- Return type:
List[Dict[str, any]]
- defillama.yields.get_pools() List[Dict[str, any]]
Returns the latest data for all pools.
Function returns the following data:
chain: Name of the chain the pool is on
project: Protocol name
symbol: Symbol of the pool
tvlUsd: Current TVL in USD in the pool
apyBase: Annual Percent Yield from pool fees/supplying in %
apyReward: Annual Percent Yield from pool LM rewards in %
apy: Current Annual Percent Yield of the pool
rewardTokens: Reward token addresses
pool: Pool ID
apyPct1D: % change in Annual Percent Yield within 24 hours
apyPct7D: % change in Annual Percent Yield within 7 days
apyPct30D: % change in Annual Percent Yield within 30 days
stablecoin: Stablecoins in the pool
ilRisk: Whether Impermanent Loss Risk is associated with the pool
exposure: ‘Single’ or ‘Multi’ token exposure to the pool
predictions: Dictionary contating the ‘predictedClass’, ‘predictedProbability’ and ‘binnedConfidence’ of the pool
poolMeta: Wrapped tokens in the pool
mu: Mean APY of the pool
sigma: Standard Deviation of the APY of the pool
count: Number of tokens in the pool
outlier: ???
underlyingTokens: Underlying token addresses from a pool
il7d: Impermanent Loss within 7 days
apyBase7d: Annual Percent Yield from pool fees/supplying in % within 7 days
apyMean30d: Mean Annual Percent Yield of the pool within 30 days
volumeUsd1d: Volume in USD within 24 hours of the tokens in the pool
volumeUsd7d: Volume in USD within 7 days of the tokens in the pool
apyBaseInception: ???
Endpoint: GET /pools
- Returns:
Requested data
- Return type:
List[Dict[str, any]]