Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
API_KEY = "48bd4a71-3872-4b90-a0a0-a8a879cfb113"
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.venv
.pyc
__pycache__
__pycache__
.env
.streamlit
8 changes: 8 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This configuration file was automatically generated by Gitpod.
# Please adjust to your needs (see https://www.gitpod.io/docs/config-gitpod-file)
# and commit this file to your remote git repository to share the goodness with others.

tasks:
- init: pip install -r requirements.txt


1 change: 1 addition & 0 deletions .streamlit/secrets.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
API_KEY = "48bd4a71-3872-4b90-a0a0-a8a879cfb113"
3 changes: 2 additions & 1 deletion app/Main_Page.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
'About': 'https://0xrdt.notion.site/Celsius-Wallet-725174fa3c8348059dc2fa6b105ddf82'}
)


st.title('Celsius Wallets Analysis')
st.markdown("Check out the [article about this dashboard](https://0xrdt.notion.site/Celsius-Wallet-725174fa3c8348059dc2fa6b105ddf82)! ")

Expand Down Expand Up @@ -172,7 +173,7 @@ def eth_transfers_section():
df_grid_builder(df)


#st.sidebar.title('Choose what you want to see')
st.sidebar.title('Choose what you want to see')
selected_sections = st.sidebar.multiselect('Choose the sections you want to see:', ['Transactions', 'Balances', 'ETH Transfers', 'ERC-20 Transfers'], default=['Balances'])

if 'Transactions' in selected_sections:
Expand Down
1 change: 1 addition & 0 deletions app/pages/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
API_KEY = "48bd4a71-3872-4b90-a0a0-a8a879cfb113"
245 changes: 159 additions & 86 deletions app/pages/1_Single_Wallet_Deep_Dive.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,99 +5,172 @@
from utils.df_grid_builder import df_grid_builder

st.title("Wallet Profiler")
transferz = load_transfers()
transfers_x = transferz.set_index("ORIGIN_TO_ADDRESS")
transfers_x = pd.DataFrame(transfers_x.index.unique())

# st.write(transfers_x)
transfers_y = transferz.set_index("ORIGIN_FROM_ADDRESS")
transfers_y = pd.DataFrame(transfers_y.index.unique())
# st.write(transfers_y)
merged_Frame = pd.merge(transfers_y, transfers_x, right_on = "ORIGIN_TO_ADDRESS", left_on= "ORIGIN_FROM_ADDRESS" , how = 'outer')
# st.write(merged_Frame)

merged_Frame = merged_Frame.dropna()
merged_Frame_fix = pd.DataFrame()
merged_Frame_fix['addy'] = merged_Frame['ORIGIN_FROM_ADDRESS']
# st.write(merged_Frame_fix)

# st.write(celsius_accounts)
wallet_address = st.selectbox("Choose a wallet", merged_Frame_fix)



# if 'error' in response:
# wallet_address = st.selectbox("Choose a wallet", transfers_x.index.unique())

# else:
# wallet_address_2 = st.selectbox("Choose a wallet", transfers_y.index.unique())

def wallet_balance_section():
st.header("Wallet Balance")
balances = load_balances()

filtered_balances = balances[balances['USER_ADDRESS']==wallet_address].dropna()
filtered_balances = filtered_balances.sort_values(by=['TOTAL_BALANCE_USD','day'], ascending=False)
title=f'Daily Total Balances for {wallet_address} <br><sup>Some tokens might not appear due to them being illiquid</sup>'
fig = px.bar(filtered_balances, x='day', y='TOTAL_BALANCE_USD', color='SYMBOL', title=title)
fig.update_layout(xaxis_title="Day", yaxis_title="Total Balance (USD)")
fig.update_layout(height=600)
st.write(fig)
try:
st.header("Wallet Balance")
balances = load_balances()
filtered_balances = balances.set_index("USER_ADDRESS").loc[wallet_address]
filtered_balances = filtered_balances.sort_values(by=['TOTAL_BALANCE_USD','day'], ascending=False)
title=f'Daily Total Balances for {wallet_address} <br><sup>Some tokens might not appear due to them being illiquid</sup>'
fig = px.bar(filtered_balances, x='day', y='TOTAL_BALANCE_USD', color='SYMBOL', title=title)
fig.update_layout(xaxis_title="Day", yaxis_title="Total Balance (USD)")
fig.update_layout(height=600)
st.write(fig)

except KeyError as e:
st.write("try anouther")


