ccxt 4.1.3 → 4.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,11 @@
1
1
  import bitgetRest from '../bitget.js';
2
2
  import { Int } from '../base/types.js';
3
3
  import Client from '../base/ws/Client.js';
4
+ /**
5
+ * @class bitget
6
+ * @extends Exchange
7
+ * @description watching delivery future markets is not yet implemented (perpertual future / swap is implemented)
8
+ */
4
9
  export default class bitget extends bitgetRest {
5
10
  describe(): any;
6
11
  getWsMarketId(market: any): any;
@@ -11,6 +11,11 @@ import { Precise } from '../base/Precise.js';
11
11
  import { ArrayCache, ArrayCacheBySymbolById, ArrayCacheByTimestamp } from '../base/ws/Cache.js';
12
12
  import { sha256 } from '../static_dependencies/noble-hashes/sha256.js';
13
13
  // ---------------------------------------------------------------------------
14
+ /**
15
+ * @class bitget
16
+ * @extends Exchange
17
+ * @description watching delivery future markets is not yet implemented (perpertual future / swap is implemented)
18
+ */
14
19
  export default class bitget extends bitgetRest {
15
20
  describe() {
16
21
  return this.deepExtend(super.describe(), {
@@ -83,10 +88,10 @@ export default class bitget extends bitgetRest {
83
88
  }
84
89
  else {
85
90
  if (!sandboxMode) {
86
- return market['id'].replace('_UMCBL', '');
91
+ return market['id'].replace('_UMCBL', '').replace('_DMCBL', '').replace('_CMCBL', '');
87
92
  }
88
93
  else {
89
- return market['id'].replace('_SUMCBL', '');
94
+ return market['id'].replace('_SUMCBL', '').replace('_SDMCBL', '').replace('_SCMCBL', '');
90
95
  }
91
96
  }
92
97
  }
@@ -98,15 +103,24 @@ export default class bitget extends bitgetRest {
98
103
  const sandboxMode = this.safeValue(this.options, 'sandboxMode', false);
99
104
  let marketId = this.safeString(arg, 'instId');
100
105
  if (instType === 'sp') {
101
- marketId += '_SPBL';
106
+ marketId = marketId + '_SPBL';
102
107
  }
103
108
  else {
104
- if (!sandboxMode) {
105
- marketId += '_UMCBL';
109
+ let extension = sandboxMode ? '_S' : '_';
110
+ const splitByUSDT = marketId.split('USDT');
111
+ const splitByPERP = marketId.split('PERP');
112
+ const splitByUSDTLength = splitByUSDT.length;
113
+ const splitByPERPLength = splitByPERP.length;
114
+ if (splitByUSDTLength > 1) {
115
+ extension += 'UMCBL';
116
+ }
117
+ else if (splitByPERPLength > 1) {
118
+ extension += 'CMCBL';
106
119
  }
107
120
  else {
108
- marketId += '_SUMCBL';
121
+ extension += 'DMCBL';
109
122
  }
123
+ marketId = marketId + extension;
110
124
  }
111
125
  return marketId;
112
126
  }
@@ -609,6 +623,8 @@ export default class bitget extends bitgetRest {
609
623
  * @method
610
624
  * @name bitget#watchTrades
611
625
  * @description get the list of most recent trades for a particular symbol
626
+ * @see https://bitgetlimited.github.io/apidoc/en/spot/#trades-channel
627
+ * @see https://bitgetlimited.github.io/apidoc/en/mix/#trades-channel
612
628
  * @param {string} symbol unified symbol of the market to fetch trades for
613
629
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
614
630
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -856,7 +856,7 @@ export default class whitebit extends Exchange {
856
856
  // ]
857
857
  // }
858
858
  //
859
- const timestamp = this.parseNumber(Precise.stringMul(this.safeString(response, 'timestamp'), '1000'));
859
+ const timestamp = this.parseToInt(Precise.stringMul(this.safeString(response, 'timestamp'), '1000'));
860
860
  return this.parseOrderBook(response, symbol, timestamp);
861
861
  }
862
862
  async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.1.3",
3
+ "version": "4.1.5",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 130+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.js",
6
6
  "type": "module",