ccxt 4.1.9 → 4.1.10
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/.git-templates/hooks/pre-push +55 -0
- package/README.md +3 -3
- package/dist/ccxt.browser.js +219 -114
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +1 -1
- package/dist/cjs/src/bingx.js +3 -2
- package/dist/cjs/src/bitbns.js +107 -83
- package/dist/cjs/src/bitget.js +9 -15
- package/dist/cjs/src/btcalpha.js +9 -1
- package/dist/cjs/src/btcmarkets.js +5 -5
- package/dist/cjs/src/coinex.js +14 -2
- package/dist/cjs/src/deribit.js +6 -0
- package/dist/cjs/src/hitbtc.js +20 -2
- package/dist/cjs/src/phemex.js +20 -1
- package/dist/cjs/src/probit.js +3 -0
- package/dist/cjs/src/woo.js +21 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/base/Exchange.js +1 -1
- package/js/src/bingx.js +3 -2
- package/js/src/bitbns.d.ts +1 -1
- package/js/src/bitbns.js +107 -83
- package/js/src/bitget.js +9 -15
- package/js/src/btcalpha.js +9 -1
- package/js/src/btcmarkets.js +5 -5
- package/js/src/coinex.d.ts +1 -1
- package/js/src/coinex.js +14 -2
- package/js/src/deribit.js +6 -0
- package/js/src/hitbtc.d.ts +2 -2
- package/js/src/hitbtc.js +20 -2
- package/js/src/phemex.js +20 -1
- package/js/src/probit.js +3 -0
- package/js/src/woo.js +21 -1
- package/package.json +1 -1
- package/pyproject.toml +8 -0
- package/skip-tests.json +1 -1
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.1.
|
|
183
|
+
const version = '4.1.10';
|
|
184
184
|
Exchange["default"].ccxtVersion = version;
|
|
185
185
|
const exchanges = {
|
|
186
186
|
'ace': ace,
|
|
@@ -2101,7 +2101,7 @@ class Exchange {
|
|
|
2101
2101
|
// string = true
|
|
2102
2102
|
//
|
|
2103
2103
|
// [
|
|
2104
|
-
// { 'currency': 'BTC', 'cost': '0.
|
|
2104
|
+
// { 'currency': 'BTC', 'cost': '0.4' },
|
|
2105
2105
|
// { 'currency': 'BTC', 'cost': '0.6', 'rate': '0.00123' },
|
|
2106
2106
|
// { 'currency': 'BTC', 'cost': '0.5', 'rate': '0.00456' },
|
|
2107
2107
|
// { 'currency': 'USDT', 'cost': '12.3456' },
|
package/dist/cjs/src/bingx.js
CHANGED
|
@@ -1551,8 +1551,9 @@ class bingx extends bingx$1 {
|
|
|
1551
1551
|
'liquidationPrice': undefined,
|
|
1552
1552
|
'entryPrice': this.safeNumber2(position, 'avgPrice', 'entryPrice'),
|
|
1553
1553
|
'unrealizedPnl': this.safeNumber(position, 'unrealizedProfit'),
|
|
1554
|
+
'realizedPnl': this.safeNumber(position, 'realisedProfit'),
|
|
1554
1555
|
'percentage': undefined,
|
|
1555
|
-
'contracts':
|
|
1556
|
+
'contracts': this.safeNumber(position, 'positionAmt'),
|
|
1556
1557
|
'contractSize': undefined,
|
|
1557
1558
|
'markPrice': undefined,
|
|
1558
1559
|
'lastPrice': undefined,
|
|
@@ -1563,7 +1564,7 @@ class bingx extends bingx$1 {
|
|
|
1563
1564
|
'lastUpdateTimestamp': undefined,
|
|
1564
1565
|
'maintenanceMargin': undefined,
|
|
1565
1566
|
'maintenanceMarginPercentage': undefined,
|
|
1566
|
-
'collateral': this.
|
|
1567
|
+
'collateral': this.safeNumber(position, 'positionAmt'),
|
|
1567
1568
|
'initialMargin': this.safeNumber(position, 'initialMargin'),
|
|
1568
1569
|
'initialMarginPercentage': undefined,
|
|
1569
1570
|
'leverage': this.safeNumber(position, 'leverage'),
|
package/dist/cjs/src/bitbns.js
CHANGED
|
@@ -479,9 +479,12 @@ class bitbns extends bitbns$1 {
|
|
|
479
479
|
// note that "Money" stands for INR - the only fiat in bitbns
|
|
480
480
|
return this.parseBalance(response);
|
|
481
481
|
}
|
|
482
|
-
|
|
482
|
+
parseStatus(status) {
|
|
483
483
|
const statuses = {
|
|
484
|
+
'-1': 'cancelled',
|
|
484
485
|
'0': 'open',
|
|
486
|
+
'1': 'open',
|
|
487
|
+
'2': 'done',
|
|
485
488
|
// 'PARTIALLY_FILLED': 'open',
|
|
486
489
|
// 'FILLED': 'closed',
|
|
487
490
|
// 'CANCELED': 'canceled',
|
|
@@ -496,90 +499,78 @@ class bitbns extends bitbns$1 {
|
|
|
496
499
|
// createOrder
|
|
497
500
|
//
|
|
498
501
|
// {
|
|
499
|
-
// "data":"Successfully placed bid to purchase currency",
|
|
500
|
-
// "status":1,
|
|
501
|
-
// "error":null,
|
|
502
|
-
// "id":5424475,
|
|
503
|
-
// "code":200
|
|
502
|
+
// "data": "Successfully placed bid to purchase currency",
|
|
503
|
+
// "status": 1,
|
|
504
|
+
// "error": null,
|
|
505
|
+
// "id": 5424475,
|
|
506
|
+
// "code": 200
|
|
504
507
|
// }
|
|
505
508
|
//
|
|
506
|
-
// fetchOrder
|
|
509
|
+
// fetchOpenOrders, fetchOrder
|
|
507
510
|
//
|
|
508
|
-
//
|
|
509
|
-
//
|
|
510
|
-
//
|
|
511
|
-
//
|
|
512
|
-
//
|
|
513
|
-
//
|
|
514
|
-
//
|
|
515
|
-
//
|
|
516
|
-
//
|
|
517
|
-
//
|
|
518
|
-
// "amount":0.01,
|
|
519
|
-
// "remaining":0.01,
|
|
520
|
-
// "filled":0,
|
|
521
|
-
// "cost":null,
|
|
522
|
-
// "fee":0.05
|
|
523
|
-
// }
|
|
511
|
+
// {
|
|
512
|
+
// "entry_id": 5424475,
|
|
513
|
+
// "btc": 0.01,
|
|
514
|
+
// "rate": 2000,
|
|
515
|
+
// "time": "2021-04-25T17:05:42.000Z",
|
|
516
|
+
// "type": 0,
|
|
517
|
+
// "status": 0
|
|
518
|
+
// "t_rate": 0.45, // only stop orders
|
|
519
|
+
// "trail": 0 // only stop orders
|
|
520
|
+
// }
|
|
524
521
|
//
|
|
525
|
-
//
|
|
522
|
+
// cancelOrder
|
|
526
523
|
//
|
|
527
|
-
//
|
|
528
|
-
//
|
|
529
|
-
//
|
|
530
|
-
//
|
|
531
|
-
//
|
|
532
|
-
//
|
|
533
|
-
// "status":0
|
|
534
|
-
// }
|
|
524
|
+
// {
|
|
525
|
+
// "data": "Successfully cancelled the order",
|
|
526
|
+
// "status": 1,
|
|
527
|
+
// "error": null,
|
|
528
|
+
// "code": 200
|
|
529
|
+
// }
|
|
535
530
|
//
|
|
536
531
|
const id = this.safeString2(order, 'id', 'entry_id');
|
|
537
|
-
const
|
|
538
|
-
const
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
const filled = this.safeString(order, 'filled');
|
|
543
|
-
const remaining = this.safeString(order, 'remaining');
|
|
544
|
-
const average = this.safeString(order, 'avg_cost');
|
|
545
|
-
const cost = this.safeString(order, 'cost');
|
|
546
|
-
let type = this.safeStringLower(order, 'type');
|
|
547
|
-
if (type === '0') {
|
|
548
|
-
type = 'limit';
|
|
532
|
+
const datetime = this.safeString(order, 'time');
|
|
533
|
+
const triggerPrice = this.safeString(order, 't_rate');
|
|
534
|
+
let side = this.safeString(order, 'type');
|
|
535
|
+
if (side === '0') {
|
|
536
|
+
side = 'buy';
|
|
549
537
|
}
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
538
|
+
else if (side === '1') {
|
|
539
|
+
side = 'sell';
|
|
540
|
+
}
|
|
541
|
+
const data = this.safeString(order, 'data');
|
|
542
|
+
let status = this.safeString(order, 'status');
|
|
543
|
+
if (data === 'Successfully cancelled the order') {
|
|
544
|
+
status = 'cancelled';
|
|
545
|
+
}
|
|
546
|
+
else {
|
|
547
|
+
status = this.parseStatus(status);
|
|
560
548
|
}
|
|
561
549
|
return this.safeOrder({
|
|
562
550
|
'info': order,
|
|
563
551
|
'id': id,
|
|
564
552
|
'clientOrderId': undefined,
|
|
565
|
-
'timestamp':
|
|
566
|
-
'datetime':
|
|
553
|
+
'timestamp': this.parse8601(datetime),
|
|
554
|
+
'datetime': datetime,
|
|
567
555
|
'lastTradeTimestamp': undefined,
|
|
568
|
-
'symbol': symbol,
|
|
569
|
-
'type': type,
|
|
556
|
+
'symbol': this.safeString(market, 'symbol'),
|
|
570
557
|
'timeInForce': undefined,
|
|
571
558
|
'postOnly': undefined,
|
|
572
559
|
'side': side,
|
|
573
|
-
'price':
|
|
574
|
-
'stopPrice':
|
|
575
|
-
'triggerPrice':
|
|
576
|
-
'amount':
|
|
577
|
-
'cost':
|
|
578
|
-
'average':
|
|
579
|
-
'filled':
|
|
580
|
-
'remaining':
|
|
560
|
+
'price': this.safeString(order, 'rate'),
|
|
561
|
+
'stopPrice': triggerPrice,
|
|
562
|
+
'triggerPrice': triggerPrice,
|
|
563
|
+
'amount': this.safeString(order, 'btc'),
|
|
564
|
+
'cost': undefined,
|
|
565
|
+
'average': undefined,
|
|
566
|
+
'filled': undefined,
|
|
567
|
+
'remaining': undefined,
|
|
581
568
|
'status': status,
|
|
582
|
-
'fee':
|
|
569
|
+
'fee': {
|
|
570
|
+
'cost': undefined,
|
|
571
|
+
'currency': undefined,
|
|
572
|
+
'rate': undefined,
|
|
573
|
+
},
|
|
583
574
|
'trades': undefined,
|
|
584
575
|
}, market);
|
|
585
576
|
}
|
|
@@ -588,19 +579,27 @@ class bitbns extends bitbns$1 {
|
|
|
588
579
|
* @method
|
|
589
580
|
* @name bitbns#createOrder
|
|
590
581
|
* @description create a trade order
|
|
582
|
+
* @see https://docs.bitbns.com/bitbns/rest-endpoints/order-apis/version-2/place-orders
|
|
583
|
+
* @see https://docs.bitbns.com/bitbns/rest-endpoints/order-apis/version-1/market-orders-quantity // market orders
|
|
591
584
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
592
585
|
* @param {string} type 'market' or 'limit'
|
|
593
586
|
* @param {string} side 'buy' or 'sell'
|
|
594
587
|
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
595
588
|
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
596
589
|
* @param {object} [params] extra parameters specific to the bitbns api endpoint
|
|
590
|
+
* @param {float} [params.triggerPrice] the price at which a trigger order is triggered at
|
|
591
|
+
*
|
|
592
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
|
593
|
+
* @param {float} [params.target_rate] *requires params.trail_rate when set, type must be 'limit'* a bracket order is placed when set
|
|
594
|
+
* @param {float} [params.trail_rate] *requires params.target_rate when set, type must be 'limit'* a bracket order is placed when set
|
|
597
595
|
* @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
598
596
|
*/
|
|
599
|
-
if (type !== 'limit' && type !== 'market') {
|
|
600
|
-
throw new errors.ExchangeError(this.id + ' allows limit and market orders only');
|
|
601
|
-
}
|
|
602
597
|
await this.loadMarkets();
|
|
603
598
|
const market = this.market(symbol);
|
|
599
|
+
const triggerPrice = this.safeStringN(params, ['triggerPrice', 'stopPrice', 't_rate']);
|
|
600
|
+
const targetRate = this.safeString(params, 'target_rate');
|
|
601
|
+
const trailRate = this.safeString(params, 'trail_rate');
|
|
602
|
+
params = this.omit(params, ['triggerPrice', 'stopPrice', 'trail_rate', 'target_rate', 't_rate']);
|
|
604
603
|
const request = {
|
|
605
604
|
'side': side.toUpperCase(),
|
|
606
605
|
'symbol': market['uppercaseId'],
|
|
@@ -608,20 +607,23 @@ class bitbns extends bitbns$1 {
|
|
|
608
607
|
// 'target_rate': this.priceToPrecision (symbol, targetRate),
|
|
609
608
|
// 't_rate': this.priceToPrecision (symbol, stopPrice),
|
|
610
609
|
// 'trail_rate': this.priceToPrecision (symbol, trailRate),
|
|
611
|
-
// To Place Simple Buy or Sell Order use rate
|
|
612
|
-
// To Place Stoploss Buy or Sell Order use rate & t_rate
|
|
613
|
-
// To Place Bracket Buy or Sell Order use rate , t_rate, target_rate & trail_rate
|
|
614
610
|
};
|
|
615
611
|
let method = 'v2PostOrders';
|
|
616
612
|
if (type === 'limit') {
|
|
617
613
|
request['rate'] = this.priceToPrecision(symbol, price);
|
|
618
614
|
}
|
|
619
|
-
else
|
|
615
|
+
else {
|
|
620
616
|
method = 'v1PostPlaceMarketOrderQntySymbol';
|
|
621
617
|
request['market'] = market['quoteId'];
|
|
622
618
|
}
|
|
623
|
-
|
|
624
|
-
|
|
619
|
+
if (triggerPrice !== undefined) {
|
|
620
|
+
request['t_rate'] = this.priceToPrecision(symbol, triggerPrice);
|
|
621
|
+
}
|
|
622
|
+
if (targetRate !== undefined) {
|
|
623
|
+
request['target_rate'] = this.priceToPrecision(symbol, targetRate);
|
|
624
|
+
}
|
|
625
|
+
if (trailRate !== undefined) {
|
|
626
|
+
request['trail_rate'] = this.priceToPrecision(symbol, trailRate);
|
|
625
627
|
}
|
|
626
628
|
const response = await this[method](this.extend(request, params));
|
|
627
629
|
//
|
|
@@ -640,9 +642,12 @@ class bitbns extends bitbns$1 {
|
|
|
640
642
|
* @method
|
|
641
643
|
* @name bitbns#cancelOrder
|
|
642
644
|
* @description cancels an open order
|
|
645
|
+
* @see https://docs.bitbns.com/bitbns/rest-endpoints/order-apis/version-2/cancel-orders
|
|
646
|
+
* @see https://docs.bitbns.com/bitbns/rest-endpoints/order-apis/version-1/cancel-stop-loss-orders
|
|
643
647
|
* @param {string} id order id
|
|
644
648
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
645
649
|
* @param {object} [params] extra parameters specific to the bitbns api endpoint
|
|
650
|
+
* @param {boolean} [params.trigger] true if cancelling a trigger order
|
|
646
651
|
* @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
647
652
|
*/
|
|
648
653
|
if (symbol === undefined) {
|
|
@@ -650,13 +655,18 @@ class bitbns extends bitbns$1 {
|
|
|
650
655
|
}
|
|
651
656
|
await this.loadMarkets();
|
|
652
657
|
const market = this.market(symbol);
|
|
653
|
-
const
|
|
658
|
+
const isTrigger = this.safeValue2(params, 'trigger', 'stop');
|
|
659
|
+
params = this.omit(params, ['trigger', 'stop']);
|
|
654
660
|
const request = {
|
|
655
661
|
'entry_id': id,
|
|
656
662
|
'symbol': market['uppercaseId'],
|
|
657
|
-
'side': quoteSide,
|
|
658
663
|
};
|
|
659
|
-
|
|
664
|
+
let response = undefined;
|
|
665
|
+
const tail = isTrigger ? 'StopLossOrder' : 'Order';
|
|
666
|
+
let quoteSide = (market['quoteId'] === 'USDT') ? 'usdtcancel' : 'cancel';
|
|
667
|
+
quoteSide += tail;
|
|
668
|
+
request['side'] = quoteSide;
|
|
669
|
+
response = await this.v2PostCancel(this.extend(request, params));
|
|
660
670
|
return this.parseOrder(response, market);
|
|
661
671
|
}
|
|
662
672
|
async fetchOrder(id, symbol = undefined, params = {}) {
|
|
@@ -664,6 +674,8 @@ class bitbns extends bitbns$1 {
|
|
|
664
674
|
* @method
|
|
665
675
|
* @name bitbns#fetchOrder
|
|
666
676
|
* @description fetches information on an order made by the user
|
|
677
|
+
* @see https://docs.bitbns.com/bitbns/rest-endpoints/order-apis/version-1/order-status
|
|
678
|
+
* @param {string} id order id
|
|
667
679
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
668
680
|
* @param {object} [params] extra parameters specific to the bitbns api endpoint
|
|
669
681
|
* @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
@@ -677,6 +689,10 @@ class bitbns extends bitbns$1 {
|
|
|
677
689
|
'symbol': market['id'],
|
|
678
690
|
'entry_id': id,
|
|
679
691
|
};
|
|
692
|
+
const trigger = this.safeValue2(params, 'trigger', 'stop');
|
|
693
|
+
if (trigger) {
|
|
694
|
+
throw new errors.BadRequest(this.id + ' fetchOrder cannot fetch stop orders');
|
|
695
|
+
}
|
|
680
696
|
const response = await this.v1PostOrderStatusSymbol(this.extend(request, params));
|
|
681
697
|
//
|
|
682
698
|
// {
|
|
@@ -712,10 +728,13 @@ class bitbns extends bitbns$1 {
|
|
|
712
728
|
* @method
|
|
713
729
|
* @name bitbns#fetchOpenOrders
|
|
714
730
|
* @description fetch all unfilled currently open orders
|
|
731
|
+
* @see https://docs.bitbns.com/bitbns/rest-endpoints/order-apis/version-2/order-status-limit
|
|
732
|
+
* @see https://docs.bitbns.com/bitbns/rest-endpoints/order-apis/version-2/order-status-limit/order-status-stop-limit
|
|
715
733
|
* @param {string} symbol unified market symbol
|
|
716
734
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
717
|
-
* @param {int} [limit] the maximum number of
|
|
735
|
+
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
718
736
|
* @param {object} [params] extra parameters specific to the bitbns api endpoint
|
|
737
|
+
* @param {boolean} [params.trigger] true if fetching trigger orders
|
|
719
738
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
720
739
|
*/
|
|
721
740
|
if (symbol === undefined) {
|
|
@@ -723,11 +742,13 @@ class bitbns extends bitbns$1 {
|
|
|
723
742
|
}
|
|
724
743
|
await this.loadMarkets();
|
|
725
744
|
const market = this.market(symbol);
|
|
726
|
-
const
|
|
745
|
+
const isTrigger = this.safeValue2(params, 'trigger', 'stop');
|
|
746
|
+
params = this.omit(params, ['trigger', 'stop']);
|
|
747
|
+
const quoteSide = (market['quoteId'] === 'USDT') ? 'usdtListOpen' : 'listOpen';
|
|
727
748
|
const request = {
|
|
728
749
|
'symbol': market['uppercaseId'],
|
|
729
|
-
'side': quoteSide,
|
|
730
750
|
'page': 0,
|
|
751
|
+
'side': isTrigger ? (quoteSide + 'StopOrders') : (quoteSide + 'Orders'),
|
|
731
752
|
};
|
|
732
753
|
const response = await this.v2PostGetordersnew(this.extend(request, params));
|
|
733
754
|
//
|
|
@@ -740,6 +761,9 @@ class bitbns extends bitbns$1 {
|
|
|
740
761
|
// "time":"2021-04-25T17:05:42.000Z",
|
|
741
762
|
// "type":0,
|
|
742
763
|
// "status":0
|
|
764
|
+
// "t_rate":0.45, // only stop orders
|
|
765
|
+
// "type":1, // only stop orders
|
|
766
|
+
// "trail":0 // only stop orders
|
|
743
767
|
// }
|
|
744
768
|
// ],
|
|
745
769
|
// "status":1,
|
|
@@ -1162,7 +1186,7 @@ class bitbns extends bitbns$1 {
|
|
|
1162
1186
|
'body': body,
|
|
1163
1187
|
};
|
|
1164
1188
|
const payload = this.stringToBase64(this.json(auth));
|
|
1165
|
-
const signature = this.hmac(payload, this.encode(this.secret), sha512.sha512);
|
|
1189
|
+
const signature = this.hmac(this.encode(payload), this.encode(this.secret), sha512.sha512);
|
|
1166
1190
|
headers['X-BITBNS-PAYLOAD'] = payload;
|
|
1167
1191
|
headers['X-BITBNS-SIGNATURE'] = signature;
|
|
1168
1192
|
headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
package/dist/cjs/src/bitget.js
CHANGED
|
@@ -3321,7 +3321,6 @@ class bitget extends bitget$1 {
|
|
|
3321
3321
|
* @see https://bitgetlimited.github.io/apidoc/en/mix/#cancel-all-trigger-order-tpsl
|
|
3322
3322
|
* @param {string} symbol unified market symbol
|
|
3323
3323
|
* @param {object} [params] extra parameters specific to the bitget api endpoint
|
|
3324
|
-
* @param {string} [params.code] marginCoin unified currency code
|
|
3325
3324
|
* @returns {object[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
3326
3325
|
*/
|
|
3327
3326
|
const sandboxMode = this.safeValue(this.options, 'sandboxMode', false);
|
|
@@ -3336,33 +3335,28 @@ class bitget extends bitget$1 {
|
|
|
3336
3335
|
if (sandboxMode) {
|
|
3337
3336
|
productType = 'S' + productType;
|
|
3338
3337
|
}
|
|
3339
|
-
|
|
3338
|
+
let marketType = undefined;
|
|
3339
|
+
[marketType, params] = this.handleMarketTypeAndParams('cancelAllOrders', market, params);
|
|
3340
3340
|
if (marketType === 'spot') {
|
|
3341
3341
|
throw new errors.NotSupported(this.id + ' cancelAllOrders () does not support spot markets');
|
|
3342
3342
|
}
|
|
3343
3343
|
const request = {
|
|
3344
3344
|
'productType': productType,
|
|
3345
|
+
'marginCoin': market['settleId'],
|
|
3345
3346
|
};
|
|
3346
|
-
|
|
3347
|
-
const
|
|
3348
|
-
|
|
3347
|
+
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
3348
|
+
const planType = this.safeString(params, 'planType');
|
|
3349
|
+
params = this.omit(params, ['stop', 'trigger']);
|
|
3350
|
+
let response = undefined;
|
|
3349
3351
|
if (stop !== undefined || planType !== undefined) {
|
|
3350
3352
|
if (planType === undefined) {
|
|
3351
3353
|
throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a planType parameter for stop orders, either normal_plan, profit_plan, loss_plan, pos_profit, pos_loss, moving_plan or track_plan');
|
|
3352
3354
|
}
|
|
3353
|
-
|
|
3355
|
+
response = await this.privateMixPostPlanCancelAllPlan(this.extend(request, params));
|
|
3354
3356
|
}
|
|
3355
3357
|
else {
|
|
3356
|
-
|
|
3357
|
-
if (code === undefined) {
|
|
3358
|
-
throw new errors.ArgumentsRequired(this.id + ' cancelAllOrders () requires a code argument [marginCoin] in the params');
|
|
3359
|
-
}
|
|
3360
|
-
const currency = this.currency(code);
|
|
3361
|
-
request['marginCoin'] = this.safeCurrencyCode(code, currency);
|
|
3362
|
-
method = 'privateMixPostOrderCancelAllOrders';
|
|
3358
|
+
response = await this.privateMixPostOrderCancelAllOrders(this.extend(request, params));
|
|
3363
3359
|
}
|
|
3364
|
-
const ommitted = this.omit(query, ['stop', 'code', 'marginCoin']);
|
|
3365
|
-
const response = await this[method](this.extend(request, ommitted));
|
|
3366
3360
|
//
|
|
3367
3361
|
// {
|
|
3368
3362
|
// "code": "00000",
|
package/dist/cjs/src/btcalpha.js
CHANGED
|
@@ -337,6 +337,7 @@ class btcalpha extends btcalpha$1 {
|
|
|
337
337
|
/**
|
|
338
338
|
* @method
|
|
339
339
|
* @name btcalpha#fetchOrderBook
|
|
340
|
+
* @see https://btc-alpha.github.io/api-docs/#get-orderbook
|
|
340
341
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
341
342
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
342
343
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
@@ -717,15 +718,19 @@ class btcalpha extends btcalpha$1 {
|
|
|
717
718
|
/**
|
|
718
719
|
* @method
|
|
719
720
|
* @name btcalpha#createOrder
|
|
721
|
+
* @see https://btc-alpha.github.io/api-docs/#create-order
|
|
720
722
|
* @description create a trade order
|
|
721
723
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
722
|
-
* @param {string} type '
|
|
724
|
+
* @param {string} type 'limit'
|
|
723
725
|
* @param {string} side 'buy' or 'sell'
|
|
724
726
|
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
725
727
|
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
726
728
|
* @param {object} [params] extra parameters specific to the btcalpha api endpoint
|
|
727
729
|
* @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
728
730
|
*/
|
|
731
|
+
if (type === 'market') {
|
|
732
|
+
throw new errors.InvalidOrder(this.id + ' only limits orders are supported');
|
|
733
|
+
}
|
|
729
734
|
await this.loadMarkets();
|
|
730
735
|
const market = this.market(symbol);
|
|
731
736
|
const request = {
|
|
@@ -749,6 +754,7 @@ class btcalpha extends btcalpha$1 {
|
|
|
749
754
|
/**
|
|
750
755
|
* @method
|
|
751
756
|
* @name btcalpha#cancelOrder
|
|
757
|
+
* @see https://btc-alpha.github.io/api-docs/#cancel-order
|
|
752
758
|
* @description cancels an open order
|
|
753
759
|
* @param {string} id order id
|
|
754
760
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
@@ -765,6 +771,7 @@ class btcalpha extends btcalpha$1 {
|
|
|
765
771
|
/**
|
|
766
772
|
* @method
|
|
767
773
|
* @name btcalpha#fetchOrder
|
|
774
|
+
* @see https://btc-alpha.github.io/api-docs/#retrieve-single-order
|
|
768
775
|
* @description fetches information on an order made by the user
|
|
769
776
|
* @param {string} symbol not used by btcalpha fetchOrder
|
|
770
777
|
* @param {object} [params] extra parameters specific to the btcalpha api endpoint
|
|
@@ -781,6 +788,7 @@ class btcalpha extends btcalpha$1 {
|
|
|
781
788
|
/**
|
|
782
789
|
* @method
|
|
783
790
|
* @name btcalpha#fetchOrders
|
|
791
|
+
* @see https://btc-alpha.github.io/api-docs/#list-own-orders
|
|
784
792
|
* @description fetches information on multiple orders made by the user
|
|
785
793
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
786
794
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
@@ -310,13 +310,13 @@ class btcmarkets extends btcmarkets$1 {
|
|
|
310
310
|
const tagTo = tag;
|
|
311
311
|
const addressFrom = undefined;
|
|
312
312
|
const tagFrom = undefined;
|
|
313
|
-
const fee = this.
|
|
313
|
+
const fee = this.safeString(transaction, 'fee');
|
|
314
314
|
const status = this.parseTransactionStatus(this.safeString(transaction, 'status'));
|
|
315
315
|
const currencyId = this.safeString(transaction, 'assetName');
|
|
316
316
|
const code = this.safeCurrencyCode(currencyId);
|
|
317
|
-
let amount = this.
|
|
317
|
+
let amount = this.safeString(transaction, 'amount');
|
|
318
318
|
if (fee) {
|
|
319
|
-
amount
|
|
319
|
+
amount = Precise["default"].stringSub(amount, fee);
|
|
320
320
|
}
|
|
321
321
|
return {
|
|
322
322
|
'id': this.safeString(transaction, 'id'),
|
|
@@ -331,14 +331,14 @@ class btcmarkets extends btcmarkets$1 {
|
|
|
331
331
|
'tagTo': tagTo,
|
|
332
332
|
'tagFrom': tagFrom,
|
|
333
333
|
'type': type,
|
|
334
|
-
'amount': amount,
|
|
334
|
+
'amount': this.parseNumber(amount),
|
|
335
335
|
'currency': code,
|
|
336
336
|
'status': status,
|
|
337
337
|
'updated': lastUpdate,
|
|
338
338
|
'comment': undefined,
|
|
339
339
|
'fee': {
|
|
340
340
|
'currency': code,
|
|
341
|
-
'cost': fee,
|
|
341
|
+
'cost': this.parseNumber(fee),
|
|
342
342
|
'rate': undefined,
|
|
343
343
|
},
|
|
344
344
|
'info': transaction,
|
package/dist/cjs/src/coinex.js
CHANGED
|
@@ -3838,23 +3838,34 @@ class coinex extends coinex$1 {
|
|
|
3838
3838
|
};
|
|
3839
3839
|
return this.safeString(statuses, status, status);
|
|
3840
3840
|
}
|
|
3841
|
-
async fetchFundingRateHistory(symbol = undefined, since = undefined, limit =
|
|
3841
|
+
async fetchFundingRateHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
3842
3842
|
/**
|
|
3843
3843
|
* @method
|
|
3844
3844
|
* @name coinex#fetchFundingRateHistory
|
|
3845
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http038_funding_history
|
|
3845
3846
|
* @description fetches historical funding rate prices
|
|
3846
3847
|
* @param {string} symbol unified symbol of the market to fetch the funding rate history for
|
|
3847
3848
|
* @param {int} [since] timestamp in ms of the earliest funding rate to fetch
|
|
3848
3849
|
* @param {int} [limit] the maximum amount of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure} to fetch
|
|
3849
3850
|
* @param {object} [params] extra parameters specific to the coinex api endpoint
|
|
3851
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
3852
|
+
* @param {int} [params.until] timestamp in ms of the latest funding rate
|
|
3850
3853
|
* @returns {object[]} a list of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure}
|
|
3851
3854
|
*/
|
|
3852
3855
|
if (symbol === undefined) {
|
|
3853
3856
|
throw new errors.ArgumentsRequired(this.id + ' fetchFundingRateHistory() requires a symbol argument');
|
|
3854
3857
|
}
|
|
3855
3858
|
await this.loadMarkets();
|
|
3859
|
+
let paginate = false;
|
|
3860
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
|
|
3861
|
+
if (paginate) {
|
|
3862
|
+
return await this.fetchPaginatedCallDeterministic('fetchFundingRateHistory', symbol, since, limit, '8h', params, 1000);
|
|
3863
|
+
}
|
|
3864
|
+
if (limit === undefined) {
|
|
3865
|
+
limit = 100;
|
|
3866
|
+
}
|
|
3856
3867
|
const market = this.market(symbol);
|
|
3857
|
-
|
|
3868
|
+
let request = {
|
|
3858
3869
|
'market': market['id'],
|
|
3859
3870
|
'limit': limit,
|
|
3860
3871
|
'offset': 0,
|
|
@@ -3863,6 +3874,7 @@ class coinex extends coinex$1 {
|
|
|
3863
3874
|
if (since !== undefined) {
|
|
3864
3875
|
request['start_time'] = since;
|
|
3865
3876
|
}
|
|
3877
|
+
[request, params] = this.handleUntilOption('end_time', request, params);
|
|
3866
3878
|
const response = await this.perpetualPublicGetMarketFundingHistory(this.extend(request, params));
|
|
3867
3879
|
//
|
|
3868
3880
|
// {
|
package/dist/cjs/src/deribit.js
CHANGED
|
@@ -2827,10 +2827,16 @@ class deribit extends deribit$1 {
|
|
|
2827
2827
|
* @param {string} symbol unified market symbol
|
|
2828
2828
|
* @param {object} [params] extra parameters specific to the deribit api endpoint
|
|
2829
2829
|
* @param {int} [params.end_timestamp] fetch funding rate ending at this timestamp
|
|
2830
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
2830
2831
|
* @returns {object} a [funding rate structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-structure}
|
|
2831
2832
|
*/
|
|
2832
2833
|
await this.loadMarkets();
|
|
2833
2834
|
const market = this.market(symbol);
|
|
2835
|
+
let paginate = false;
|
|
2836
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
|
|
2837
|
+
if (paginate) {
|
|
2838
|
+
return await this.fetchPaginatedCallDeterministic('fetchFundingRateHistory', symbol, since, limit, '8h', params, 720);
|
|
2839
|
+
}
|
|
2834
2840
|
const time = this.milliseconds();
|
|
2835
2841
|
const month = 30 * 24 * 60 * 60 * 1000;
|
|
2836
2842
|
if (since === undefined) {
|
package/dist/cjs/src/hitbtc.js
CHANGED
|
@@ -1573,19 +1573,28 @@ class hitbtc extends hitbtc$1 {
|
|
|
1573
1573
|
* @method
|
|
1574
1574
|
* @name hitbtc#fetchOHLCV
|
|
1575
1575
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
1576
|
+
* @see https://api.hitbtc.com/#candles
|
|
1576
1577
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
1577
1578
|
* @param {string} timeframe the length of time each candle represents
|
|
1578
1579
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
1579
1580
|
* @param {int} [limit] the maximum amount of candles to fetch
|
|
1580
1581
|
* @param {object} [params] extra parameters specific to the hitbtc api endpoint
|
|
1582
|
+
* @param {int} [params.until] timestamp in ms of the latest funding rate
|
|
1583
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
1581
1584
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
1582
1585
|
*/
|
|
1583
1586
|
await this.loadMarkets();
|
|
1587
|
+
let paginate = false;
|
|
1588
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate');
|
|
1589
|
+
if (paginate) {
|
|
1590
|
+
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 1000);
|
|
1591
|
+
}
|
|
1584
1592
|
const market = this.market(symbol);
|
|
1585
|
-
|
|
1593
|
+
let request = {
|
|
1586
1594
|
'symbols': market['id'],
|
|
1587
1595
|
'period': this.safeString(this.timeframes, timeframe, timeframe),
|
|
1588
1596
|
};
|
|
1597
|
+
[request, params] = this.handleUntilOption('till', request, params);
|
|
1589
1598
|
if (since !== undefined) {
|
|
1590
1599
|
request['from'] = this.iso8601(since);
|
|
1591
1600
|
}
|
|
@@ -2380,16 +2389,24 @@ class hitbtc extends hitbtc$1 {
|
|
|
2380
2389
|
/**
|
|
2381
2390
|
* @method
|
|
2382
2391
|
* @name hitbtc#fetchFundingRateHistory
|
|
2392
|
+
* @see https://api.hitbtc.com/#funding-history
|
|
2383
2393
|
* @description fetches historical funding rate prices
|
|
2384
2394
|
* @param {string} symbol unified symbol of the market to fetch the funding rate history for
|
|
2385
2395
|
* @param {int} [since] timestamp in ms of the earliest funding rate to fetch
|
|
2386
2396
|
* @param {int} [limit] the maximum amount of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure} to fetch
|
|
2387
2397
|
* @param {object} [params] extra parameters specific to the hitbtc api endpoint
|
|
2398
|
+
* @param {int} [params.until] timestamp in ms of the latest funding rate
|
|
2399
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
2388
2400
|
* @returns {object[]} a list of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure}
|
|
2389
2401
|
*/
|
|
2390
2402
|
await this.loadMarkets();
|
|
2403
|
+
let paginate = false;
|
|
2404
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
|
|
2405
|
+
if (paginate) {
|
|
2406
|
+
return await this.fetchPaginatedCallDeterministic('fetchFundingRateHistory', symbol, since, limit, '8h', params, 1000);
|
|
2407
|
+
}
|
|
2391
2408
|
let market = undefined;
|
|
2392
|
-
|
|
2409
|
+
let request = {
|
|
2393
2410
|
// all arguments are optional
|
|
2394
2411
|
// 'symbols': Comma separated list of symbol codes,
|
|
2395
2412
|
// 'sort': 'DESC' or 'ASC'
|
|
@@ -2398,6 +2415,7 @@ class hitbtc extends hitbtc$1 {
|
|
|
2398
2415
|
// 'limit': 100,
|
|
2399
2416
|
// 'offset': 0,
|
|
2400
2417
|
};
|
|
2418
|
+
[request, params] = this.handleUntilOption('till', request, params);
|
|
2401
2419
|
if (symbol !== undefined) {
|
|
2402
2420
|
market = this.market(symbol);
|
|
2403
2421
|
symbol = market['symbol'];
|