Welcome to ETH Wallet Analyzer’s documentation!
Model file
Simple traders dashboard with Streamlit
- class wallet_analyzer_dashboard.Dashboard(initial_wallet_address: str, blockchain: str)
Dashboard class to create a simple traders dashboard with Streamlit.
- get_wallet_data(wallet_address: str) None
Get wallet data and calculate all the metrics
- Parameters:
wallet_address – Wallet address
- Returns:
None
- main() None
Main function to run the dashboard
- Returns:
None
Analysis of a ETH wallet
- class wallet_analyzer_eth.MetricsCalculator(swap_txs_df: DataFrame, txs_df: DataFrame, token_trades_df: DataFrame)
Class for calculating trading metrics
- avg_trade_result(perc: bool = False) float
How big is the average result of a trade (in ETH or %). Only for trades that have both buy&sell transactions
- Parameters:
perc – whether to return the result in % (if False, in ETH)
- Returns:
average result of trade in ETH or %. 100% means you gained 0 ETH
- avg_trade_size() float
How big is the average bet (in ETH)
- Returns:
average buy order size in ETH
- calculate_rolling_ratings() DataFrame
Calculates different types of ratings after every trade
- Returns:
dataframe with the ratings
- calculate_total_values()
Calculate basic values of the ETH/tokens flow
- Returns:
total_eth_in, total_eth_internal_in, total_eth_out, total_eth_buy, total_eth_sell, total_stablecoins_in,
total_stablecoins_out, total_fees_eth, count_tokens_in, count_tokens_out
- cumulated_daily_trading_result() DataFrame
Cumulative daily trading result (total sell-buy)
- Returns:
dataframe with the cumulated daily trading result
- final_trade_result() float
Final trade result based on the self.token_trades, only for tokens that have both buy and sell txs
- Returns:
final trade result in ETH
- first_trade_datetime() datetime
Get the datetime of the first transaction
- Returns:
datetime of the first transaction
- first_tx_datetime() datetime
Get the datetime of the first transaction
- Returns:
datetime of the first transaction
- last_trade_datetime() datetime
Get the datetime of the last trade
- Returns:
datetime of the last trade
- last_tx_datetime() datetime
Get the datetime of the last transaction
- Returns:
datetime of the last transaction
- median_trade_size() float
How big is the median bet (in ETH)
- Returns:
median buy order size in ETH
- snipes_percent() float
How many swaps were snipes (with high gas fee)
- Returns:
percentage of snipe transactions
- total_swaps_number() int
How many swaps were made in total
- Returns:
number of swaps made in total
- traded_tokens_number() int
How many tokens were traded in total
- Returns:
number of tokens traded in total
- trades_per_day() DataFrame
Calculate how many trades were made every day
- Returns:
dataframe with the number of trades per day
- win_ratio_percent() float
How many trades were profitable (in %)
- Returns:
percentage of profitable trades
- class wallet_analyzer_eth.WalletAnalyzer(wallet: str, chain='eth')
Class for analyzing the wallet transactions of a given wallet
- calculate_swap_txs() None
Get the data about the trades from the token transactions df
- Returns:
None
- calculate_tokens_txs(drop_snipes: bool = False, include_other_swap_types: bool = False, drop_in_out_tokens: bool = False) DataFrame
Creates self.token_trades df containing aggregated info about trades per every token
- Parameters:
drop_snipes – whether to drop all transaction of tokens that have snipe transactions
include_other_swap_types – whether to include other swap types (other_buy, other_sell)
drop_in_out_tokens – whether to drop all transaction of tokens that have in/out transactions
- Returns:
Dataframe with aggregated info about trades per every token and trading metrics per token
- change_decimal(value: str, decimal: int, crop: int = 1) float
Change the decimal of the value. Walkaround for the numbers that are too big even for np.int64. Most tokens decimal is 18, this function can change the value to a smaller value by loosing precision.
- Parameters:
value – value to change
decimal – current length of the value
crop – how many last digits to crop
- Returns:
float value with the new decimal
- check_internal_transfers() None
For ETH transfers via contracts
- Returns:
None
- check_snipers(max_allowed_overshoot: float = 1.6) None
Mark the snipe transactions (with high gas price)
- Parameters:
max_allowed_overshoot – Max allowed gas price overshoot (compared to the avg gas price in the selected day)
- Returns:
None
- check_token_transfers() None
Check for token transfers in and out (including stablecoins)
- Returns:
None
- classify_tx(from_wallet: str, to_wallet: str, method_id: str, value: float) str
Check what type of tx is it
- Parameters:
from_wallet – from wallet address
to_wallet – to wallet address
method_id – method id
value – value of the transaction (ETH)
- Returns:
type of the tx
- drop_in_out_tokens(df: DataFrame) DataFrame
Remove all the transactions with tokens that have at least 1 in/out transaction
- Parameters:
df – dataframe with all the transactions
- Returns:
dataframe with all the transactions with tokens with in/out transactions removed
- drop_snipes(df: DataFrame) DataFrame
Remove all the transactions with tokens that have at least 1 snipe transaction
- Parameters:
df – dataframe with all the transactions
- Returns:
dataframe with all the transactions with tokens with snipe transactions removed
- get_data() None
Download all the data (transactions, internal transactions, token transactions) Change the dtypes Decode Universal router input
- Returns:
None
- get_info_from_token_txs(tx_hash: str, tx_type: str, value: float) Series
Get information about the transaction for the token_txs_df. Use it to merge data of txs_df with token_txs_df
- Parameters:
tx_hash – Transaction hash
tx_type – Transaction type
value – Transaction value
- Returns:
Series with the information about the transaction
- get_swap_txs(drop_snipes: bool = False, include_other_swap_types: bool = False, drop_in_out_tokens: bool = False, drop_stablecoins_swaps: bool = True) DataFrame
Get all the swap transactions (buy and sell) from the txs_df
- Parameters:
drop_snipes – whether to drop all transaction of tokens that have snipe transactions
include_other_swap_types – whether to include other swap types (other_buy, other_sell)
drop_in_out_tokens – whether to drop all transaction of tokens that have in/out transactions
drop_stablecoins_swaps – whether to drop stablecoins swaps
- Returns:
dataframe with all the swap transactions
- load_data(folder: str = 'data') None
Same as self.get_data but loads the data from 3 CSV files located in the dir
- Parameters:
folder – directory of the files
- Returns:
None
- load_gas_price_history(file='data/export-AvgGasPrice.csv') DataFrame
Load gas price history (export data from Etherscan.io)
- Parameters:
file – CSV file with gas price history
- Returns:
dataframe with gas price history
- move_weth_transactions() None
Move WETH transactions from token_txs_df to the txs_df
- Returns:
None
- save_data(folder: str = 'data') None
Save the txs_df, token_txs_df and internal_txs_df dataframes to separate CSV files in the given dir
- Parameters:
folder – directory of the files
- Returns:
None
- select_data_by_timestamp(start=None, stop=None) None
Select only trades in a given timeframe
- Parameters:
start – start timestamp
stop – stop timestamp
- Returns:
None
Download wallet txs history using bscscan or etherscan api. Use cache to avoid api rate limit (cache expires after 3 hours)
- class download_wallet_txs.DataDownloader(address: str, endpoint: str = 'etherscan.com', startblock: int = 0)
Download wallet txs history using bscscan or etherscan api
- get_internal_txs() list
Get internal transactions for a given address
- Returns:
List of transactions
- get_token_txs() list
Get token transactions for a given address
- Returns:
List of transactions
- get_txs() list
Get normal transactions for a given address
- Returns:
List of transactions
- class download_wallet_txs.SolanaDataDownloader(address: str)
Download wallet txs history using solana.fm api
- get_txs() list
Get normal transactions for a given address
- Returns:
List of transactions
- get_txs_helius(break_time=1800) list
Get transactions for a given address using the Helius API :return: