Skip to content

feat: implement tick-by-tick raw API response audit export#271

Merged
Sadeequ merged 2 commits into
StellarFlow-Network:mainfrom
feromoneth:fix/tick-by-tick-raw-data-export
Apr 29, 2026
Merged

feat: implement tick-by-tick raw API response audit export#271
Sadeequ merged 2 commits into
StellarFlow-Network:mainfrom
feromoneth:fix/tick-by-tick-raw-data-export

Conversation

@feromoneth
Copy link
Copy Markdown
Contributor

Closes #156


Issue Summary

Issue #156 requests high-granularity audit logging for institutional users — a complete trace of every raw API response (un-normalized) used in price derivation, enabling full transparency into how final prices are calculated.


Root Cause

The system normalizes and aggregates market data immediately, discarding raw provider payloads. Without persisted raw responses, audit trails cannot show the constituent API data that led to final price decisions, blocking institutional compliance and auditing requirements.


Fix Implemented

  • Added new RawData Prisma model storing every successful external API response with provider name, endpoint, full JSON payload, and fetch timestamp
  • Extended MarketRate interface to carry optional rawResponses array during fetch operations
  • Updated all fetchers to capture payloads before normalization: CoinGecko (GHS, KES), VTpass, and ExchangeRate API
  • Added guarded persistence path in MarketRateService that safely serializes and inserts raw data without blocking price updates on storage failure
  • Indexed schema for efficient audit queries by currency, provider, and time range

Testing Performed

  • Type-check passed on all modified files
  • NGN fetcher test assertions validate raw response capture for all 5 providers
  • Schema change follows existing Prisma model patterns in repository
  • Persistence uses safe async error handling to protect existing fetch behavior

References

feromoneth and others added 2 commits April 29, 2026 08:56
Add RawData Prisma model to store un-normalized provider payloads for every successful API call during price computation. Extend MarketRate interface with optional rawResponses array carrying provider metadata. Capture full response envelopes in all fetchers (CoinGecko, VTpass, ExchangeRate API) and persist to RawData after rate fetch completes. Errors during persistence do not block price updates. Includes NGN fetcher test assertions for raw response collection.
Fixes StellarFlow-Network#156
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Apr 29, 2026

@feromoneth 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

@Sadeequ Sadeequ merged commit 8519c0f into StellarFlow-Network:main Apr 29, 2026
1 check failed
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.

Implement "Tick-by-Tick" Export for Audit

2 participants