- Add fetch-datasets.sh wrapper that fetches HIGHER/WETH, DEGEN/WETH, and TOSHI/WETH 30-day event caches via fetch-events.ts; reads INFURA_API_KEY from env and fails with a helpful error if unset - Update .gitignore from cache/ (whole dir) to cache/*.jsonl so the pattern is precise to the generated data files; cache/ is already covered by the repo-root .gitignore via its own cache/ rule JSONL cache files are gitignored and must be generated locally by running ./fetch-datasets.sh with INFURA_API_KEY set. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
53 lines
1.5 KiB
Bash
Executable file
53 lines
1.5 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# fetch-datasets.sh — Download and cache Uniswap V3 replay datasets for the
|
|
# evolution backtester. Re-running is safe: fetch-events.ts has resume support.
|
|
#
|
|
# Usage:
|
|
# INFURA_API_KEY=<key> ./fetch-datasets.sh
|
|
# # or export the variable beforehand:
|
|
# export INFURA_API_KEY=<key>
|
|
# ./fetch-datasets.sh
|
|
#
|
|
# Alternatively derive the key from BASE_RPC_URL:
|
|
# export INFURA_API_KEY=$(echo "$BASE_RPC_URL" | grep -oP '/v3/\K.*')
|
|
|
|
set -euo pipefail
|
|
|
|
: "${INFURA_API_KEY:?INFURA_API_KEY is required. Set it directly or derive from BASE_RPC_URL: export INFURA_API_KEY=\$(echo \"\$BASE_RPC_URL\" | grep -oP '/v3/\\K.*')}"
|
|
|
|
export INFURA_API_KEY
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
cd "$SCRIPT_DIR"
|
|
|
|
mkdir -p cache
|
|
|
|
echo "=== Fetching HIGHER/WETH (last 30 days) ==="
|
|
npx tsx fetch-events.ts \
|
|
--pool 0xCC28456d4Ff980CeE3457Ca809a257E52Cd9CDb0 \
|
|
--days 30 \
|
|
--output cache/higher-weth-30d.jsonl
|
|
|
|
echo "=== Fetching DEGEN/WETH (last 30 days) ==="
|
|
npx tsx fetch-events.ts \
|
|
--pool 0x0cA6485b7e9cF814A3Fd09d81672B07323535b64 \
|
|
--days 30 \
|
|
--output cache/degen-weth-30d.jsonl
|
|
|
|
echo "=== Fetching TOSHI/WETH (last 30 days) ==="
|
|
npx tsx fetch-events.ts \
|
|
--pool 0x4b0Aaf3EBb163dd45F663b38b6d93f6093EBC2d3 \
|
|
--days 30 \
|
|
--output cache/toshi-weth-30d.jsonl
|
|
|
|
echo ""
|
|
echo "=== Done. Event counts: ==="
|
|
for f in cache/higher-weth-30d.jsonl cache/degen-weth-30d.jsonl cache/toshi-weth-30d.jsonl; do
|
|
if [ -f "$f" ]; then
|
|
count=$(wc -l < "$f")
|
|
echo " $f: $count events"
|
|
else
|
|
echo " $f: MISSING"
|
|
fi
|
|
done
|