Skip to content

Commit c674a42

Browse files
authored
Update EDGE_CASES.md
1 parent 48d4eac commit c674a42

File tree

1 file changed

+11
-57
lines changed

1 file changed

+11
-57
lines changed

docs/EDGE_CASES.md

Lines changed: 11 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -207,82 +207,36 @@ USE_YESTERDAY_AS_END_DATE = True # Don't fetch incomplete today's data
207207

208208
```
209209
┌────────────────────────────────────────────────────────────────────┐
210-
│ Simplified Fetch Pipeline
210+
│ Simplified Fetch Pipeline │
211211
├────────────────────────────────────────────────────────────────────┤
212-
212+
│ │
213213
│ 1. Fetch Top Coins (CryptoCompare) │
214214
│ └── /data/top/mktcapfull │
215215
│ ├── Returns: symbol, name, market_cap, volume │
216216
│ └── Pagination: 100 coins per page │
217-
217+
│ │
218218
│ 2. Filter Coins Locally │
219219
│ ├── Remove wrapped/staked/bridged/stablecoins │
220220
│ └── Export rejected to CSV │
221-
221+
│ │
222222
│ 3. For each filtered coin: │
223223
│ ├── Has cached prices? │
224-
│ │ ├── Up to yesterday? → Skip (cache is current) │
225-
│ │ └── Older? → Fetch incrementally from last_date │
226-
│ └── No cache? → Fetch full history │
227-
224+
│ │ ├── Up to yesterday? → Skip (cache is current)
225+
│ │ └── Older? → Fetch incrementally from last_date
226+
│ └── No cache? → Fetch full history
227+
│ │
228228
│ 4. All fetches end at YESTERDAY (not today) │
229229
│ └── Today's data is incomplete │
230-
230+
│ │
231231
│ 5. Calculate Volume-Weighted TOTAL2 │
232232
│ ├── For each day: rank by volume, take top 30 │
233-
│ └── Weighted average: Σ(price × volume) / Σ(volume) │
234-
233+
│ └── Weighted average: Σ(price × volume) / Σ(volume)
234+
│ │
235235
└────────────────────────────────────────────────────────────────────┘
236236
```
237237

238238
---
239239

240-
## 8. Test Cases
241-
242-
### Token Filtering Tests
243-
244-
```python
245-
class TestTokenFiltering:
246-
def test_filters_wrapped_tokens(self):
247-
"""wBTC, wETH, etc. should be excluded."""
248-
249-
def test_filters_staked_tokens(self):
250-
"""stETH, JitoSOL, etc. should be excluded."""
251-
252-
def test_allows_legitimate_tokens(self):
253-
"""SUI, SEI, STX, etc. should pass filtering."""
254-
```
255-
256-
### Incremental Fetching Tests
257-
258-
```python
259-
class TestIncrementalFetching:
260-
def test_incremental_fetch_merges_correctly(self):
261-
"""New data should merge with existing cache."""
262-
263-
def test_no_fetch_when_cache_current(self):
264-
"""Should skip fetch if cache is up to yesterday."""
265-
266-
def test_full_fetch_when_no_cache(self):
267-
"""Should fetch full history when no cache exists."""
268-
```
269-
270-
### Volume-Weighted TOTAL2 Tests
271-
272-
```python
273-
class TestVolumeWeightedTotal2:
274-
def test_ranks_by_volume(self):
275-
"""Coins should be ranked by 24h volume, not market cap."""
276-
277-
def test_weighted_average_calculation(self):
278-
"""TOTAL2 should be volume-weighted average of prices."""
279-
280-
def test_excludes_stablecoins(self):
281-
"""Stablecoins should not be included in TOTAL2."""
282-
```
283-
284-
---
285-
286240
*Document created: 2025-12-03*
287241
*Updated: 2025-12-03 (simplified for single data source)*
288242

0 commit comments

Comments
 (0)