Skip to content

feat: integrate price fetching functionality with new PriceFetcher mo…#775

Merged
Cedarich merged 2 commits into
Pulsefy:mainfrom
Oluwasuyi-Timilehin:feature/736-pricing-source-integration
May 27, 2026
Merged

feat: integrate price fetching functionality with new PriceFetcher mo…#775
Cedarich merged 2 commits into
Pulsefy:mainfrom
Oluwasuyi-Timilehin:feature/736-pricing-source-integration

Conversation

@Oluwasuyi-Timilehin

Copy link
Copy Markdown
Contributor

#closes #736

Description

This PR implements an off-chain price fetcher in the data-processing module to support the Soroban pricing adapter contract on testnet. The new implementation fetches USD prices for XLM and USDC, scales them to the pricing adapter contract's base decimals (10^7), and includes fallback and stale-cache handling for failed source calls.

Changes Made

1. New Price Fetcher Module

  • Added apps/data-processing/src/ingestion/price_fetcher.py
  • Supports primary CoinGecko price fetch and fallback CoinCap fetch
  • Handles request failures by returning stale cached payloads when available
  • Produces adapter-ready payloads with:
    • asset_code
    • asset_issuer
    • price_usd
    • price (scaled to 10^7)
    • asset_decimals
    • base_decimals
    • source
    • timestamp
    • is_stale
    • success

2. Pipeline Integration

  • Integrated PriceFetcher into apps/data-processing/src/main.py
  • Fetches price data in parallel with news, on-chain volume, and network stats
  • Prints price feed status during pipeline runs
  • Includes price_feed in the pipeline result output

3. Tests

  • Added apps/data-processing/tests/test_price_fetcher.py
  • Covers:
    • successful price fetch and scaling
    • stale cache fallback when sources fail
    • error payload when no source and no cache are available

4. Dependency and tooling

  • Installed runtime dependency support for requests and stellar-sdk in the project test environment
  • Verified module imports and test execution in the data-processing package

Acceptance Criteria Met

✅ Supports XLM and USDC asset pricing

✅ Produces scaled prices aligned with adapter decimals (10^7)

✅ Handles stale/failed source fallback with cached values

Validation

  • python -m pytest -q tests/test_price_fetcher.py

Files Changed

  • apps/data-processing/src/ingestion/price_fetcher.py
  • apps/data-processing/src/ingestion/__init__.py
  • apps/data-processing/src/main.py
  • apps/data-processing/tests/test_price_fetcher.py

Notes

  • The new price fetcher is currently limited to the supported asset list in SUPPORTED_ASSETS.
  • Future enhancements may include additional supported issued assets and storing price feed results in a persistent cache or ledger.

#closes

@drips-wave

drips-wave Bot commented May 26, 2026

Copy link
Copy Markdown

@Oluwasuyi-Timilehin Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Cedarich Cedarich merged commit c29fd40 into Pulsefy:main May 27, 2026
1 check passed
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.

Data-processing: Pricing Source Integration to Support Pricing Adapter Updates

2 participants