Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
27 changes: 18 additions & 9 deletions src/exchanges/bitmart.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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 }
Expand Down