ccxt 4.1.60 → 4.1.61
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/README.md +3 -3
- package/dist/ccxt.browser.js +330 -107
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/alpaca.js +204 -84
- package/dist/cjs/src/base/Exchange.js +1 -1
- package/dist/cjs/src/binance.js +1 -0
- package/dist/cjs/src/bitrue.js +1 -1
- package/dist/cjs/src/bybit.js +1 -1
- package/dist/cjs/src/coinbase.js +94 -2
- package/dist/cjs/src/gate.js +1 -1
- package/dist/cjs/src/htx.js +7 -1
- package/dist/cjs/src/kuna.js +4 -3
- package/dist/cjs/src/okx.js +13 -10
- package/dist/cjs/src/p2b.js +1 -1
- package/dist/cjs/src/pro/bybit.js +1 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/alpaca.d.ts +66 -16
- package/js/src/abstract/binance.d.ts +1 -0
- package/js/src/abstract/binancecoinm.d.ts +1 -0
- package/js/src/abstract/binanceus.d.ts +1 -0
- package/js/src/abstract/binanceusdm.d.ts +1 -0
- package/js/src/alpaca.js +204 -84
- package/js/src/base/Exchange.js +1 -1
- package/js/src/binance.js +1 -0
- package/js/src/bitrue.js +1 -1
- package/js/src/bybit.js +1 -1
- package/js/src/coinbase.js +94 -2
- package/js/src/gate.js +1 -1
- package/js/src/htx.js +7 -1
- package/js/src/kuna.js +4 -3
- package/js/src/okx.js +13 -10
- package/js/src/p2b.js +1 -1
- package/js/src/pro/bybit.js +1 -1
- package/package.json +1 -1
- package/skip-tests.json +2 -0
package/js/src/alpaca.js
CHANGED
|
@@ -29,16 +29,14 @@ export default class alpaca extends Exchange {
|
|
|
29
29
|
'logo': 'https://user-images.githubusercontent.com/1294454/187234005-b864db3d-f1e3-447a-aaf9-a9fc7b955d07.jpg',
|
|
30
30
|
'www': 'https://alpaca.markets',
|
|
31
31
|
'api': {
|
|
32
|
-
'
|
|
33
|
-
'
|
|
34
|
-
'
|
|
35
|
-
'markets': 'https://api.{hostname}/{version}',
|
|
32
|
+
'broker': 'https://broker-api.{hostname}',
|
|
33
|
+
'trader': 'https://api.{hostname}',
|
|
34
|
+
'market': 'https://data.{hostname}',
|
|
36
35
|
},
|
|
37
36
|
'test': {
|
|
38
|
-
'
|
|
39
|
-
'
|
|
40
|
-
'
|
|
41
|
-
'markets': 'https://api.{hostname}/{version}',
|
|
37
|
+
'broker': 'https://broker-api.sandbox.{hostname}',
|
|
38
|
+
'trader': 'https://paper-api.{hostname}',
|
|
39
|
+
'market': 'https://data.sandbox.{hostname}',
|
|
42
40
|
},
|
|
43
41
|
'doc': 'https://alpaca.markets/docs/',
|
|
44
42
|
'fees': 'https://alpaca.markets/support/what-are-the-fees-associated-with-crypto-trading/',
|
|
@@ -92,37 +90,96 @@ export default class alpaca extends Exchange {
|
|
|
92
90
|
'withdraw': false,
|
|
93
91
|
},
|
|
94
92
|
'api': {
|
|
95
|
-
'
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
93
|
+
'broker': {},
|
|
94
|
+
'trader': {
|
|
95
|
+
'private': {
|
|
96
|
+
'get': [
|
|
97
|
+
'v2/account',
|
|
98
|
+
'v2/orders',
|
|
99
|
+
'v2/orders/{order_id}',
|
|
100
|
+
'v2/positions',
|
|
101
|
+
'v2/positions/{symbol_or_asset_id}',
|
|
102
|
+
'v2/account/portfolio/history',
|
|
103
|
+
'v2/watchlists',
|
|
104
|
+
'v2/watchlists/{watchlist_id}',
|
|
105
|
+
'v2/watchlists:by_name',
|
|
106
|
+
'v2/account/configurations',
|
|
107
|
+
'v2/account/activities',
|
|
108
|
+
'v2/account/activities/{activity_type}',
|
|
109
|
+
'v2/calendar',
|
|
110
|
+
'v2/clock',
|
|
111
|
+
'v2/assets',
|
|
112
|
+
'v2/assets/{symbol_or_asset_id}',
|
|
113
|
+
'v2/corporate_actions/announcements/{id}',
|
|
114
|
+
'v2/corporate_actions/announcements',
|
|
115
|
+
],
|
|
116
|
+
'post': [
|
|
117
|
+
'v2/orders',
|
|
118
|
+
'v2/watchlists',
|
|
119
|
+
'v2/watchlists/{watchlist_id}',
|
|
120
|
+
'v2/watchlists:by_name',
|
|
121
|
+
],
|
|
122
|
+
'put': [
|
|
123
|
+
'v2/watchlists/{watchlist_id}',
|
|
124
|
+
'v2/watchlists:by_name',
|
|
125
|
+
],
|
|
126
|
+
'patch': [
|
|
127
|
+
'v2/orders/{order_id}',
|
|
128
|
+
'v2/account/configurations',
|
|
129
|
+
],
|
|
130
|
+
'delete': [
|
|
131
|
+
'v2/orders',
|
|
132
|
+
'v2/orders/{order_id}',
|
|
133
|
+
'v2/positions',
|
|
134
|
+
'v2/positions/{symbol_or_asset_id}',
|
|
135
|
+
'v2/watchlists/{watchlist_id}',
|
|
136
|
+
'v2/watchlists:by_name',
|
|
137
|
+
'v2/watchlists/{watchlist_id}/{symbol}',
|
|
138
|
+
],
|
|
139
|
+
},
|
|
116
140
|
},
|
|
117
|
-
'
|
|
118
|
-
'
|
|
119
|
-
'
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
141
|
+
'market': {
|
|
142
|
+
'public': {
|
|
143
|
+
'get': [
|
|
144
|
+
'v1beta3/crypto/{loc}/bars',
|
|
145
|
+
'v1beta3/crypto/{loc}/latest/bars',
|
|
146
|
+
'v1beta3/crypto/{loc}/latest/orderbooks',
|
|
147
|
+
'v1beta3/crypto/{loc}/latest/quotes',
|
|
148
|
+
'v1beta3/crypto/{loc}/latest/trades',
|
|
149
|
+
'v1beta3/crypto/{loc}/quotes',
|
|
150
|
+
'v1beta3/crypto/{loc}/snapshots',
|
|
151
|
+
'v1beta3/crypto/{loc}/trades',
|
|
152
|
+
],
|
|
153
|
+
},
|
|
154
|
+
'private': {
|
|
155
|
+
'get': [
|
|
156
|
+
'v1beta1/corporate-actions',
|
|
157
|
+
'v1beta1/forex/latest/rates',
|
|
158
|
+
'v1beta1/forex/rates',
|
|
159
|
+
'v1beta1/logos/{symbol}',
|
|
160
|
+
'v1beta1/news',
|
|
161
|
+
'v1beta1/screener/stocks/most-actives',
|
|
162
|
+
'v1beta1/screener/{market_type}/movers',
|
|
163
|
+
'v2/stocks/auctions',
|
|
164
|
+
'v2/stocks/bars',
|
|
165
|
+
'v2/stocks/bars/latest',
|
|
166
|
+
'v2/stocks/meta/conditions/{ticktype}',
|
|
167
|
+
'v2/stocks/meta/exchanges',
|
|
168
|
+
'v2/stocks/quotes',
|
|
169
|
+
'v2/stocks/quotes/latest',
|
|
170
|
+
'v2/stocks/snapshots',
|
|
171
|
+
'v2/stocks/trades',
|
|
172
|
+
'v2/stocks/trades/latest',
|
|
173
|
+
'v2/stocks/{symbol}/auctions',
|
|
174
|
+
'v2/stocks/{symbol}/bars',
|
|
175
|
+
'v2/stocks/{symbol}/bars/latest',
|
|
176
|
+
'v2/stocks/{symbol}/quotes',
|
|
177
|
+
'v2/stocks/{symbol}/quotes/latest',
|
|
178
|
+
'v2/stocks/{symbol}/snapshot',
|
|
179
|
+
'v2/stocks/{symbol}/trades',
|
|
180
|
+
'v2/stocks/{symbol}/trades/latest',
|
|
181
|
+
],
|
|
182
|
+
},
|
|
126
183
|
},
|
|
127
184
|
},
|
|
128
185
|
'timeframes': {
|
|
@@ -181,14 +238,6 @@ export default class alpaca extends Exchange {
|
|
|
181
238
|
'APCA-PARTNER-ID': 'ccxt',
|
|
182
239
|
},
|
|
183
240
|
'options': {
|
|
184
|
-
'fetchTradesMethod': 'cryptoPublicGetCryptoTrades',
|
|
185
|
-
'fetchOHLCVMethod': 'cryptoPublicGetCryptoBars',
|
|
186
|
-
'versions': {
|
|
187
|
-
'public': 'v2',
|
|
188
|
-
'private': 'v2',
|
|
189
|
-
'cryptoPublic': 'v1beta2',
|
|
190
|
-
'markets': 'v2', // crypto beta
|
|
191
|
-
},
|
|
192
241
|
'defaultExchange': 'CBSE',
|
|
193
242
|
'exchanges': [
|
|
194
243
|
'CBSE',
|
|
@@ -227,7 +276,7 @@ export default class alpaca extends Exchange {
|
|
|
227
276
|
'asset_class': 'crypto',
|
|
228
277
|
'tradeable': true,
|
|
229
278
|
};
|
|
230
|
-
const assets = await this.
|
|
279
|
+
const assets = await this.traderPrivateGetV2Assets(this.extend(request, params));
|
|
231
280
|
//
|
|
232
281
|
// [
|
|
233
282
|
// {
|
|
@@ -318,26 +367,42 @@ export default class alpaca extends Exchange {
|
|
|
318
367
|
* @method
|
|
319
368
|
* @name alpaca#fetchTrades
|
|
320
369
|
* @description get the list of most recent trades for a particular symbol
|
|
370
|
+
* @see https://docs.alpaca.markets/reference/cryptotrades
|
|
371
|
+
* @see https://docs.alpaca.markets/reference/cryptolatesttrades
|
|
321
372
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
322
373
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
323
374
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
324
375
|
* @param {object} [params] extra parameters specific to the alpaca api endpoint
|
|
376
|
+
* @param {string} [params.loc] crypto location, default: us
|
|
377
|
+
* @param {string} [params.method] method, default: marketPublicGetV1beta3CryptoLocTrades
|
|
325
378
|
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
326
379
|
*/
|
|
327
380
|
await this.loadMarkets();
|
|
328
381
|
const market = this.market(symbol);
|
|
329
|
-
const
|
|
382
|
+
const marketId = market['id'];
|
|
383
|
+
const loc = this.safeString(params, 'loc', 'us');
|
|
384
|
+
const method = this.safeString(params, 'method', 'marketPublicGetV1beta3CryptoLocTrades');
|
|
330
385
|
const request = {
|
|
331
|
-
'symbols':
|
|
386
|
+
'symbols': marketId,
|
|
387
|
+
'loc': loc,
|
|
332
388
|
};
|
|
333
|
-
|
|
334
|
-
|
|
389
|
+
params = this.omit(params, ['loc', 'method']);
|
|
390
|
+
let response = undefined;
|
|
391
|
+
if (method === 'marketPublicGetV1beta3CryptoLocTrades') {
|
|
392
|
+
if (since !== undefined) {
|
|
393
|
+
request['start'] = this.iso8601(since);
|
|
394
|
+
}
|
|
395
|
+
if (limit !== undefined) {
|
|
396
|
+
request['limit'] = limit;
|
|
397
|
+
}
|
|
398
|
+
response = await this.marketPublicGetV1beta3CryptoLocTrades(this.extend(request, params));
|
|
399
|
+
}
|
|
400
|
+
else if (method === 'marketPublicGetV1beta3CryptoLocLatestTrades') {
|
|
401
|
+
response = await this.marketPublicGetV1beta3CryptoLocLatestTrades(this.extend(request, params));
|
|
335
402
|
}
|
|
336
|
-
|
|
337
|
-
|
|
403
|
+
else {
|
|
404
|
+
throw new NotSupported(this.id + ' fetchTrades() does not support ' + method + ', marketPublicGetV1beta3CryptoLocTrades and marketPublicGetV1beta3CryptoLocLatestTrades are supported');
|
|
338
405
|
}
|
|
339
|
-
const method = this.safeString(this.options, 'fetchTradesMethod', 'cryptoPublicGetCryptoTrades');
|
|
340
|
-
const response = await this[method](this.extend(request, params));
|
|
341
406
|
//
|
|
342
407
|
// {
|
|
343
408
|
// "next_page_token":null,
|
|
@@ -354,27 +419,50 @@ export default class alpaca extends Exchange {
|
|
|
354
419
|
// }
|
|
355
420
|
// }
|
|
356
421
|
//
|
|
422
|
+
// {
|
|
423
|
+
// "trades":{
|
|
424
|
+
// "BTC/USD":{
|
|
425
|
+
// "i":36440704,
|
|
426
|
+
// "p":22625,
|
|
427
|
+
// "s":0.0001,
|
|
428
|
+
// "t":"2022-07-21T11:47:31.073391Z",
|
|
429
|
+
// "tks":"B"
|
|
430
|
+
// }
|
|
431
|
+
// }
|
|
432
|
+
// }
|
|
433
|
+
//
|
|
357
434
|
const trades = this.safeValue(response, 'trades', {});
|
|
358
|
-
|
|
435
|
+
let symbolTrades = this.safeValue(trades, marketId, {});
|
|
436
|
+
if (!Array.isArray(symbolTrades)) {
|
|
437
|
+
symbolTrades = [symbolTrades];
|
|
438
|
+
}
|
|
359
439
|
return this.parseTrades(symbolTrades, market, since, limit);
|
|
360
440
|
}
|
|
361
441
|
async fetchOrderBook(symbol, limit = undefined, params = {}) {
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
442
|
+
//
|
|
443
|
+
// @method
|
|
444
|
+
// @name alpaca#fetchOrderBook
|
|
445
|
+
// @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
446
|
+
// @see https://docs.alpaca.markets/reference/cryptolatestorderbooks
|
|
447
|
+
// @param {string} symbol unified symbol of the market to fetch the order book for
|
|
448
|
+
// @param {int} [limit] the maximum amount of order book entries to return
|
|
449
|
+
// @param {object} [params] extra parameters specific to the alpaca api endpoint
|
|
450
|
+
// <<<<<<< HEAD
|
|
451
|
+
// @param {string} [params.loc] crypto location, default: us
|
|
452
|
+
// @returns {object} A dictionary of [order book structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-book-structure} indexed by market symbols
|
|
453
|
+
// =======
|
|
454
|
+
// @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
455
|
+
// >>>>>>> f68b1b599ee41469fefa424f0efc9b6891549278
|
|
456
|
+
//
|
|
371
457
|
await this.loadMarkets();
|
|
372
458
|
const market = this.market(symbol);
|
|
373
459
|
const id = market['id'];
|
|
460
|
+
const loc = this.safeString(params, 'loc', 'us');
|
|
374
461
|
const request = {
|
|
375
462
|
'symbols': id,
|
|
463
|
+
'loc': loc,
|
|
376
464
|
};
|
|
377
|
-
const response = await this.
|
|
465
|
+
const response = await this.marketPublicGetV1beta3CryptoLocLatestOrderbooks(this.extend(request, params));
|
|
378
466
|
//
|
|
379
467
|
// {
|
|
380
468
|
// "orderbooks":{
|
|
@@ -422,27 +510,44 @@ export default class alpaca extends Exchange {
|
|
|
422
510
|
* @method
|
|
423
511
|
* @name alpaca#fetchOHLCV
|
|
424
512
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
513
|
+
* @see https://docs.alpaca.markets/reference/cryptobars
|
|
514
|
+
* @see https://docs.alpaca.markets/reference/cryptolatestbars
|
|
425
515
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
426
516
|
* @param {string} timeframe the length of time each candle represents
|
|
427
517
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
428
518
|
* @param {int} [limit] the maximum amount of candles to fetch
|
|
429
519
|
* @param {object} [params] extra parameters specific to the alpha api endpoint
|
|
520
|
+
* @param {string} [params.loc] crypto location, default: us
|
|
521
|
+
* @param {string} [params.method] method, default: marketPublicGetV1beta3CryptoLocBars
|
|
430
522
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
431
523
|
*/
|
|
432
524
|
await this.loadMarkets();
|
|
433
525
|
const market = this.market(symbol);
|
|
526
|
+
const marketId = market['id'];
|
|
527
|
+
const loc = this.safeString(params, 'loc', 'us');
|
|
528
|
+
const method = this.safeString(params, 'method', 'marketPublicGetV1beta3CryptoLocBars');
|
|
434
529
|
const request = {
|
|
435
|
-
'symbols':
|
|
436
|
-
'
|
|
530
|
+
'symbols': marketId,
|
|
531
|
+
'loc': loc,
|
|
437
532
|
};
|
|
438
|
-
|
|
439
|
-
|
|
533
|
+
params = this.omit(params, ['loc', 'method']);
|
|
534
|
+
let response = undefined;
|
|
535
|
+
if (method === 'marketPublicGetV1beta3CryptoLocBars') {
|
|
536
|
+
if (limit !== undefined) {
|
|
537
|
+
request['limit'] = limit;
|
|
538
|
+
}
|
|
539
|
+
if (since !== undefined) {
|
|
540
|
+
request['start'] = this.yyyymmdd(since);
|
|
541
|
+
}
|
|
542
|
+
request['timeframe'] = this.safeString(this.timeframes, timeframe, timeframe);
|
|
543
|
+
response = await this.marketPublicGetV1beta3CryptoLocBars(this.extend(request, params));
|
|
544
|
+
}
|
|
545
|
+
else if (method === 'marketPublicGetV1beta3CryptoLocLatestBars') {
|
|
546
|
+
response = await this.marketPublicGetV1beta3CryptoLocLatestBars(this.extend(request, params));
|
|
440
547
|
}
|
|
441
|
-
|
|
442
|
-
|
|
548
|
+
else {
|
|
549
|
+
throw new NotSupported(this.id + ' fetchOHLCV() does not support ' + method + ', marketPublicGetV1beta3CryptoLocBars and marketPublicGetV1beta3CryptoLocLatestBars are supported');
|
|
443
550
|
}
|
|
444
|
-
const method = this.safeString(this.options, 'fetchOHLCVMethod', 'cryptoPublicGetCryptoBars');
|
|
445
|
-
const response = await this[method](this.extend(request, params));
|
|
446
551
|
//
|
|
447
552
|
// {
|
|
448
553
|
// "bars":{
|
|
@@ -472,8 +577,26 @@ export default class alpaca extends Exchange {
|
|
|
472
577
|
// "next_page_token":"QlRDL1VTRHxNfDIwMjItMDctMjFUMDU6MDE6MDAuMDAwMDAwMDAwWg=="
|
|
473
578
|
// }
|
|
474
579
|
//
|
|
580
|
+
// {
|
|
581
|
+
// "bars":{
|
|
582
|
+
// "BTC/USD":{
|
|
583
|
+
// "c":22887,
|
|
584
|
+
// "h":22888,
|
|
585
|
+
// "l":22873,
|
|
586
|
+
// "n":11,
|
|
587
|
+
// "o":22883,
|
|
588
|
+
// "t":"2022-07-21T05:00:00Z",
|
|
589
|
+
// "v":1.1138,
|
|
590
|
+
// "vw":22883.0155324116
|
|
591
|
+
// }
|
|
592
|
+
// }
|
|
593
|
+
// }
|
|
594
|
+
//
|
|
475
595
|
const bars = this.safeValue(response, 'bars', {});
|
|
476
|
-
|
|
596
|
+
let ohlcvs = this.safeValue(bars, marketId, {});
|
|
597
|
+
if (!Array.isArray(ohlcvs)) {
|
|
598
|
+
ohlcvs = [ohlcvs];
|
|
599
|
+
}
|
|
477
600
|
return this.parseOHLCVs(ohlcvs, market, timeframe, since, limit);
|
|
478
601
|
}
|
|
479
602
|
parseOHLCV(ohlcv, market = undefined) {
|
|
@@ -549,7 +672,7 @@ export default class alpaca extends Exchange {
|
|
|
549
672
|
const clientOrderId = this.safeString(params, 'clientOrderId', defaultClientId);
|
|
550
673
|
request['client_order_id'] = clientOrderId;
|
|
551
674
|
params = this.omit(params, ['clientOrderId']);
|
|
552
|
-
const order = await this.
|
|
675
|
+
const order = await this.traderPrivatePostV2Orders(this.extend(request, params));
|
|
553
676
|
//
|
|
554
677
|
// {
|
|
555
678
|
// "id": "61e69015-8549-4bfd-b9c3-01e75843f47d",
|
|
@@ -601,7 +724,7 @@ export default class alpaca extends Exchange {
|
|
|
601
724
|
const request = {
|
|
602
725
|
'order_id': id,
|
|
603
726
|
};
|
|
604
|
-
const response = await this.
|
|
727
|
+
const response = await this.traderPrivateDeleteV2OrdersOrderId(this.extend(request, params));
|
|
605
728
|
//
|
|
606
729
|
// {
|
|
607
730
|
// "code": 40410000,
|
|
@@ -623,7 +746,7 @@ export default class alpaca extends Exchange {
|
|
|
623
746
|
const request = {
|
|
624
747
|
'order_id': id,
|
|
625
748
|
};
|
|
626
|
-
const order = await this.
|
|
749
|
+
const order = await this.traderPrivateGetV2OrdersOrderId(this.extend(request, params));
|
|
627
750
|
const marketId = this.safeString(order, 'symbol');
|
|
628
751
|
const market = this.safeMarket(marketId);
|
|
629
752
|
return this.parseOrder(order, market);
|
|
@@ -644,7 +767,7 @@ export default class alpaca extends Exchange {
|
|
|
644
767
|
if (symbol !== undefined) {
|
|
645
768
|
market = this.market(symbol);
|
|
646
769
|
}
|
|
647
|
-
const orders = await this.
|
|
770
|
+
const orders = await this.traderPrivateGetV2Orders(params);
|
|
648
771
|
return this.parseOrders(orders, market, since, limit);
|
|
649
772
|
}
|
|
650
773
|
parseOrder(order, market = undefined) {
|
|
@@ -790,13 +913,10 @@ export default class alpaca extends Exchange {
|
|
|
790
913
|
}, market);
|
|
791
914
|
}
|
|
792
915
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
793
|
-
const versions = this.safeValue(this.options, 'versions');
|
|
794
|
-
const version = this.safeString(versions, api);
|
|
795
916
|
let endpoint = '/' + this.implodeParams(path, params);
|
|
796
|
-
let url = this.
|
|
797
|
-
url = this.implodeHostname(url);
|
|
917
|
+
let url = this.implodeHostname(this.urls['api'][api[0]]);
|
|
798
918
|
headers = (headers !== undefined) ? headers : {};
|
|
799
|
-
if (api === 'private') {
|
|
919
|
+
if (api[1] === 'private') {
|
|
800
920
|
headers['APCA-API-KEY-ID'] = this.apiKey;
|
|
801
921
|
headers['APCA-API-SECRET-KEY'] = this.secret;
|
|
802
922
|
}
|
package/js/src/base/Exchange.js
CHANGED
|
@@ -3022,7 +3022,7 @@ export default class Exchange {
|
|
|
3022
3022
|
/**
|
|
3023
3023
|
* @method
|
|
3024
3024
|
* @name exchange#fetchPositionsForSymbol
|
|
3025
|
-
* @description fetches all open positions for specific symbol, unlike fetchPositions (which is designed to work with multiple symbols) so this method might be preffered for
|
|
3025
|
+
* @description fetches all open positions for specific symbol, unlike fetchPositions (which is designed to work with multiple symbols) so this method might be preffered for one-market position, because of less rate-limit consumption and speed
|
|
3026
3026
|
* @param {string} symbol unified market symbol
|
|
3027
3027
|
* @param {object} params extra parameters specific to the endpoint
|
|
3028
3028
|
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure} with maximum 3 items - possible one position for "one-way" mode, and possible two positions (long & short) for "two-way" (a.k.a. hedge) mode
|
package/js/src/binance.js
CHANGED
|
@@ -290,6 +290,7 @@ export default class binance extends Exchange {
|
|
|
290
290
|
// https://binance-docs.github.io/apidocs/spot/en/#withdraw-sapi
|
|
291
291
|
'capital/config/getall': 1,
|
|
292
292
|
'capital/deposit/address': 1,
|
|
293
|
+
'capital/deposit/address/list': 1,
|
|
293
294
|
'capital/deposit/hisrec': 0.1,
|
|
294
295
|
'capital/deposit/subAddress': 0.1,
|
|
295
296
|
'capital/deposit/subHisrec': 0.1,
|
package/js/src/bitrue.js
CHANGED
|
@@ -1857,7 +1857,7 @@ export default class bitrue extends Exchange {
|
|
|
1857
1857
|
this.checkAddress(address);
|
|
1858
1858
|
await this.loadMarkets();
|
|
1859
1859
|
const currency = this.currency(code);
|
|
1860
|
-
let chainName = this.
|
|
1860
|
+
let chainName = this.safeString2(params, 'network', 'chainName');
|
|
1861
1861
|
if (chainName === undefined) {
|
|
1862
1862
|
const networks = this.safeValue(currency, 'networks', {});
|
|
1863
1863
|
const optionsNetworks = this.safeValue(this.options, 'networks', {});
|
package/js/src/bybit.js
CHANGED
|
@@ -5704,7 +5704,7 @@ export default class bybit extends Exchange {
|
|
|
5704
5704
|
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
5705
5705
|
*/
|
|
5706
5706
|
let symbol = undefined;
|
|
5707
|
-
if (Array.isArray(symbols)) {
|
|
5707
|
+
if ((symbols !== undefined) && Array.isArray(symbols)) {
|
|
5708
5708
|
const symbolsLength = symbols.length;
|
|
5709
5709
|
if (symbolsLength > 1) {
|
|
5710
5710
|
throw new ArgumentsRequired(this.id + ' fetchPositions() does not accept an array with more than one symbol');
|