improve: [codex] Set Binance recvWindow by endpoint#3159
improve: [codex] Set Binance recvWindow by endpoint#3159nicholaspai wants to merge 13 commits intomasterfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d1c0a2697f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e1923e0077
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
What changed
getBinanceApiClient()recvWindowpolicy insrc/utils/BinanceUtils.tsrecvWindow = 60000recvWindow = 5000recvWindowbehaviorWhy
The original goal is narrow: avoid Binance
-1021 INVALID_TIMESTAMP/recvWindowerrors without adding unnecessary complexity.After reviewing the signed Binance calls in this repo, the cleanest policy is:
That means we do not need a custom client-side time synchronizer here.
Policy
recvWindow = 5000order()withdraw()recvWindow = 60000tradeFee()depositAddress()allOrders()accountCoins()/capital/config/getalldepositHistory()withdrawHistory()Notes
This is still not a substitute for keeping the host clock reasonably synced. A larger
recvWindowhelps with stale timestamps, but it does not fix the case where the local clock is ahead of Binance.Validation
yarn test test/BinanceUtils.tsyarn eslint src/utils/BinanceUtils.ts src/rebalancer/adapters/binance.ts src/adapter/bridges/BinanceCEXBridge.ts src/adapter/bridges/BinanceCEXNativeBridge.ts src/adapter/l2Bridges/BinanceCEXBridge.ts src/adapter/l2Bridges/BinanceCEXNativeBridge.ts src/finalizer/utils/binance.ts test/BinanceUtils.tsyarn build