zirobtc commited on
Commit
ec74458
·
1 Parent(s): 044ed6d

Upload data/data_fetcher.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. data/data_fetcher.py +3 -3
data/data_fetcher.py CHANGED
@@ -342,7 +342,7 @@ class DataFetcher:
342
 
343
  def fetch_wallet_holdings(self, wallet_addresses: List[str], T_cutoff: datetime.datetime) -> Dict[str, List[Dict[str, Any]]]:
344
  """
345
- Fetches top 10 wallet holding records for a list of wallet addresses that were active at T_cutoff.
346
  Batches queries to avoid "Max query size exceeded" errors.
347
  Returns a dictionary mapping wallet_address to a LIST of its holding data.
348
  """
@@ -360,7 +360,7 @@ class DataFetcher:
360
  # --- Time-aware query ---
361
  # 1. For each holding, find the latest state at or before T_cutoff.
362
  # 2. Filter for holdings where the balance was greater than 0.
363
- # 3. Rank these active holdings by USD volume and take the top 10 per wallet.
364
  query = """
365
  WITH point_in_time_holdings AS (
366
  SELECT
@@ -380,7 +380,7 @@ class DataFetcher:
380
  )
381
  SELECT *
382
  FROM ranked_active_holdings
383
- WHERE rn_per_wallet <= 10;
384
  """
385
  params = {'addresses': batch_addresses, 'T_cutoff': T_cutoff}
386
 
 
342
 
343
  def fetch_wallet_holdings(self, wallet_addresses: List[str], T_cutoff: datetime.datetime) -> Dict[str, List[Dict[str, Any]]]:
344
  """
345
+ Fetches top 2 wallet holding records for a list of wallet addresses that were active at T_cutoff.
346
  Batches queries to avoid "Max query size exceeded" errors.
347
  Returns a dictionary mapping wallet_address to a LIST of its holding data.
348
  """
 
360
  # --- Time-aware query ---
361
  # 1. For each holding, find the latest state at or before T_cutoff.
362
  # 2. Filter for holdings where the balance was greater than 0.
363
+ # 3. Rank these active holdings by USD volume and take the top 2 per wallet.
364
  query = """
365
  WITH point_in_time_holdings AS (
366
  SELECT
 
380
  )
381
  SELECT *
382
  FROM ranked_active_holdings
383
+ WHERE rn_per_wallet <= 2;
384
  """
385
  params = {'addresses': batch_addresses, 'T_cutoff': T_cutoff}
386