Skip to content

fix: implement exponential backoff and throttled scanning to resolve 403 rate limits - #14

Merged
kunalrbhatia merged 1 commit into
masterfrom
fix/historical-data-403-rate-limit
May 13, 2026
Merged

fix: implement exponential backoff and throttled scanning to resolve 403 rate limits#14
kunalrbhatia merged 1 commit into
masterfrom
fix/historical-data-403-rate-limit

Conversation

@kunalrbhatia

Copy link
Copy Markdown
Owner

Description

This PR addresses intermittent \403 Forbidden\ and rate-limiting issues encountered during historical data fetching, particularly during the high-load morning scan phase.

Key Changes

  • Resilient API Helper: Introduced a \withRetry\ wrapper in \src/helpers/api.ts\ featuring exponential backoff and specialized handling for Angel One error patterns.
  • Throttled morningScanner: Increased delays between stocks (3s) and historical requests (1s) to respect broker limits.
  • Enhanced Test Coverage: Added exhaustive unit tests for the retry logic.
  • Documentation: Updated README.md and GEMINI.md with resilience details and environment notes.

Verification Results

  • \pnpm lint: Passed
  • \pnpm format: Passed
  • \pnpm typecheck: Passed
  • \pnpm build: Passed
  • \pnpm test --coverage: Passed (141 tests, 100% functional coverage for modified modules)

- Added retry logic in api helper for 403/429 and Angel One 'status: false'.
- Increased scanner delays to respect 3 req/sec limit.
- Enhanced logging with methods and attempts.
- Updated tests for 100% coverage and lint compliance.
- Updated README with resilience details.

Verified with 100% test coverage and full sanity checks.
@kunalrbhatia
kunalrbhatia merged commit dd1e66d into master May 13, 2026
2 checks passed
@kunalrbhatia
kunalrbhatia deleted the fix/historical-data-403-rate-limit branch May 13, 2026 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant