InNoobWeTrust commited on
Commit
005b424
1 Parent(s): cf27d1b

fix: fallback on failure to fetch Farside source

Browse files
Files changed (1) hide show
  1. df.py +24 -0
df.py CHANGED
@@ -3,6 +3,8 @@ import pytz
3
  import requests
4
  import yfinance as yf
5
 
 
 
6
  from typing import List
7
  from types import SimpleNamespace
8
 
@@ -63,6 +65,17 @@ def fetch_btc_etf():
63
  url,
64
  headers=FETCH_HEADER,
65
  )
 
 
 
 
 
 
 
 
 
 
 
66
  # Get Bitcoin spot ETF history
67
  btc_etf_flow = pd.read_html(
68
  r.content,
@@ -90,6 +103,17 @@ def fetch_eth_etf():
90
  url,
91
  headers=FETCH_HEADER,
92
  )
 
 
 
 
 
 
 
 
 
 
 
93
  # Get Ethereum spot ETF history
94
  eth_etf_flow = pd.read_html(
95
  r.content,
 
3
  import requests
4
  import yfinance as yf
5
 
6
+ from datetime import datetime
7
+
8
  from typing import List
9
  from types import SimpleNamespace
10
 
 
65
  url,
66
  headers=FETCH_HEADER,
67
  )
68
+ print(r.status_code)
69
+ if r.status_code != 200:
70
+ print(r.content)
71
+ btc_etf_flow=pd.DataFrame.from_dict({"Date":["11 Jan 2024", "12 Jan 2024"], "Total": [0,0]})
72
+ btc_etf_flow, btc_etf_flow_original = clean_etf_data(btc_etf_flow)
73
+ return SimpleNamespace(
74
+ url=url,
75
+ flow=btc_etf_flow,
76
+ orig=btc_etf_flow_original,
77
+ funds=[],
78
+ )
79
  # Get Bitcoin spot ETF history
80
  btc_etf_flow = pd.read_html(
81
  r.content,
 
103
  url,
104
  headers=FETCH_HEADER,
105
  )
106
+ print(r.status_code)
107
+ if r.status_code != 200:
108
+ print(r.content)
109
+ eth_etf_flow=pd.DataFrame.from_dict({"Date":["11 Jan 2024", "12 Jan 2024"], "Total": [0,0]})
110
+ eth_etf_flow, eth_etf_flow_original = clean_etf_data(eth_etf_flow)
111
+ return SimpleNamespace(
112
+ url=url,
113
+ flow=eth_etf_flow,
114
+ orig=eth_etf_flow_original,
115
+ funds=[],
116
+ )
117
  # Get Ethereum spot ETF history
118
  eth_etf_flow = pd.read_html(
119
  r.content,