118. External Reference for TA Validation
Status: Accepted Date: 2025-07-06
Context
The Minerva module is responsible for calculating a wide range of technical analysis (TA) indicators. The correctness of these calculations is absolutely critical, as they are a fundamental input to many of our trading and analysis strategies. A bug in our RSI calculation, for example, could have disastrous consequences.
While we have unit tests for these calculations, it's possible for there to be subtle bugs, or for our implementation to differ slightly from the industry-standard interpretation of a given indicator. We need a way to continuously validate our calculations against an objective, external "source of truth".
Decision
The Maat module will include a TAValidationService that validates our internal TA calculations against an external, third-party reference service. We have chosen TAAPI.io for this purpose.
On a scheduled basis, or as part of a validation workflow, Maat will:
- Request a specific indicator for a specific market and timeframe from our internal
MinervaService. - Make a parallel request for the exact same indicator, market, and timeframe from the TAAPI.io API.
- Compare the two results.
- If the discrepancy is outside a predefined acceptable tolerance, it will be flagged as a "Bad Signal" candidate and included in the
Maatvalidation report for human review.
This provides an ongoing, automated audit of our most critical calculations against an independent, industry-standard source.
Consequences
Positive:
- Objective Validation: Provides strong, objective proof that our TA calculations are correct and match industry standards. This builds enormous trust in the system's foundational data.
- Early Bug Detection: Can catch subtle bugs or deviations in our TA implementations that might be missed by unit tests.
- Living Documentation: The validation results serve as a form of "living documentation", continuously proving the correctness of our indicator library.
Negative:
- External Dependency: Creates a dependency on the TAAPI.io service. If their service is down or returns incorrect data, our validation process will fail or produce false positives.
- Cost: The TAAPI.io service is a paid, commercial product. This adds a direct operational cost to our quality assurance process.
- Data Synchronization: There can sometimes be minor discrepancies due to differences in the exact OHLCV data feed or the precise timing of the calculation.
Mitigation:
- Error Handling and Fallbacks: Our
TAValidationServicewill be built with robust error handling. If the TAAPI.io API is unavailable, the validation check will be skipped and logged, it will not block our system from functioning. We will only flag a discrepancy if we successfully receive data from both sources. - Cost vs. Benefit: The cost of the external service is considered a necessary and worthwhile investment in quality assurance, given the critical importance of correct TA data. The cost of a trading bug would be far higher.
- Tolerance Thresholds: We will not check for exact equality. Instead, we will define a small, acceptable tolerance for discrepancies to account for minor differences in data feeds or floating-point arithmetic. Discrepancies will only be flagged if they exceed this tolerance.