ccxt 4.0.68 → 4.0.70

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.
package/dist/cjs/ccxt.js CHANGED
@@ -180,7 +180,7 @@ var woo$1 = require('./src/pro/woo.js');
180
180
 
181
181
  //-----------------------------------------------------------------------------
182
182
  // this is updated by vss.js when building
183
- const version = '4.0.68';
183
+ const version = '4.0.70';
184
184
  Exchange["default"].ccxtVersion = version;
185
185
  const exchanges = {
186
186
  'ace': ace,
@@ -2221,6 +2221,7 @@ class bitget extends bitget$1 {
2221
2221
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
2222
2222
  * @param {int} [limit] the maximum amount of trades to fetch
2223
2223
  * @param {object} [params] extra parameters specific to the bitget api endpoint
2224
+ * @param {int} [params.until] the latest time in ms to fetch deposits for
2224
2225
  * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/en/latest/manual.html?#public-trades}
2225
2226
  */
2226
2227
  await this.loadMarkets();
@@ -2231,9 +2232,19 @@ class bitget extends bitget$1 {
2231
2232
  if (limit !== undefined) {
2232
2233
  request['limit'] = limit;
2233
2234
  }
2235
+ const until = this.safeInteger2(params, 'until', 'endTime');
2234
2236
  if (since !== undefined) {
2235
2237
  request['startTime'] = since;
2238
+ if (until === undefined) {
2239
+ const now = this.milliseconds();
2240
+ request['endTime'] = now;
2241
+ }
2236
2242
  }
2243
+ if (until !== undefined) {
2244
+ this.checkRequiredArgument('fetchTrades', since, 'since');
2245
+ request['endTime'] = until;
2246
+ }
2247
+ params = this.omit(params, 'until');
2237
2248
  const options = this.safeValue(this.options, 'fetchTrades', {});
2238
2249
  let response = undefined;
2239
2250
  if (market['spot']) {
@@ -4590,8 +4601,14 @@ class bitget extends bitget$1 {
4590
4601
  */
4591
4602
  this.checkRequiredSymbol('setMarginMode', symbol);
4592
4603
  marginMode = marginMode.toLowerCase();
4604
+ if (marginMode === 'isolated') {
4605
+ marginMode = 'fixed';
4606
+ }
4607
+ if (marginMode === 'cross') {
4608
+ marginMode = 'crossed';
4609
+ }
4593
4610
  if ((marginMode !== 'fixed') && (marginMode !== 'crossed')) {
4594
- throw new errors.ArgumentsRequired(this.id + ' setMarginMode() marginMode must be "fixed" or "crossed"');
4611
+ throw new errors.ArgumentsRequired(this.id + ' setMarginMode() marginMode must be either fixed (isolated) or crossed (cross)');
4595
4612
  }
4596
4613
  await this.loadMarkets();
4597
4614
  const market = this.market(symbol);
@@ -62,7 +62,7 @@ class gate extends gate$1 {
62
62
  },
63
63
  },
64
64
  'referral': {
65
- 'url': 'https://www.gate.io/ref/2436035',
65
+ 'url': 'https://www.gate.io/signup/2436035',
66
66
  'discount': 0.2,
67
67
  },
68
68
  },
@@ -28,16 +28,10 @@ class okx extends okx$1 {
28
28
  },
29
29
  'urls': {
30
30
  'api': {
31
- 'ws': {
32
- 'public': 'wss://ws.okx.com:8443/ws/v5/public',
33
- 'private': 'wss://ws.okx.com:8443/ws/v5/private', // wss://wsaws.okx.com:8443/ws/v5/private
34
- },
31
+ 'ws': 'wss://ws.okx.com:8443/ws/v5',
35
32
  },
36
33
  'test': {
37
- 'ws': {
38
- 'public': 'wss://wspap.okx.com:8443/ws/v5/public?brokerId=9999',
39
- 'private': 'wss://wspap.okx.com:8443/ws/v5/private?brokerId=9999',
40
- },
34
+ 'ws': 'wss://wspap.okx.com:8443/ws/v5',
41
35
  },
42
36
  },
43
37
  'options': {
@@ -99,13 +93,25 @@ class okx extends okx$1 {
99
93
  },
100
94
  });
101
95
  }
96
+ getUrl(channel, access = 'public') {
97
+ // for context: https://www.okx.com/help-center/changes-to-v5-api-websocket-subscription-parameter-and-url
98
+ const isPublic = (access === 'public');
99
+ const url = this.urls['api']['ws'];
100
+ if ((channel.indexOf('candle') > -1) || (channel === 'orders-algo')) {
101
+ return url + '/business';
102
+ }
103
+ else if (isPublic) {
104
+ return url + '/public';
105
+ }
106
+ return url + '/private';
107
+ }
102
108
  async subscribeMultiple(access, channel, symbols = undefined, params = {}) {
103
109
  await this.loadMarkets();
104
110
  if (symbols === undefined) {
105
111
  symbols = this.symbols;
106
112
  }
107
113
  symbols = this.marketSymbols(symbols);
108
- const url = this.urls['api']['ws'][access];
114
+ const url = this.getUrl(channel, access);
109
115
  let messageHash = channel;
110
116
  const args = [];
111
117
  messageHash += '::' + symbols.join(',');
@@ -125,7 +131,7 @@ class okx extends okx$1 {
125
131
  }
126
132
  async subscribe(access, messageHash, channel, symbol, params = {}) {
127
133
  await this.loadMarkets();
128
- const url = this.urls['api']['ws'][access];
134
+ const url = this.getUrl(channel, access);
129
135
  const firstArgument = {
130
136
  'channel': channel,
131
137
  };
@@ -597,7 +603,7 @@ class okx extends okx$1 {
597
603
  this.checkRequiredCredentials();
598
604
  const access = this.safeString(params, 'access', 'private');
599
605
  params = this.omit(params, ['access']);
600
- const url = this.urls['api']['ws'][access];
606
+ const url = this.getUrl('users', access);
601
607
  const messageHash = 'authenticated';
602
608
  const client = this.client(url);
603
609
  let future = this.safeValue(client.subscriptions, messageHash);
@@ -988,7 +994,7 @@ class okx extends okx$1 {
988
994
  */
989
995
  await this.loadMarkets();
990
996
  await this.authenticate();
991
- const url = this.urls['api']['ws']['private'];
997
+ const url = this.getUrl('private', 'private');
992
998
  const messageHash = this.nonce().toString();
993
999
  let op = undefined;
994
1000
  [op, params] = this.handleOptionAndParams(params, 'createOrderWs', 'op', 'batch-orders');
@@ -1057,7 +1063,7 @@ class okx extends okx$1 {
1057
1063
  */
1058
1064
  await this.loadMarkets();
1059
1065
  await this.authenticate();
1060
- const url = this.urls['api']['ws']['private'];
1066
+ const url = this.getUrl('private', 'private');
1061
1067
  const messageHash = this.nonce().toString();
1062
1068
  let op = undefined;
1063
1069
  [op, params] = this.handleOptionAndParams(params, 'editOrderWs', 'op', 'amend-order');
@@ -1086,7 +1092,7 @@ class okx extends okx$1 {
1086
1092
  }
1087
1093
  await this.loadMarkets();
1088
1094
  await this.authenticate();
1089
- const url = this.urls['api']['ws']['private'];
1095
+ const url = this.getUrl('private', 'private');
1090
1096
  const messageHash = this.nonce().toString();
1091
1097
  const clientOrderId = this.safeString2(params, 'clOrdId', 'clientOrderId');
1092
1098
  params = this.omit(params, ['clientOrderId', 'clOrdId']);
@@ -1126,7 +1132,7 @@ class okx extends okx$1 {
1126
1132
  }
1127
1133
  await this.loadMarkets();
1128
1134
  await this.authenticate();
1129
- const url = this.urls['api']['ws']['private'];
1135
+ const url = this.getUrl('private', 'private');
1130
1136
  const messageHash = this.nonce().toString();
1131
1137
  const args = [];
1132
1138
  for (let i = 0; i < idsLength; i++) {
@@ -1162,7 +1168,7 @@ class okx extends okx$1 {
1162
1168
  if (market['type'] !== 'option') {
1163
1169
  throw new errors.BadRequest(this.id + 'cancelAllOrdersWs is only applicable to Option in Portfolio Margin mode, and MMP privilege is required.');
1164
1170
  }
1165
- const url = this.urls['api']['ws']['private'];
1171
+ const url = this.getUrl('private', 'private');
1166
1172
  const messageHash = this.nonce().toString();
1167
1173
  const request = {
1168
1174
  'id': messageHash,
package/js/ccxt.d.ts CHANGED
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
4
4
  import * as errors from './src/base/errors.js';
5
5
  import { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending } from './src/base/errors.js';
7
- declare const version = "4.0.67";
7
+ declare const version = "4.0.69";
8
8
  import ace from './src/ace.js';
9
9
  import alpaca from './src/alpaca.js';
10
10
  import ascendex from './src/ascendex.js';
package/js/ccxt.js CHANGED
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
38
38
  import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.0.68';
41
+ const version = '4.0.70';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
package/js/src/bitget.js CHANGED
@@ -2224,6 +2224,7 @@ export default class bitget extends Exchange {
2224
2224
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
2225
2225
  * @param {int} [limit] the maximum amount of trades to fetch
2226
2226
  * @param {object} [params] extra parameters specific to the bitget api endpoint
2227
+ * @param {int} [params.until] the latest time in ms to fetch deposits for
2227
2228
  * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/en/latest/manual.html?#public-trades}
2228
2229
  */
2229
2230
  await this.loadMarkets();
@@ -2234,9 +2235,19 @@ export default class bitget extends Exchange {
2234
2235
  if (limit !== undefined) {
2235
2236
  request['limit'] = limit;
2236
2237
  }
2238
+ const until = this.safeInteger2(params, 'until', 'endTime');
2237
2239
  if (since !== undefined) {
2238
2240
  request['startTime'] = since;
2241
+ if (until === undefined) {
2242
+ const now = this.milliseconds();
2243
+ request['endTime'] = now;
2244
+ }
2239
2245
  }
2246
+ if (until !== undefined) {
2247
+ this.checkRequiredArgument('fetchTrades', since, 'since');
2248
+ request['endTime'] = until;
2249
+ }
2250
+ params = this.omit(params, 'until');
2240
2251
  const options = this.safeValue(this.options, 'fetchTrades', {});
2241
2252
  let response = undefined;
2242
2253
  if (market['spot']) {
@@ -4593,8 +4604,14 @@ export default class bitget extends Exchange {
4593
4604
  */
4594
4605
  this.checkRequiredSymbol('setMarginMode', symbol);
4595
4606
  marginMode = marginMode.toLowerCase();
4607
+ if (marginMode === 'isolated') {
4608
+ marginMode = 'fixed';
4609
+ }
4610
+ if (marginMode === 'cross') {
4611
+ marginMode = 'crossed';
4612
+ }
4596
4613
  if ((marginMode !== 'fixed') && (marginMode !== 'crossed')) {
4597
- throw new ArgumentsRequired(this.id + ' setMarginMode() marginMode must be "fixed" or "crossed"');
4614
+ throw new ArgumentsRequired(this.id + ' setMarginMode() marginMode must be either fixed (isolated) or crossed (cross)');
4598
4615
  }
4599
4616
  await this.loadMarkets();
4600
4617
  const market = this.market(symbol);
package/js/src/gate.js CHANGED
@@ -65,7 +65,7 @@ export default class gate extends Exchange {
65
65
  },
66
66
  },
67
67
  'referral': {
68
- 'url': 'https://www.gate.io/ref/2436035',
68
+ 'url': 'https://www.gate.io/signup/2436035',
69
69
  'discount': 0.2,
70
70
  },
71
71
  },
@@ -3,6 +3,7 @@ import { Int, OrderSide, OrderType } from '../base/types.js';
3
3
  import Client from '../base/ws/Client.js';
4
4
  export default class okx extends okxRest {
5
5
  describe(): any;
6
+ getUrl(channel: string, access?: string): string;
6
7
  subscribeMultiple(access: any, channel: any, symbols?: string[], params?: {}): Promise<any>;
7
8
  subscribe(access: any, messageHash: any, channel: any, symbol: any, params?: {}): Promise<any>;
8
9
  watchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
package/js/src/pro/okx.js CHANGED
@@ -31,16 +31,10 @@ export default class okx extends okxRest {
31
31
  },
32
32
  'urls': {
33
33
  'api': {
34
- 'ws': {
35
- 'public': 'wss://ws.okx.com:8443/ws/v5/public',
36
- 'private': 'wss://ws.okx.com:8443/ws/v5/private', // wss://wsaws.okx.com:8443/ws/v5/private
37
- },
34
+ 'ws': 'wss://ws.okx.com:8443/ws/v5',
38
35
  },
39
36
  'test': {
40
- 'ws': {
41
- 'public': 'wss://wspap.okx.com:8443/ws/v5/public?brokerId=9999',
42
- 'private': 'wss://wspap.okx.com:8443/ws/v5/private?brokerId=9999',
43
- },
37
+ 'ws': 'wss://wspap.okx.com:8443/ws/v5',
44
38
  },
45
39
  },
46
40
  'options': {
@@ -102,13 +96,25 @@ export default class okx extends okxRest {
102
96
  },
103
97
  });
104
98
  }
99
+ getUrl(channel, access = 'public') {
100
+ // for context: https://www.okx.com/help-center/changes-to-v5-api-websocket-subscription-parameter-and-url
101
+ const isPublic = (access === 'public');
102
+ const url = this.urls['api']['ws'];
103
+ if ((channel.indexOf('candle') > -1) || (channel === 'orders-algo')) {
104
+ return url + '/business';
105
+ }
106
+ else if (isPublic) {
107
+ return url + '/public';
108
+ }
109
+ return url + '/private';
110
+ }
105
111
  async subscribeMultiple(access, channel, symbols = undefined, params = {}) {
106
112
  await this.loadMarkets();
107
113
  if (symbols === undefined) {
108
114
  symbols = this.symbols;
109
115
  }
110
116
  symbols = this.marketSymbols(symbols);
111
- const url = this.urls['api']['ws'][access];
117
+ const url = this.getUrl(channel, access);
112
118
  let messageHash = channel;
113
119
  const args = [];
114
120
  messageHash += '::' + symbols.join(',');
@@ -128,7 +134,7 @@ export default class okx extends okxRest {
128
134
  }
129
135
  async subscribe(access, messageHash, channel, symbol, params = {}) {
130
136
  await this.loadMarkets();
131
- const url = this.urls['api']['ws'][access];
137
+ const url = this.getUrl(channel, access);
132
138
  const firstArgument = {
133
139
  'channel': channel,
134
140
  };
@@ -600,7 +606,7 @@ export default class okx extends okxRest {
600
606
  this.checkRequiredCredentials();
601
607
  const access = this.safeString(params, 'access', 'private');
602
608
  params = this.omit(params, ['access']);
603
- const url = this.urls['api']['ws'][access];
609
+ const url = this.getUrl('users', access);
604
610
  const messageHash = 'authenticated';
605
611
  const client = this.client(url);
606
612
  let future = this.safeValue(client.subscriptions, messageHash);
@@ -991,7 +997,7 @@ export default class okx extends okxRest {
991
997
  */
992
998
  await this.loadMarkets();
993
999
  await this.authenticate();
994
- const url = this.urls['api']['ws']['private'];
1000
+ const url = this.getUrl('private', 'private');
995
1001
  const messageHash = this.nonce().toString();
996
1002
  let op = undefined;
997
1003
  [op, params] = this.handleOptionAndParams(params, 'createOrderWs', 'op', 'batch-orders');
@@ -1060,7 +1066,7 @@ export default class okx extends okxRest {
1060
1066
  */
1061
1067
  await this.loadMarkets();
1062
1068
  await this.authenticate();
1063
- const url = this.urls['api']['ws']['private'];
1069
+ const url = this.getUrl('private', 'private');
1064
1070
  const messageHash = this.nonce().toString();
1065
1071
  let op = undefined;
1066
1072
  [op, params] = this.handleOptionAndParams(params, 'editOrderWs', 'op', 'amend-order');
@@ -1089,7 +1095,7 @@ export default class okx extends okxRest {
1089
1095
  }
1090
1096
  await this.loadMarkets();
1091
1097
  await this.authenticate();
1092
- const url = this.urls['api']['ws']['private'];
1098
+ const url = this.getUrl('private', 'private');
1093
1099
  const messageHash = this.nonce().toString();
1094
1100
  const clientOrderId = this.safeString2(params, 'clOrdId', 'clientOrderId');
1095
1101
  params = this.omit(params, ['clientOrderId', 'clOrdId']);
@@ -1129,7 +1135,7 @@ export default class okx extends okxRest {
1129
1135
  }
1130
1136
  await this.loadMarkets();
1131
1137
  await this.authenticate();
1132
- const url = this.urls['api']['ws']['private'];
1138
+ const url = this.getUrl('private', 'private');
1133
1139
  const messageHash = this.nonce().toString();
1134
1140
  const args = [];
1135
1141
  for (let i = 0; i < idsLength; i++) {
@@ -1165,7 +1171,7 @@ export default class okx extends okxRest {
1165
1171
  if (market['type'] !== 'option') {
1166
1172
  throw new BadRequest(this.id + 'cancelAllOrdersWs is only applicable to Option in Portfolio Margin mode, and MMP privilege is required.');
1167
1173
  }
1168
- const url = this.urls['api']['ws']['private'];
1174
+ const url = this.getUrl('private', 'private');
1169
1175
  const messageHash = this.nonce().toString();
1170
1176
  const request = {
1171
1177
  'id': messageHash,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.0.68",
3
+ "version": "4.0.70",
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",