harb/onchain/script/backtesting/package.json
openhands df89b8c2da fix: Backtesting #1: Event fetcher (Infura → JSON Lines cache) (#315)
Add onchain/script/backtesting/fetch-events.ts — a tsx script that:
- Fetches Swap/Mint/Burn events from a Uniswap V3 pool via Infura (Base mainnet)
- Batches eth_getLogs in 2 000-block chunks with 100 ms inter-batch delay
- Decodes each log with viem and writes one JSON Line per event
- Supports resume: reads last block from existing cache file on re-run
- Retries with exponential back-off on 429 / rate-limit errors
- Prints per-batch progress: "Fetching blocks X-Y... N events (B/T batches)"

Also adds package.json, tsconfig.json, and cache/.gitkeep.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-26 22:04:43 +00:00

16 lines
280 B
JSON

{
"name": "backtesting",
"version": "0.0.1",
"type": "module",
"scripts": {
"fetch": "tsx fetch-events.ts"
},
"dependencies": {
"viem": "^2.22.13"
},
"devDependencies": {
"@types/node": "^24.0.0",
"tsx": "^4.19.0",
"typescript": "^5.7.0"
}
}