fix: EIX scraping, LS endpoints, and premium Dashboard analytics
All checks were successful
Deployment / deploy-docker (push) Successful in 10s

This commit is contained in:
Melchior Reimers
2026-01-23 18:09:00 +01:00
parent 3fc149599e
commit 1086c4aa1d
5 changed files with 232 additions and 79 deletions

View File

@@ -13,33 +13,34 @@ class EIXExchange(BaseExchange):
return "EIX"
def fetch_latest_trades(self, limit: int = 1) -> List[Trade]:
url = "https://european-investor-exchange.com/en/trade-list"
response = requests.get(url)
response.raise_for_status()
soup = BeautifulSoup(response.text, 'html.parser')
next_data_script = soup.find('script', id='__NEXT_DATA__')
if not next_data_script:
# EIX stores its file list in a separate API endpoint
url = "https://european-investor-exchange.com/api/official-trades"
try:
response = requests.get(url, timeout=15)
response.raise_for_status()
files_list = response.json()
except Exception as e:
print(f"Error fetching EIX file list: {e}")
return []
data = json.loads(next_data_script.string)
rows_data = data.get('props', {}).get('pageProps', {}).get('rowsData', [])
trades = []
count = 0
for row in rows_data:
file_key = row.get('key')
for item in files_list:
file_key = item.get('fileName')
if not file_key:
continue
# Download the CSV
csv_url = f"https://european-investor-exchange.com/api/trade-file-contents?key={file_key}"
csv_response = requests.get(csv_url)
if csv_response.status_code == 200:
trades.extend(self._parse_csv(csv_response.text))
count += 1
if limit and count >= limit:
break
try:
csv_response = requests.get(csv_url, timeout=20)
if csv_response.status_code == 200:
trades.extend(self._parse_csv(csv_response.text))
count += 1
if limit and count >= limit:
break
except Exception as e:
print(f"Error downloading EIX CSV {file_key}: {e}")
return trades

View File

@@ -14,6 +14,7 @@ class LSExchange(BaseExchange):
endpoints = ["https://www.ls-x.de/_rpc/json/.lstc/instrument/list/lstctradestoday"]
if include_yesterday:
endpoints.append("https://www.ls-x.de/_rpc/json/.lstc/instrument/list/lstctradesyesterday")
endpoints.append("https://www.ls-x.de/_rpc/json/.lstc/instrument/list/lsxtradesyesterday")
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',