Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions .github/ISSUE_TEMPLATE/issue_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,24 @@

<!-- List the specific requirements that need to be met to resolve this issue. -->

-
-
-
-
-
-

## 🎯 Acceptance Criteria

<!-- Define the specific conditions that must be met for this issue to be considered complete. -->

- [ ]
- [ ]
- [ ]
- [ ]
- [ ]
- [ ]

## πŸ“ Expected files to change/structure

<!-- Define the files that are expected to change or the expected structure of the project update. -->

-
-
-

---
- ***

Thank you for taking this issue! You are helping us make RWAs consumer friendly on Stellar.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,12 @@ Before pushing, verify that the full CI pipeline passes locally:
npm ci && npm run lint && npm run check-types && npm run build && npm test
```

| Command | What it does |
|----------------------|---------------------------------------------------|
| `npm run lint` | Runs ESLint across all workspaces via Turborepo |
| `npm run check-types`| Runs `tsc --noEmit` in all TypeScript workspaces |
| `npm run build` | Builds all apps and packages via Turborepo |
| `npm test` | Runs Jest tests in all workspaces |
| Command | What it does |
| --------------------- | ------------------------------------------------ |
| `npm run lint` | Runs ESLint across all workspaces via Turborepo |
| `npm run check-types` | Runs `tsc --noEmit` in all TypeScript workspaces |
| `npm run build` | Builds all apps and packages via Turborepo |
| `npm test` | Runs Jest tests in all workspaces |

CI runs these same steps automatically on every push and PR to `main` and `develop`.

Expand Down
9 changes: 9 additions & 0 deletions apps/aggregator/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,12 @@ INGESTOR_HTTP_URL=http://localhost:3000

# Signer Service (for publishing aggregated data)
SIGNER_URL=http://localhost:3002

# Outlier Detection Configuration
OUTLIER_MIN_PRICE=0
OUTLIER_MAX_CHANGE_PERCENT=50
OUTLIER_MAX_CHANGE_WINDOW_SECONDS=10
OUTLIER_IQR_MULTIPLIER=1.5
OUTLIER_ZSCORE_THRESHOLD=3
OUTLIER_MAD_THRESHOLD=3.5
OUTLIER_MIN_SAMPLES=3
38 changes: 27 additions & 11 deletions apps/aggregator/IMPLEMENTATION_SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,28 @@
### Core Implementation

βœ… **AggregationService** - Main service for calculating consensus prices

- Configurable minimum source requirements
- Time window filtering (configurable, default 30s)
- Multiple aggregation method support
- Batch processing for multiple symbols
- Comprehensive error handling and validation

βœ… **Aggregation Strategies** (Strategy Pattern)

- **Weighted Average**: Rewards trusted sources, smooth consensus
- **Median**: Resistant to outliers, manipulation-proof
- **Trimmed Mean**: Balanced approach removing extremes

βœ… **Confidence Metrics**

- Standard deviation calculation
- Price spread (min/max percentage)
- Variance measurement
- Confidence score (0-100) based on source count, spread, and deviation

βœ… **Configuration System**

- Source weight configuration (per-source reliability)
- Environment variable support
- Custom weight overrides at runtime
Expand All @@ -31,12 +35,14 @@
### Testing

βœ… **Comprehensive Test Coverage: 88.88%**

- 69 test cases total
- Services: 97.7% coverage
- Strategies: 98.24% coverage
- Config: 100% coverage

Test Suites:

- `aggregation.service.spec.ts` - 37 tests
- `weighted-average.aggregator.spec.ts` - 10 tests
- `median.aggregator.spec.ts` - 12 tests
Expand All @@ -45,18 +51,21 @@ Test Suites:
### Documentation

βœ… **Comprehensive README.md**

- Detailed method explanations with use cases
- Configuration guide
- Usage examples
- API documentation
- Performance considerations

βœ… **Code Documentation**

- TSDoc comments on all public methods
- Interface documentation
- Inline comments explaining algorithms

βœ… **Demo Script**

- 5 real-world scenarios
- Shows all aggregation methods
- Demonstrates confidence scoring
Expand All @@ -65,49 +74,56 @@ Test Suites:
## πŸ“ Files Created/Modified

### Interfaces

- `src/interfaces/normalized-price.interface.ts` - Input data structure
- `src/interfaces/aggregated-price.interface.ts` - Output data structure
- `src/interfaces/aggregator.interface.ts` - Strategy pattern interface
- `src/interfaces/aggregation-config.interface.ts` - Configuration types

### Strategies

- `src/strategies/aggregators/weighted-average.aggregator.ts` - Weighted average implementation
- `src/strategies/aggregators/median.aggregator.ts` - Median implementation
- `src/strategies/aggregators/trimmed-mean.aggregator.ts` - Trimmed mean implementation

### Services

- `src/services/aggregation.service.ts` - Main aggregation service
- `src/services/aggregation.service.spec.ts` - Service tests

### Configuration

- `src/config/source-weights.config.ts` - Source reliability weights
- `.env.example` - Environment configuration template

### Tests

- `src/strategies/aggregators/weighted-average.aggregator.spec.ts`
- `src/strategies/aggregators/median.aggregator.spec.ts`
- `src/strategies/aggregators/trimmed-mean.aggregator.spec.ts`

### Documentation

- `README.md` - Comprehensive documentation (updated)
- `src/demo.ts` - Interactive demo script

### Module Configuration

- `src/app.module.ts` - Updated with new providers

## 🎯 Acceptance Criteria Status

| Criteria | Status |
|----------|--------|
| Service correctly calculates weighted average | βœ… |
| Service correctly calculates median | βœ… |
| Service calculates trimmed mean by discarding extremes | βœ… |
| Confidence metrics produced (std dev, spread, confidence 0-100) | βœ… |
| Minimum 3 sources required (configurable) | βœ… |
| Weights per source configurable | βœ… |
| Start and end timestamps added | βœ… |
| Unit tests exist with >85% coverage | βœ… 88.88% |
| Methods documented | βœ… |
| Criteria | Status |
| --------------------------------------------------------------- | --------- |
| Service correctly calculates weighted average | βœ… |
| Service correctly calculates median | βœ… |
| Service calculates trimmed mean by discarding extremes | βœ… |
| Confidence metrics produced (std dev, spread, confidence 0-100) | βœ… |
| Minimum 3 sources required (configurable) | βœ… |
| Weights per source configurable | βœ… |
| Start and end timestamps added | βœ… |
| Unit tests exist with >85% coverage | βœ… 88.88% |
| Methods documented | βœ… |

## πŸ“Š Demo Results

Expand Down
Loading