diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..273d619 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,7 @@ +# Changelog + +All notable changes to this project will be documented here. + +[1.2.1] - 2025-04-05 + +* Bitmart: Update products endpoint for Futures pairs to v2 \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index cdabdfe..8907e12 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "aggr-server", - "version": "1.1.0", + "version": "1.2.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "aggr-server", - "version": "1.1.0", + "version": "1.2.1", "license": "ISC", "dependencies": { "axios": "^1.4.0", diff --git a/package.json b/package.json index fd7b8ff..9a52a79 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aggr-server", - "version": "1.2.0", + "version": "1.2.1", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", diff --git a/src/exchanges/bitmart.js b/src/exchanges/bitmart.js index 70b83cb..bfe033d 100644 --- a/src/exchanges/bitmart.js +++ b/src/exchanges/bitmart.js @@ -5,7 +5,7 @@ const axios = require('axios') const { inflateRaw } = require('pako') const WS_API_SPOT = 'wss://ws-manager-compress.bitmart.com/api?protocol=1.1' -const WS_API_FUTURES = 'wss://openapi-ws.bitmart.com/api?protocol=1.1' +const WS_API_FUTURES = 'wss://openapi-ws-v2.bitmart.com/api?protocol=1.1' /** * Bitmart class representing the Bitmart exchange. @@ -35,7 +35,7 @@ class Bitmart extends Exchange { */ PRODUCTS: [ 'https://api-cloud.bitmart.com/spot/v1/symbols/details', - 'https://api-cloud.bitmart.com/contract/public/details' + 'https://api-cloud-v2.bitmart.com/contract/public/details' ], SPOT: { RECENT_TRADES: 'https://api-cloud.bitmart.com/spot/quotation/v3/trades' @@ -67,13 +67,22 @@ class Bitmart extends Exchange { const types = {} for (const response of responses) { - for (const product of response.data.symbols) { - products.push(product.symbol) - - if (product.contract_size) { - specs[product.symbol] = +product.contract_size - } - } + const {code} = response + const {symbols} = response.data + + if (code !== 1000) { + continue + } + + if (Array.isArray(symbols) && symbols.length > 0 ) { + for (const product of response.data.symbols) { + products.push(product.symbol) + + if (product.contract_size) { + specs[product.symbol] = +product.contract_size + } + } + } } return { products, specs, types }