fix: cherry-pick 429 rate limiting fix with coin naming convention#25443
fix: cherry-pick 429 rate limiting fix with coin naming convention#25443joaoloureirop merged 3 commits intorelease/7.62.2from
Conversation
Cherry-pick commit 425beae (Nick's 429 rate limiting fix) adapted for release/7.62.2 branch which uses 'coin' naming instead of 'symbol'. Key changes: - Add cache-first patterns in HyperLiquidProvider to reduce API weight - Add optional position param to updatePositionTPSL to skip REST fetch - Add atomic cache getter getOrdersCacheIfInitialized() to prevent race conditions - Add getOrFetchPrice helper for WebSocket-first price retrieval - Add getOrFetchFills for cache-first fills retrieval - Add positionOpenedTimestamp to useHasExistingPosition hook - Sync currentPositionRef in PerpsMarketDetailsView for stale closure prevention Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
🔍 Smart E2E Test Selection⏭️ Smart E2E selection skipped - base branch is not main (base: release/7.62.2) All E2E tests pre-selected. |
aganglada
left a comment
There was a problem hiding this comment.
Tested, cannot repro 🙌
| // Apply symbol filter to REST results for consistent API behavior | ||
| // Note: getOrderFills doesn't support symbol filtering natively | ||
| return this.filterFills(restFills, params); | ||
| } |
There was a problem hiding this comment.
Public method getOrFetchFills is never called in production
Low Severity
The public method getOrFetchFills is added to the IPerpsProvider interface and fully implemented with supporting infrastructure (filterFills helper, GetOrFetchFillsParams type), but it's only called in test files—never in actual production code. This adds dead code that increases maintenance burden. The method's documentation states it's meant to "prevent 429 errors during rapid market switching by reusing cached fills," but no code path actually invokes it.
Additional Locations (1)
|
|
No release label on PR. Adding release label release-7.62.2 on PR, as PR was cherry-picked in branch 7.62.2. |




Description
Cherry-pick of commit 425beae (Nick's 429 rate limiting fix) to release/7.62.2 branch.
This hotfix addresses HyperLiquid WebSocket rate limiting issues (429 errors) that occur during rapid market switching or TP/SL updates. The fix introduces cache-first patterns to reduce API weight and avoid hitting rate limits.
Key changes:
positionparameter toupdatePositionTPSLto skip REST API fetch when WebSocket data is availablegetOrFetchPricehelper for WebSocket-first price retrieval (0 weight vs 20 weight)getOrdersCacheIfInitialized()to prevent race conditionsgetOrFetchFillsfor cache-first fills retrievalpositionOpenedTimestampcalculation intouseHasExistingPositionhookcurrentPositionRefsync in PerpsMarketDetailsView to prevent stale closure issuesConflict resolution notes:
The main branch uses
symbolnaming convention while release/7.62.2 usescoin. All conflicts were resolved by keeping thecoinnaming convention while adopting the cache-first optimization patterns.Changelog
CHANGELOG entry: Fixed rate limiting issues (429 errors) when rapidly switching markets or updating TP/SL orders
Related issues
Fixes: Rate limiting issues on HyperLiquid API during rapid market navigation
Manual testing steps
Screenshots/Recordings
Before
N/A - Bug fix for rate limiting, no visual changes
After
N/A - Bug fix for rate limiting, no visual changes
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Touches perps trading/provider logic (
updatePositionTPSL, order/price/fill retrieval) and async UI state around stop-loss actions, so regressions could impact TP/SL updates or stale-data handling, but changes are bounded and add explicit fallbacks/tests.Overview
Goal: reduce HyperLiquid REST API weight (and 429s) during rapid market switching and TP/SL operations by preferring WebSocket caches.
Adds cache-first primitives in
HyperLiquidSubscriptionService(fills cache + atomicgetOrdersCacheIfInitialized) andHyperLiquidProvider(getOrFetchPrice,getOrFetchFills), and refactors provider call sites to use these helpers with stricter invalid-price validation and single-DEX REST fallbacks.Updates TP/SL flow to pass live WebSocket
positionintoupdatePositionTPSL(avoiding a REST positions fetch), uses cached orders to cancel existing TP/SL when available, and surfaces partial-failure feedback inPerpsOrderViewwhen order succeeds but TP/SL update fails.Moves
positionOpenedTimestampderivation intouseHasExistingPosition(WebSocket fills first, REST historical fallback), and hardensPerpsMarketDetailsViewstop-loss banner interactions against stale closures/market switches; the banner UI switches from aSwitchto a "Set" button with a delayed success checkmark + fade-out. Tests and test IDs are updated accordingly.Written by Cursor Bugbot for commit 0edee81. This will update automatically on new commits. Configure here.