def eth_counterparties_section():
st.header("ETH Counterparties")
transfers = load_transfers()
outgoing = transfers[transfers['ORIGIN_FROM_ADDRESS']==wallet_address]
incoming = transfers[transfers['ORIGIN_TO_ADDRESS']==wallet_address]

incoming = incoming.sort_values(['TRANSFER_VOLUME_USD'], ascending=False).reset_index(drop=True)
incoming = incoming[['FROM_ADDRESS_NAME', 'FROM_PROJECT_NAME', 'TRANSFER_COUNT', 'TRANSFER_VOLUME_USD', 'ORIGIN_FROM_ADDRESS']]
outgoing = outgoing.sort_values(['TRANSFER_VOLUME_USD'], ascending=False).reset_index(drop=True)
outgoing = outgoing[['TO_ADDRESS_NAME', 'TO_PROJECT_NAME', 'TRANSFER_COUNT', 'TRANSFER_VOLUME_USD', 'ORIGIN_TO_ADDRESS']]

col1, col2 = st.columns(2)
col1.metric('Total Incoming Transfers Count', value=incoming['TRANSFER_COUNT'].sum())
col2.metric('Total Outgoing Transfers Count', value=outgoing['TRANSFER_COUNT'].sum())
col1.metric('Total Incoming Transfers USD Volume', value=f"${incoming['TRANSFER_VOLUME_USD'].sum():20,.2f}")
col2.metric('Total Outgoing Transfers USD Volume', value=f"${outgoing['TRANSFER_VOLUME_USD'].sum():20,.2f}")

show_top_interacting_wallets = st.checkbox("Show top interacting wallets (ETH transfer)")
if show_top_interacting_wallets:
st.subheader("Top-Interacting Wallets (ETH Transfer)")
st.text("Incoming")
df_grid_builder(incoming)
st.text("Outgoing")
df_grid_builder(outgoing)

show_agg_transfers = st.checkbox("Show aggregated transfers (ETH transfer)")
if show_agg_transfers:
st.subheader("Transfers Aggregated by Wallet Label (ETH Transfer)")
st.text("Incoming")
tmp = outgoing.groupby("TO_ADDRESS_NAME").sum().sort_values(by=['TRANSFER_VOLUME_USD'], ascending=False)
df_grid_builder(tmp)
st.text("Outgoing")
incoming.groupby("FROM_ADDRESS_NAME").sum().sort_values(by=['TRANSFER_VOLUME_USD'], ascending=False)
df_grid_builder(tmp)

try:

st.header("ETH Counterparties")
transfers = load_transfers()


transfers_O = transfers
transfers_I = transfers
incoming = transfers_I.set_index("ORIGIN_TO_ADDRESS").loc[wallet_address]
outgoing = transfers_O.set_index("ORIGIN_FROM_ADDRESS").loc[wallet_address]

# st.write(outgoing)
# st.write(incoming)
# incoming = incoming.sort_values(['TRANSFER_VOLUME_USD'], ascending=False).reset_index(drop=True)
incoming = incoming[['FROM_ADDRESS_NAME', 'FROM_PROJECT_NAME', 'TRANSFER_COUNT', 'TRANSFER_VOLUME_USD']]
# outgoing = outgoing.sort_values(['TRANSFER_VOLUME_USD'], ascending=False).reset_index(drop=True)
outgoing = outgoing[['TO_ADDRESS_NAME', 'TO_PROJECT_NAME', 'TRANSFER_COUNT', 'TRANSFER_VOLUME_USD']]

col1, col2 = st.columns(2)
col1.metric('Total Incoming Transfers Count', value=incoming['TRANSFER_COUNT'].sum())
col2.metric('Total Outgoing Transfers Count', value=outgoing['TRANSFER_COUNT'].sum())
col1.metric('Total Incoming Transfers USD Volume', value=f"${incoming['TRANSFER_VOLUME_USD'].sum():20,.2f}")
col2.metric('Total Outgoing Transfers USD Volume', value=f"${outgoing['TRANSFER_VOLUME_USD'].sum():20,.2f}")

