Skip to content

Fix pipeline semantic bugs: field naming, deprecated datetime, redundant API call#2

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/fix-pipeline-process-errors
Draft

Fix pipeline semantic bugs: field naming, deprecated datetime, redundant API call#2
Copilot wants to merge 2 commits intomainfrom
copilot/fix-pipeline-process-errors

Conversation

Copy link

Copilot AI commented Feb 9, 2026

Found and fixed three substantive errors in the data collection → index creation pipeline.

Changes

1. Renamed tvl_ratiotvl_risk (semantic mismatch)

Field name implied a ratio (0-1) but contained a risk score (0-100):

# Before: misleading field name
@dataclass
class StablecoinRiskInputs:
    tvl_ratio: float  # current_tvl / max_historical_tvl
    
tvl_ratio = current_tvl / max_historical_tvl  # Actual ratio: 0.87
tvl_risk = normalize_to_100(1 - tvl_ratio, 0, 0.5)  # Risk score: 26
return StablecoinRiskInputs(tvl_ratio=tvl_risk)  # Wrong field name

# After: field name matches content
@dataclass
class StablecoinRiskInputs:
    tvl_risk: float  # TVL drawdown risk score (0-100)

return StablecoinRiskInputs(tvl_risk=tvl_risk)

Updated in transform.py, orchestrator.py, backtest.py.

2. Replaced deprecated datetime.utcnow()

Changed to datetime.now(timezone.utc) across transform.py, orchestrator.py, calculate.py, calculator.py.

3. Eliminated redundant DeFiLlama API call

Pipeline was calling both get_total_tvl() and get_tvl_history() which hit the same endpoint. Now extracts current TVL from history data, reducing API calls by 1 per run.

# Before: 2 calls to same endpoint
results = await asyncio.gather(
    self.defillama.get_total_tvl(),      # ← redundant
    self.defillama.get_tvl_history(),    # ← contains total_tvl
    ...
)

# After: 1 call
results = await asyncio.gather(
    self.defillama.get_tvl_history(),
    ...
)
total_tvl = tvl_history[-1].tvl if tvl_history else 100e9

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.coingecko.com
    • Triggering command: /usr/bin/python python -m asri.pipeline.orchestrator (dns block)
  • api.llama.fi
    • Triggering command: /usr/bin/python python -m asri.pipeline.orchestrator (dns block)
  • api.stlouisfed.org
    • Triggering command: /usr/bin/python python -m asri.pipeline.orchestrator (dns block)
  • bridges.llama.fi
    • Triggering command: /usr/bin/python python -m asri.pipeline.orchestrator (dns block)
  • news.google.com
    • Triggering command: /usr/bin/python python -m asri.pipeline.orchestrator (dns block)
  • stablecoins.llama.fi
    • Triggering command: /usr/bin/python python -m asri.pipeline.orchestrator (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Look for substantive errors within the code in the pipeline process from collecting data to index creation.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…tetime, eliminate redundant API call

Co-authored-by: studiofarzulla <62593503+studiofarzulla@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix substantive errors in pipeline process code Fix pipeline semantic bugs: field naming, deprecated datetime, redundant API call Feb 9, 2026
Copilot AI requested a review from studiofarzulla February 9, 2026 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants