-
Notifications
You must be signed in to change notification settings - Fork 778
feat(client): add demo trading #963
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
demo
boolean 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; | ||
} |
Copilot
AI
Sep 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Copilot uses AI. Check for mistakes.
// const url = (this.Options.test) ? this.fapiTest : this.fapi; | ||
const url = this.getFapiUrl(); |
Copilot
AI
Sep 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the commented-out code. Dead code should be deleted rather than commented out.
Copilot uses AI. Check for mistakes.
No description provided.