Package 'rllama'

Title: Access and Analyze Data from 'DeFiLlama'
Description: Provides an interface to access and analyze data from 'DeFiLlama'<https://defillama.com>. This package simplifies the process of fetching and manipulating 'DeFiLlama' data for further analysis and visualization.
Authors: Alexey Ivanov [aut, cre, cph]
Maintainer: Alexey Ivanov <[email protected]>
License: MIT + file LICENSE
Version: 0.4.4
Built: 2025-02-26 02:58:50 UTC
Source: https://github.com/alextwor/rllama

Help Index


Chain History Data

Description

Fetches historical TVL data for a specified Blockchain in USD. The data is returned as a table sorted by date.

Usage

get_defillama_chain_hist_tvl(name)

Arguments

name

A string representing the unique name (name) of the protocol. This name can be obtained from the result of the get_defillama_chain_tvl function.

Value

A 'data.table' object containing historical TVL data of the specified chain The table includes columns for date, TVL in USD. It is sorted by date.

Examples

# total tvl by date
chain_tvl = get_defillama_chain_hist_tvl( "Ethereum" )
tail( chain_tvl )

Chain TVL Data

Description

This function retrieves TVL data for various chains from a specified API and formats it into a data.table for analysis.

Usage

get_defillama_chain_tvl()

Value

A 'data.table' containing the TVL data with columns: name, symbol, tvl, gecko_id, cmcId, and chainId. The data is sorted by TVL in descending order.

Examples

chain_tvl = get_defillama_chain_tvl()
head( chain_tvl )

Protocol History Data

Description

Fetches historical TVL data for a specified DeFi protocol, including TVL in USD and token amount. The data is returned as a table sorted by date.

Usage

get_defillama_protocol_hist_tvl(slug, by_token = FALSE)

Arguments

slug

A string representing the unique name (slug) of the protocol. This slug can be obtained from the result of the get_defillama_protocol_tvl function.

by_token

A boolean indicating whether to include token-specific data. Defaults to FALSE.

Value

A 'data.table' object containing historical TVL data of the specified protocol. The table includes columns for date, TVL in USD. It is sorted by date.

Examples

# total tvl by date
protocol_tvl = get_defillama_protocol_hist_tvl( "lido" )
tail( protocol_tvl )

# tvl by token
protocol_tvl = get_defillama_protocol_hist_tvl( "lido", by_token = TRUE )
tail( protocol_tvl )

Protocol TVL Data

Description

This function retrieves Total Value Locked (TVL) data for various protocols from a specified API and formats it into a table for analysis.

Usage

get_defillama_protocol_tvl(is_cex_include = F)

Arguments

is_cex_include

Logical; if FALSE (default), data for CEX will be excluded from the results. Set to TRUE to include CEX data.

Value

A 'data.table' containing TVL data with columns: symbol, tvl, slug, name, chain, and category. The data is sorted by TVL in descending order.

Examples

protocol_tvl = get_defillama_protocol_tvl()
head( protocol_tvl )

Stablecoins Data

Description

Retrieves stablecoin data, including details like name, symbol, price, and market cap. The data is returned as a sorted table by market cap.

Usage

get_defillama_stablecoin_data()

Value

A 'data.table' with stablecoin information, sorted by market capitalization.

Examples

stablecoin_data = get_defillama_stablecoin_data()
head( stablecoin_data )

Stablecoins History Data

Description

Retrieves stablecoin data, including details like name, symbol, price, and market cap. The data is returned as a sorted table.

Usage

get_defillama_stablecoin_hist_data(stablecoin_id)

Arguments

stablecoin_id

An integer representing the ID of the stablecoin. This ID can be obtained from the result of the get_defillama_stablecoin_data function.

Value

A 'data.table' object containing historical data of the specified stablecoin. The table is sorted by date.

Examples

stablecoin_hist_data = get_defillama_stablecoin_hist_data( 5 )
head( stablecoin_hist_data )