show_top_interacting_wallets = st.checkbox("Show top interacting wallets (ETH transfer)")
if show_top_interacting_wallets:
try:
st.subheader("Top-Interacting Wallets (ETH Transfer)")
st.text("Incoming")
df_grid_builder(incoming)
st.text("Outgoing")
df_grid_builder(outgoing)
except AttributeError as e:
st.write("empty here")
show_agg_transfers = st.checkbox("Show aggregated transfers (ETH transfer)")
if show_agg_transfers:
try:
st.subheader("Transfers Aggregated by Wallet Label (ETH Transfer)")
st.text("Incoming")
tmp = outgoing.groupby("TO_ADDRESS_NAME").sum().sort_values(by=['TRANSFER_VOLUME_USD'], ascending=False)
df_grid_builder(tmp)
st.text("Outgoing")
incoming.groupby("FROM_ADDRESS_NAME").sum().sort_values(by=['TRANSFER_VOLUME_USD'], ascending=False)
df_grid_builder(tmp)
except AttributeError as e:
st.write("empty here")
except KeyError as e:
st.write("try anouther")





# transfers = transfers.set_index("ORIGIN_TO_ADDRESS")

# st.write("transfers", transfers.index)
# st.write(wallet_address)





def token_counterparties_section():
st.header("Token Counterparties")
token_transfers = load_token_transfers()
outgoing = token_transfers[token_transfers['FROM_ADDRESS']==wallet_address]
incoming = token_transfers[token_transfers['TO_ADDRESS']==wallet_address]
incoming = incoming.sort_values(['TRANSFER_VOLUME_USD'], ascending=False).reset_index(drop=True)
incoming = incoming[['SYMBOL', 'FROM_ADDRESS_NAME', 'FROM_PROJECT_NAME', 'TRANSFER_COUNT', 'TRANSFER_VOLUME_USD', 'ORIGIN_FROM_ADDRESS']]
outgoing = outgoing.sort_values(['TRANSFER_VOLUME_USD'], ascending=False).reset_index(drop=True)
outgoing = outgoing[['SYMBOL', 'TO_ADDRESS_NAME', 'TO_PROJECT_NAME', 'TRANSFER_COUNT', 'TRANSFER_VOLUME_USD', 'ORIGIN_TO_ADDRESS']]

col1, col2 = st.columns(2)
col1.metric('Total Incoming Transfers Count', value=incoming['TRANSFER_COUNT'].sum())
col2.metric('Total Outgoing Transfers Count', value=outgoing['TRANSFER_COUNT'].sum())
col1.metric('Total Incoming Transfers USD Volume', value=f"${incoming['TRANSFER_VOLUME_USD'].sum():20,.2f}")
col2.metric('Total Outgoing Transfers USD Volume', value=f"${outgoing['TRANSFER_VOLUME_USD'].sum():20,.2f}")

show_top_interacting_wallets = st.checkbox("Show top interacting wallets (ERC-20 transfer)")
if show_top_interacting_wallets:
st.subheader("Top-Interacting Wallets (ERC-20 Transfer)")
st.text("Incoming")
df_grid_builder(incoming)
st.text("Outgoing")
df_grid_builder(outgoing)

show_agg_transfers = st.checkbox("Show aggregated transfers (ERC-20 transfer)")
if show_agg_transfers:
st.subheader("Transfers Aggregated by Wallet Label (ERC-20 Transfer)")
st.text("Incoming")
tmp = outgoing.groupby("TO_ADDRESS_NAME").sum().sort_values(by=['TRANSFER_VOLUME_USD'], ascending=False)
df_grid_builder(tmp)
st.text("Outgoing")
tmp = incoming.groupby("FROM_ADDRESS_NAME").sum().sort_values(by=['TRANSFER_VOLUME_USD'], ascending=False)
df_grid_builder(tmp)

st.subheader("Transfers Aggregated by Token (ERC-20 Transfer)")
st.text("Incoming")
incoming_agg_symbol = incoming.groupby("SYMBOL").sum().sort_values(by=['TRANSFER_VOLUME_USD'], ascending=False)
incoming_agg_symbol['TRANSFER_VOLUME_USD_PCT'] = 100*incoming_agg_symbol['TRANSFER_VOLUME_USD']/incoming_agg_symbol['TRANSFER_VOLUME_USD'].sum()
df_grid_builder(incoming_agg_symbol)
st.text("Outgoing")
outgoing_agg_symbol = outgoing.groupby("SYMBOL").sum().sort_values(by=['TRANSFER_VOLUME_USD'], ascending=False)
outgoing_agg_symbol['TRANSFER_VOLUME_USD_PCT'] = 100*outgoing_agg_symbol['TRANSFER_VOLUME_USD']/outgoing_agg_symbol['TRANSFER_VOLUME_USD'].sum()
df_grid_builder(outgoing_agg_symbol)

