This repository was archived by the owner on Jul 28, 2026. It is now read-only.
feat(v2.2.0): support demo trading - #64
Merged
Merged
Conversation
tiagosiebler
suggested changes
Dec 18, 2025
| apiKey: API_KEY, | ||
| apiSecret: API_SECRET, | ||
| apiMemo: API_MEMO, | ||
| useDemo: true, // Uses https://demo-api-cloud-v2.bitmart.com |
Member
There was a problem hiding this comment.
Can you use the same property name as we have for other exchanges please? E.g.
https://github.com/tiagosiebler/bybit-api/blob/master/examples/demo-trading.ts#L26C3-L26C14
Suggested change
| useDemo: true, // Uses https://demo-api-cloud-v2.bitmart.com | |
| demoTrading: true, // Uses https://demo-api-cloud-v2.bitmart.com |
| apiKey: API_KEY, | ||
| apiSecret: API_SECRET, | ||
| apiMemo: API_MEMO, | ||
| useDemo: true, // Uses wss://openapi-wsdemo-v2.bitmart.com |
Member
There was a problem hiding this comment.
Suggested change
| useDemo: true, // Uses wss://openapi-wsdemo-v2.bitmart.com | |
| demoTrading: true, // Uses wss://openapi-wsdemo-v2.bitmart.com |
| * For V2 Futures: https://demo-api-cloud-v2.bitmart.com | ||
| * Note: The API keys for Simulated-Environment and Prod-Environment are the same. | ||
| */ | ||
| useDemo?: boolean; |
Member
There was a problem hiding this comment.
Suggested change
| useDemo?: boolean; | |
| demoTrading?: boolean; |
| * For V2 Futures WebSocket: wss://openapi-wsdemo-v2.bitmart.com | ||
| * Note: The API keys for Simulated-Environment and Prod-Environment are the same. | ||
| */ | ||
| useDemo?: boolean; |
Member
There was a problem hiding this comment.
Suggested change
| useDemo?: boolean; | |
| demoTrading?: boolean; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary: BitMart API Updates - New Endpoints & Demo Trading Support
Overview
This PR implements updates from BitMart's API changelog (2025-11-18 to 2025-12-11), adding new endpoints, updating existing ones, and introducing demo/simulated trading environment support.
Changes
1. Updated
/contract/private/tradesEndpoint (2025-12-02)Files Modified:
src/types/request/futures.types.tsChanges:
order_idandclient_order_idfields toFuturesAccountTradesRequestsymbolfield optional to support querying by order ID or client order ID2. New Affiliate Rebate Endpoints (2025-12-11)
Files Modified:
src/types/request/futures.types.tssrc/types/response/futures.types.tssrc/FuturesClientV2.tsNew Endpoints:
getFuturesAffiliateRebateUser()-/contract/private/affiliate/rebate-usergetFuturesAffiliateRebateApi()-/contract/private/affiliate/rebate-apiNew Types:
FuturesAffiliateRebateUserRequest- Request type for user rebate dataFuturesAffiliateRebateApiRequest- Request type for API rebate dataFuturesAffiliateRebateUserResponse- Response type for user rebate dataFuturesAffiliateRebateApiResponse- Response type for API rebate data3. Simulated Trading / Demo Environment Support (2025-11-18)
Files Modified:
src/types/request/futures.types.tssrc/types/response/futures.types.tssrc/lib/requestUtils.tssrc/lib/websocket/websocket-util.tssrc/types/websockets/client.tssrc/FuturesClientV2.tssrc/WebsocketClient.tsREADME.mdREST API Changes:
useDemooption toRestClientOptionsinterfacegetRestBaseUrl()to support demo environmenthttps://demo-api-cloud-v2.bitmart.comsubmitFuturesSimulatedClaim()method for simulated account claimSubmitFuturesSimulatedClaimRequest,FuturesSimulatedClaimResponseWebSocket Changes:
useDemooption toWSClientConfigurableOptionsinterfaceWS_BASE_URL_MAPto include demo URLs for V2 FuturesgetWsUrl()method to support demo environmentwss://openapi-wsdemo-v2.bitmart.com/api?protocol=1.1wss://openapi-wsdemo-v2.bitmart.com/user?protocol=1.1Documentation:
Usage Examples
New Affiliate Rebate Endpoints
Updated Trades Endpoint
Demo Trading Environment
Breaking Changes
None - all changes are backward compatible.
Notes
baseUrl/wsUrloverride still takes precedence overuseDemoflagTesting