-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from Synthetixio/public-updates
Updates to publish
- Loading branch information
Showing
28 changed files
with
636 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import streamlit as st | ||
from st_pages import Page, show_pages, add_page_title | ||
|
||
st.set_page_config(page_title="Synthetix Dashboards", layout="wide") | ||
|
||
hide_footer = """ | ||
<style> | ||
footer {visibility: hidden;} | ||
</style> | ||
""" | ||
st.markdown(hide_footer, unsafe_allow_html=True) | ||
|
||
st.markdown( | ||
""" | ||
# Synthetix V3 Analytics | ||
Discover the latest insights into the Synthetix V3 ecosystem. | ||
## Base Andromeda Release | ||
Andromeda, the latest Synthetix V3 deployment on the Base network, allows liquidity provision with USDC and seamless trading of perps using USDC collateral. For details, explore our [blog post](https://blog.synthetix.io/what-is-the-andromeda-release/). | ||
### Dashboards: | ||
- **Perps Stats**: Insights on volume, fees, and more across all markets. | ||
- **Perps Markets**: Insights for each perps market. | ||
- **Perps Monitor**: A consolidated view of all perps markets. | ||
- **Core Stats**: Key metrics of the Core system, including debt, collateral, and LP performance. | ||
- **Spot Markets**: Analysis of the USDC wrapper contracts. | ||
- **Perps Integrators**: Activity overview by integrator. | ||
- **Perps Accounts**: View recent activity by specific accounts. | ||
- **Perps Keepers**: Track community keepers' settlement transactions. | ||
## Additional Resources | ||
- V3 details: [documentation](https://docs.synthetix.io/v/v3/) | ||
- Updates: [blog](https://blog.synthetix.io/) | ||
- Community: [discord](https://discord.com/invite/AEdUHzt) | ||
""" | ||
) | ||
|
||
# page setup | ||
PAGE_PREFIX = "dashboard/" if st.secrets.settings.IS_CLOUD == "true" else "" | ||
SHOW_OP = True if st.secrets.settings.SHOW_OP == "true" else False | ||
|
||
home_page = [Page(f"{PAGE_PREFIX}About.py", "About")] | ||
op_pages = [ | ||
Page(f"{PAGE_PREFIX}pages/OP_Mainnet.py", "OP Mainnet"), | ||
] | ||
base_pages = [ | ||
Page(f"{PAGE_PREFIX}pages/Base_Mainnet.py", "Base Mainnet"), | ||
Page(f"{PAGE_PREFIX}pages/Base_Sepolia.py", "Base Sepolia"), | ||
] | ||
|
||
# pages to show | ||
pages_to_show = home_page + (op_pages if SHOW_OP else []) + base_pages | ||
show_pages(pages_to_show) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
import streamlit as st | ||
import pandas as pd | ||
import sqlite3 | ||
import plotly.express as px | ||
from datetime import datetime, timedelta | ||
from utils import get_connection | ||
from utils import chart_bars, chart_lines, export_data | ||
|
||
## set default filters | ||
filters = { | ||
"start_date": datetime.today().date() - timedelta(days=14), | ||
"end_date": datetime.today().date() + timedelta(days=1), | ||
"resolution": "daily", | ||
} | ||
|
||
|
||
## data | ||
@st.cache_data(ttl=1) | ||
def fetch_data(filters): | ||
# get filters | ||
start_date = filters["start_date"] | ||
end_date = filters["end_date"] | ||
resolution = filters["resolution"] | ||
|
||
# initialize connection | ||
db = get_connection() | ||
|
||
# read data | ||
df_stats = pd.read_sql_query( | ||
f""" | ||
SELECT | ||
ts, | ||
volume, | ||
trades, | ||
fees, | ||
liquidated_accounts, | ||
liquidation_rewards, | ||
cumulative_fees, | ||
cumulative_volume | ||
FROM base_mainnet.fct_perp_stats_{resolution} | ||
WHERE ts >= '{start_date}' and ts <= '{end_date}' | ||
""", | ||
db, | ||
) | ||
|
||
db.close() | ||
|
||
return { | ||
"stats": df_stats, | ||
} | ||
|
||
|
||
@st.cache_data(ttl=1) | ||
def make_charts(data): | ||
return { | ||
"volume": chart_bars(data["stats"], "ts", ["volume"], "Volume"), | ||
"cumulative_volume": chart_lines( | ||
data["stats"], "ts", ["cumulative_volume"], "Cumulative Volume", smooth=True | ||
), | ||
"cumulative_fees": chart_lines( | ||
data["stats"], "ts", ["cumulative_fees"], "Cumulative Fees", smooth=True | ||
), | ||
"fees": chart_bars(data["stats"], "ts", ["fees"], "Exchange Fees"), | ||
"trades": chart_bars(data["stats"], "ts", ["trades"], "Trades"), | ||
"account_liquidations": chart_bars( | ||
data["stats"], "ts", ["liquidated_accounts"], "Account Liquidations" | ||
), | ||
"liquidation_rewards": chart_bars( | ||
data["stats"], "ts", ["liquidation_rewards"], "Liquidation Rewards" | ||
), | ||
} | ||
|
||
|
||
def main(): | ||
## title | ||
st.markdown("## V3 Perps Stats") | ||
|
||
## inputs | ||
with st.expander("Filters") as expander: | ||
# resolution | ||
filters["resolution"] = st.radio("Resolution", ["daily", "hourly"]) | ||
|
||
# date filter | ||
filt_col1, filt_col2 = st.columns(2) | ||
with filt_col1: | ||
filters["start_date"] = st.date_input("Start", filters["start_date"]) | ||
|
||
with filt_col2: | ||
filters["end_date"] = st.date_input("End", filters["end_date"]) | ||
|
||
## fetch data | ||
data = fetch_data(filters) | ||
|
||
## make the charts | ||
charts = make_charts(data) | ||
|
||
## display | ||
col1, col2 = st.columns(2) | ||
|
||
with col1: | ||
st.plotly_chart(charts["cumulative_volume"], use_container_width=True) | ||
st.plotly_chart(charts["cumulative_fees"], use_container_width=True) | ||
st.plotly_chart(charts["account_liquidations"], use_container_width=True) | ||
st.plotly_chart(charts["liquidation_rewards"], use_container_width=True) | ||
pass | ||
|
||
with col2: | ||
st.plotly_chart(charts["volume"], use_container_width=True) | ||
st.plotly_chart(charts["fees"], use_container_width=True) | ||
st.plotly_chart(charts["trades"], use_container_width=True) | ||
pass | ||
|
||
## export | ||
exports = [{"title": export, "df": data[export]} for export in data.keys()] | ||
with st.expander("Exports"): | ||
for export in exports: | ||
export_data(export["title"], export["df"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.