wallet_address = st.selectbox("Choose a wallet", list(load_celsius_accounts()['ADDRESS'].unique()))




try:
st.header("Token Counterparties")
token_transfers = load_token_transfers()
transfers_O_T = token_transfers
transfers_I_T = token_transfers

outgoing = transfers_O_T.set_index("FROM_ADDRESS").loc[wallet_address]
incoming = transfers_I_T.set_index("TO_ADDRESS").loc[wallet_address]
incoming = incoming.sort_values(['TRANSFER_VOLUME_USD'], ascending=False).reset_index(drop=True)
incoming = incoming[['SYMBOL', 'FROM_ADDRESS_NAME', 'FROM_PROJECT_NAME', 'TRANSFER_COUNT', 'TRANSFER_VOLUME_USD', 'FROM_ADDRESS']]
outgoing = outgoing.sort_values(['TRANSFER_VOLUME_USD'], ascending=False).reset_index(drop=True)
outgoing = outgoing[['SYMBOL', 'TO_ADDRESS_NAME', 'TO_PROJECT_NAME', 'TRANSFER_COUNT', 'TRANSFER_VOLUME_USD', 'TO_ADDRESS']]

col1, col2 = st.columns(2)
col1.metric('Total Incoming Transfers Count', value=incoming['TRANSFER_COUNT'].sum())
col2.metric('Total Outgoing Transfers Count', value=outgoing['TRANSFER_COUNT'].sum())
col1.metric('Total Incoming Transfers USD Volume', value=f"${incoming['TRANSFER_VOLUME_USD'].sum():20,.2f}")
col2.metric('Total Outgoing Transfers USD Volume', value=f"${outgoing['TRANSFER_VOLUME_USD'].sum():20,.2f}")

show_top_interacting_wallets = st.checkbox("Show top interacting wallets (ERC-20 transfer)")
if show_top_interacting_wallets:
st.subheader("Top-Interacting Wallets (ERC-20 Transfer)")
st.text("Incoming")
df_grid_builder(incoming)
st.text("Outgoing")
df_grid_builder(outgoing)

show_agg_transfers = st.checkbox("Show aggregated transfers (ERC-20 transfer)")
if show_agg_transfers:
st.subheader("Transfers Aggregated by Wallet Label (ERC-20 Transfer)")
st.text("Incoming")
tmp = outgoing.groupby("TO_ADDRESS_NAME").sum().sort_values(by=['TRANSFER_VOLUME_USD'], ascending=False)
df_grid_builder(tmp)
st.text("Outgoing")
tmp = incoming.groupby("FROM_ADDRESS_NAME").sum().sort_values(by=['TRANSFER_VOLUME_USD'], ascending=False)
df_grid_builder(tmp)

st.subheader("Transfers Aggregated by Token (ERC-20 Transfer)")
st.text("Incoming")
incoming_agg_symbol = incoming.groupby("SYMBOL").sum().sort_values(by=['TRANSFER_VOLUME_USD'], ascending=False)
incoming_agg_symbol['TRANSFER_VOLUME_USD_PCT'] = 100*incoming_agg_symbol['TRANSFER_VOLUME_USD']/incoming_agg_symbol['TRANSFER_VOLUME_USD'].sum()
df_grid_builder(incoming_agg_symbol)
st.text("Outgoing")
outgoing_agg_symbol = outgoing.groupby("SYMBOL").sum().sort_values(by=['TRANSFER_VOLUME_USD'], ascending=False)
outgoing_agg_symbol['TRANSFER_VOLUME_USD_PCT'] = 100*outgoing_agg_symbol['TRANSFER_VOLUME_USD']/outgoing_agg_symbol['TRANSFER_VOLUME_USD'].sum()
df_grid_builder(outgoing_agg_symbol)

except KeyError as e:
st.write("try anouther")




wallet_balance_section()
eth_counterparties_section()
token_counterparties_section()
Expand Down
4 changes: 4 additions & 0 deletions app/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pandas==1.4.3
plotly==5.9.0
requests==2.28.0
streamlit==1.10.0
1 change: 1 addition & 0 deletions app/utils/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
API_KEY = "48bd4a71-3872-4b90-a0a0-a8a879cfb113"
1 change: 1 addition & 0 deletions app/utils/.streamlit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
API_KEY = "48bd4a71-3872-4b90-a0a0-a8a879cfb113"
Loading