InNoobWeTrust
commited on
Commit
•
cf27d1b
1
Parent(s):
8dcb148
feat: Add iframes of original data from Farside Investor
Browse files- df.py +8 -3
- streamlit_app.py +7 -0
df.py
CHANGED
@@ -58,8 +58,9 @@ FETCH_HEADER = {
|
|
58 |
}
|
59 |
|
60 |
def fetch_btc_etf():
|
|
|
61 |
r = requests.Session().get(
|
62 |
-
|
63 |
headers=FETCH_HEADER,
|
64 |
)
|
65 |
# Get Bitcoin spot ETF history
|
@@ -76,6 +77,7 @@ def fetch_btc_etf():
|
|
76 |
btc_etf_flow, btc_etf_flow_original = clean_etf_data(btc_etf_flow)
|
77 |
|
78 |
return SimpleNamespace(
|
|
|
79 |
flow=btc_etf_flow,
|
80 |
orig=btc_etf_flow_original,
|
81 |
funds=btc_etf_funds,
|
@@ -83,8 +85,9 @@ def fetch_btc_etf():
|
|
83 |
|
84 |
|
85 |
def fetch_eth_etf():
|
|
|
86 |
r = requests.Session().get(
|
87 |
-
|
88 |
headers=FETCH_HEADER,
|
89 |
)
|
90 |
# Get Ethereum spot ETF history
|
@@ -114,6 +117,7 @@ def fetch_eth_etf():
|
|
114 |
eth_etf_flow, eth_etf_flow_original = clean_etf_data(eth_etf_flow)
|
115 |
|
116 |
return SimpleNamespace(
|
|
|
117 |
flow=eth_etf_flow,
|
118 |
orig=eth_etf_flow_original,
|
119 |
funds=eth_etf_funds,
|
@@ -148,7 +152,7 @@ def fetch(asset):
|
|
148 |
else:
|
149 |
df = fetch_eth_etf()
|
150 |
|
151 |
-
etf_flow, etf_funds = df.flow, df.funds
|
152 |
tz = pytz.timezone("America/New_York")
|
153 |
|
154 |
etf_flow, etf_funds = df.flow, df.funds
|
@@ -170,6 +174,7 @@ def fetch(asset):
|
|
170 |
)
|
171 |
|
172 |
return SimpleNamespace(
|
|
|
173 |
etf_flow=etf_flow,
|
174 |
etf_volumes=etf_volumes,
|
175 |
price=price,
|
|
|
58 |
}
|
59 |
|
60 |
def fetch_btc_etf():
|
61 |
+
url = "https://farside.co.uk/bitcoin-etf-flow-all-data/"
|
62 |
r = requests.Session().get(
|
63 |
+
url,
|
64 |
headers=FETCH_HEADER,
|
65 |
)
|
66 |
# Get Bitcoin spot ETF history
|
|
|
77 |
btc_etf_flow, btc_etf_flow_original = clean_etf_data(btc_etf_flow)
|
78 |
|
79 |
return SimpleNamespace(
|
80 |
+
url=url,
|
81 |
flow=btc_etf_flow,
|
82 |
orig=btc_etf_flow_original,
|
83 |
funds=btc_etf_funds,
|
|
|
85 |
|
86 |
|
87 |
def fetch_eth_etf():
|
88 |
+
url = "https://farside.co.uk/ethereum-etf-flow-all-data/"
|
89 |
r = requests.Session().get(
|
90 |
+
url,
|
91 |
headers=FETCH_HEADER,
|
92 |
)
|
93 |
# Get Ethereum spot ETF history
|
|
|
117 |
eth_etf_flow, eth_etf_flow_original = clean_etf_data(eth_etf_flow)
|
118 |
|
119 |
return SimpleNamespace(
|
120 |
+
url=url,
|
121 |
flow=eth_etf_flow,
|
122 |
orig=eth_etf_flow_original,
|
123 |
funds=eth_etf_funds,
|
|
|
152 |
else:
|
153 |
df = fetch_eth_etf()
|
154 |
|
155 |
+
etf_flow, etf_funds, etf_url = df.flow, df.funds, df.url
|
156 |
tz = pytz.timezone("America/New_York")
|
157 |
|
158 |
etf_flow, etf_funds = df.flow, df.funds
|
|
|
174 |
)
|
175 |
|
176 |
return SimpleNamespace(
|
177 |
+
url=etf_url,
|
178 |
etf_flow=etf_flow,
|
179 |
etf_volumes=etf_volumes,
|
180 |
price=price,
|
streamlit_app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import pandas as pd
|
2 |
|
3 |
import streamlit as st
|
|
|
4 |
import altair as alt
|
5 |
|
6 |
from pygwalker.api.streamlit import StreamlitRenderer, init_streamlit_comm
|
@@ -238,6 +239,11 @@ if __name__ == "__main__":
|
|
238 |
chart = compound_chart(chart_size={"width": 560, "height": 300})
|
239 |
# Display charts
|
240 |
st.altair_chart(chart, use_container_width=True)
|
|
|
|
|
|
|
|
|
|
|
241 |
with single_view:
|
242 |
asset = st.selectbox(
|
243 |
"Asset to view",
|
@@ -249,6 +255,7 @@ if __name__ == "__main__":
|
|
249 |
st.altair_chart(charts.net_flow_total_fig, use_container_width=True)
|
250 |
st.altair_chart(charts.cum_flow_individual_net_fig, use_container_width=True)
|
251 |
st.altair_chart(charts.cum_flow_total_fig, use_container_width=True)
|
|
|
252 |
with flow_tab:
|
253 |
btc_flow, eth_flow = btc.etf_flow, eth.etf_flow
|
254 |
btc_flow["Asset"] = "BTC"
|
|
|
1 |
import pandas as pd
|
2 |
|
3 |
import streamlit as st
|
4 |
+
from streamlit.components.v1 import iframe
|
5 |
import altair as alt
|
6 |
|
7 |
from pygwalker.api.streamlit import StreamlitRenderer, init_streamlit_comm
|
|
|
239 |
chart = compound_chart(chart_size={"width": 560, "height": 300})
|
240 |
# Display charts
|
241 |
st.altair_chart(chart, use_container_width=True)
|
242 |
+
btc_col, eth_col = st.columns(2)
|
243 |
+
with btc_col:
|
244 |
+
iframe(btc.url, height=1200, scrolling=True)
|
245 |
+
with eth_col:
|
246 |
+
iframe(eth.url, height=1200, scrolling=True)
|
247 |
with single_view:
|
248 |
asset = st.selectbox(
|
249 |
"Asset to view",
|
|
|
255 |
st.altair_chart(charts.net_flow_total_fig, use_container_width=True)
|
256 |
st.altair_chart(charts.cum_flow_individual_net_fig, use_container_width=True)
|
257 |
st.altair_chart(charts.cum_flow_total_fig, use_container_width=True)
|
258 |
+
iframe(fetch_asset(asset).url, height=1200, scrolling=True)
|
259 |
with flow_tab:
|
260 |
btc_flow, eth_flow = btc.etf_flow, eth.etf_flow
|
261 |
btc_flow["Asset"] = "BTC"
|