Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds demo trading functionality to the Binance API client, providing an alternative to the existing testnet support. The implementation introduces a new demo configuration option that routes API calls to Binance's demo trading environment instead of production or testnet endpoints.
- Added
demoboolean configuration option to enable demo trading mode - Implemented URL routing logic to use demo endpoints when demo mode is enabled
- Refactored WebSocket connection logic to use centralized URL getter methods
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/types.ts | Added demo boolean property to the IConstructorArgs interface |
| src/node-binance-api.ts | Added demo endpoint URLs, configuration handling, URL getter methods, and refactored WebSocket connections to use demo endpoints |
| README.md | Updated feature list to include demo trading support and marked testnet as deprecated |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| getSpotUrl() { | ||
| if (this.Options.demo) return this.baseDemo; | ||
| if (this.Options.test) return this.baseTest; | ||
| return this.base; | ||
| } |
There was a problem hiding this comment.
The demo and test options can both be enabled simultaneously, but the current logic prioritizes demo over test. Consider adding validation to prevent both options from being enabled at the same time, or document the precedence behavior clearly.
| // const url = (this.Options.test) ? this.fapiTest : this.fapi; | ||
| const url = this.getFapiUrl(); |
There was a problem hiding this comment.
Remove the commented-out code. Dead code should be deleted rather than commented out.
No description provided.