Skip to content

Conversation

@mukama
Copy link
Contributor

@mukama mukama commented Feb 12, 2026

Summary

  • Add GET /auth/finance/ebitda endpoint with daily EBITDA calculations (revenue minus costs)
  • Support period param for daily/monthly/yearly aggregation
  • Support site param for site-specific production costs
  • Aligned with API v2 spec: removed block data, fixed cost processing format

Example Queries

Monthly (default):

/auth/finance/ebitda?start=1735689600000&end=1770898000000

Daily:

/auth/finance/ebitda?start=1735689600000&end=1770898000000&period=daily

Yearly:

/auth/finance/ebitda?start=1735689600000&end=1770898000000&period=yearly

Add EBITDA API endpoint that aggregates pool transactions, power/hashrate
data, BTC prices, production costs, and block data to calculate selling
and HODL EBITDA metrics with period-based aggregation.

Includes shared infrastructure: period.utils, constants, and utility
functions required for finance endpoints.
- Remove block data RPC call and processBlockData (not in spec)
- Remove blockCount, difficulty, ebitdaMarginSelling, ebitdaMarginHodl from log
- Fix processCostsData to handle flat objects from globalDataLib with daily costs
- Replace direct globalDataLib.getGlobalData range query with getProductionCosts helper
- Add site query param to schema, cache key, and handler for site-specific costs
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.

1 participant