ccxt 4.2.20 → 4.2.22
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 +1405 -274
- package/dist/ccxt.browser.min.js +6 -6
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +37 -4
- package/dist/cjs/src/base/ws/WsClient.js +3 -1
- package/dist/cjs/src/bigone.js +1 -0
- package/dist/cjs/src/binance.js +14 -3
- package/dist/cjs/src/bitget.js +12 -2
- package/dist/cjs/src/bitrue.js +1 -0
- package/dist/cjs/src/bitvavo.js +271 -172
- package/dist/cjs/src/blockchaincom.js +3 -1
- package/dist/cjs/src/bybit.js +57 -9
- package/dist/cjs/src/coinbasepro.js +1 -0
- package/dist/cjs/src/coinex.js +37 -12
- package/dist/cjs/src/deribit.js +164 -0
- package/dist/cjs/src/gate.js +32 -1
- package/dist/cjs/src/novadax.js +26 -22
- package/dist/cjs/src/okcoin.js +3 -0
- package/dist/cjs/src/phemex.js +7 -3
- package/dist/cjs/src/poloniex.js +1 -0
- package/dist/cjs/src/pro/bequant.js +6 -1
- package/dist/cjs/src/pro/binance.js +7 -4
- package/dist/cjs/src/pro/binancecoinm.js +6 -1
- package/dist/cjs/src/pro/binanceus.js +6 -1
- package/dist/cjs/src/pro/bitcoincom.js +6 -1
- package/dist/cjs/src/pro/bitget.js +1 -1
- package/dist/cjs/src/pro/bitopro.js +7 -3
- package/dist/cjs/src/pro/bitrue.js +6 -1
- package/dist/cjs/src/pro/bitvavo.js +668 -22
- package/dist/cjs/src/pro/lbank.js +1 -1
- package/dist/cjs/src/pro/okx.js +13 -3
- package/dist/cjs/src/woo.js +1 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/binance.d.ts +3 -0
- package/js/src/abstract/binancecoinm.d.ts +3 -0
- package/js/src/abstract/binanceus.d.ts +4 -0
- package/js/src/abstract/binanceusdm.d.ts +3 -0
- package/js/src/abstract/gate.d.ts +1 -0
- package/js/src/abstract/gateio.d.ts +1 -0
- package/js/src/abstract/novadax.d.ts +5 -1
- package/js/src/abstract/phemex.d.ts +1 -0
- package/js/src/base/Exchange.d.ts +12 -1
- package/js/src/base/Exchange.js +37 -4
- package/js/src/base/ws/WsClient.js +3 -2
- package/js/src/bigone.js +1 -0
- package/js/src/binance.js +14 -3
- package/js/src/bitget.js +12 -2
- package/js/src/bitrue.js +1 -0
- package/js/src/bitvavo.d.ts +14 -2
- package/js/src/bitvavo.js +271 -172
- package/js/src/blockchaincom.js +3 -1
- package/js/src/bybit.d.ts +2 -1
- package/js/src/bybit.js +57 -9
- package/js/src/coinbasepro.js +1 -0
- package/js/src/coinex.d.ts +1 -0
- package/js/src/coinex.js +37 -12
- package/js/src/deribit.d.ts +6 -1
- package/js/src/deribit.js +164 -0
- package/js/src/gate.d.ts +1 -0
- package/js/src/gate.js +32 -1
- package/js/src/novadax.js +26 -22
- package/js/src/okcoin.js +3 -0
- package/js/src/phemex.js +7 -3
- package/js/src/poloniex.js +1 -0
- package/js/src/pro/bequant.js +6 -1
- package/js/src/pro/binance.js +7 -4
- package/js/src/pro/binancecoinm.js +6 -1
- package/js/src/pro/binanceus.js +6 -1
- package/js/src/pro/bitcoincom.js +6 -1
- package/js/src/pro/bitget.js +1 -1
- package/js/src/pro/bitopro.js +7 -3
- package/js/src/pro/bitrue.js +6 -1
- package/js/src/pro/bitvavo.d.ts +35 -2
- package/js/src/pro/bitvavo.js +669 -23
- package/js/src/pro/lbank.js +1 -1
- package/js/src/pro/okx.js +13 -3
- package/js/src/woo.js +1 -1
- package/jsdoc2md.js +38 -16
- package/package.json +4 -1
- package/skip-tests.json +4 -0
package/dist/cjs/src/bitvavo.js
CHANGED
|
@@ -310,6 +310,7 @@ class bitvavo extends bitvavo$1 {
|
|
|
310
310
|
/**
|
|
311
311
|
* @method
|
|
312
312
|
* @name bitvavo#fetchMarkets
|
|
313
|
+
* @see https://docs.bitvavo.com/#tag/General/paths/~1markets/get
|
|
313
314
|
* @description retrieves data on all markets for bitvavo
|
|
314
315
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
315
316
|
* @returns {object[]} an array of objects representing market data
|
|
@@ -329,12 +330,15 @@ class bitvavo extends bitvavo$1 {
|
|
|
329
330
|
// }
|
|
330
331
|
// ]
|
|
331
332
|
//
|
|
333
|
+
return this.parseMarkets(response);
|
|
334
|
+
}
|
|
335
|
+
parseMarkets(markets) {
|
|
332
336
|
const currencies = this.currencies;
|
|
333
337
|
const currenciesById = this.indexBy(currencies, 'id');
|
|
334
338
|
const result = [];
|
|
335
339
|
const fees = this.fees;
|
|
336
|
-
for (let i = 0; i <
|
|
337
|
-
const market =
|
|
340
|
+
for (let i = 0; i < markets.length; i++) {
|
|
341
|
+
const market = markets[i];
|
|
338
342
|
const id = this.safeString(market, 'market');
|
|
339
343
|
const baseId = this.safeString(market, 'base');
|
|
340
344
|
const quoteId = this.safeString(market, 'quote');
|
|
@@ -401,11 +405,48 @@ class bitvavo extends bitvavo$1 {
|
|
|
401
405
|
/**
|
|
402
406
|
* @method
|
|
403
407
|
* @name bitvavo#fetchCurrencies
|
|
408
|
+
* @see https://docs.bitvavo.com/#tag/General/paths/~1assets/get
|
|
404
409
|
* @description fetches all available currencies on an exchange
|
|
405
410
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
406
411
|
* @returns {object} an associative dictionary of currencies
|
|
407
412
|
*/
|
|
408
413
|
const response = await this.publicGetAssets(params);
|
|
414
|
+
//
|
|
415
|
+
// [
|
|
416
|
+
// {
|
|
417
|
+
// "symbol": "USDT",
|
|
418
|
+
// "displayTicker": "USDT",
|
|
419
|
+
// "name": "Tether",
|
|
420
|
+
// "slug": "tether",
|
|
421
|
+
// "popularity": -1,
|
|
422
|
+
// "decimals": 6,
|
|
423
|
+
// "depositFee": "0",
|
|
424
|
+
// "depositConfirmations": 64,
|
|
425
|
+
// "depositStatus": "OK",
|
|
426
|
+
// "withdrawalFee": "3.2",
|
|
427
|
+
// "withdrawalMinAmount": "3.2",
|
|
428
|
+
// "withdrawalStatus": "OK",
|
|
429
|
+
// "networks": [
|
|
430
|
+
// "ETH"
|
|
431
|
+
// ],
|
|
432
|
+
// "light": {
|
|
433
|
+
// "color": "#009393",
|
|
434
|
+
// "icon": { "hash": "4ad7c699", "svg": "https://...", "webp16": "https://...", "webp32": "https://...", "webp64": "https://...", "webp128": "https://...", "webp256": "https://...", "png16": "https://...", "png32": "https://...", "png64": "https://...", "png128": "https://...", "png256": "https://..."
|
|
435
|
+
// }
|
|
436
|
+
// },
|
|
437
|
+
// "dark": {
|
|
438
|
+
// "color": "#009393",
|
|
439
|
+
// "icon": { "hash": "4ad7c699", "svg": "https://...", "webp16": "https://...", "webp32": "https://...", "webp64": "https://...", "webp128": "https://...", "webp256": "https://...", "png16": "https://...", "png32": "https://...", "png64": "https://...", "png128": "https://...", "png256": "https://..."
|
|
440
|
+
// }
|
|
441
|
+
// },
|
|
442
|
+
// "visibility": "PUBLIC",
|
|
443
|
+
// "message": ""
|
|
444
|
+
// },
|
|
445
|
+
// ]
|
|
446
|
+
//
|
|
447
|
+
return this.parseCurrencies(response);
|
|
448
|
+
}
|
|
449
|
+
parseCurrencies(currencies) {
|
|
409
450
|
//
|
|
410
451
|
// [
|
|
411
452
|
// {
|
|
@@ -440,8 +481,8 @@ class bitvavo extends bitvavo$1 {
|
|
|
440
481
|
// ]
|
|
441
482
|
//
|
|
442
483
|
const result = {};
|
|
443
|
-
for (let i = 0; i <
|
|
444
|
-
const currency =
|
|
484
|
+
for (let i = 0; i < currencies.length; i++) {
|
|
485
|
+
const currency = currencies[i];
|
|
445
486
|
const id = this.safeString(currency, 'symbol');
|
|
446
487
|
const code = this.safeCurrencyCode(id);
|
|
447
488
|
const networks = {};
|
|
@@ -770,6 +811,7 @@ class bitvavo extends bitvavo$1 {
|
|
|
770
811
|
/**
|
|
771
812
|
* @method
|
|
772
813
|
* @name bitvavo#fetchTradingFees
|
|
814
|
+
* @see https://docs.bitvavo.com/#tag/Account/paths/~1account/get
|
|
773
815
|
* @description fetch the trading fees for multiple markets
|
|
774
816
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
775
817
|
* @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
|
|
@@ -785,14 +827,26 @@ class bitvavo extends bitvavo$1 {
|
|
|
785
827
|
// }
|
|
786
828
|
// }
|
|
787
829
|
//
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
830
|
+
return this.parseTradingFees(response);
|
|
831
|
+
}
|
|
832
|
+
parseTradingFees(fees, market = undefined) {
|
|
833
|
+
//
|
|
834
|
+
// {
|
|
835
|
+
// "fees": {
|
|
836
|
+
// "taker": "0.0025",
|
|
837
|
+
// "maker": "0.0015",
|
|
838
|
+
// "volume": "10000.00"
|
|
839
|
+
// }
|
|
840
|
+
// }
|
|
841
|
+
//
|
|
842
|
+
const feesValue = this.safeValue(fees, 'fees');
|
|
843
|
+
const maker = this.safeNumber(feesValue, 'maker');
|
|
844
|
+
const taker = this.safeNumber(feesValue, 'taker');
|
|
791
845
|
const result = {};
|
|
792
846
|
for (let i = 0; i < this.symbols.length; i++) {
|
|
793
847
|
const symbol = this.symbols[i];
|
|
794
848
|
result[symbol] = {
|
|
795
|
-
'info':
|
|
849
|
+
'info': fees,
|
|
796
850
|
'symbol': symbol,
|
|
797
851
|
'maker': maker,
|
|
798
852
|
'taker': taker,
|
|
@@ -862,6 +916,30 @@ class bitvavo extends bitvavo$1 {
|
|
|
862
916
|
this.safeNumber(ohlcv, 5),
|
|
863
917
|
];
|
|
864
918
|
}
|
|
919
|
+
fetchOHLCVRequest(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
920
|
+
const market = this.market(symbol);
|
|
921
|
+
let request = {
|
|
922
|
+
'market': market['id'],
|
|
923
|
+
'interval': this.safeString(this.timeframes, timeframe, timeframe),
|
|
924
|
+
// "limit": 1440, // default 1440, max 1440
|
|
925
|
+
// "start": since,
|
|
926
|
+
// "end": this.milliseconds (),
|
|
927
|
+
};
|
|
928
|
+
if (since !== undefined) {
|
|
929
|
+
// https://github.com/ccxt/ccxt/issues/9227
|
|
930
|
+
const duration = this.parseTimeframe(timeframe);
|
|
931
|
+
request['start'] = since;
|
|
932
|
+
if (limit === undefined) {
|
|
933
|
+
limit = 1440;
|
|
934
|
+
}
|
|
935
|
+
request['end'] = this.sum(since, limit * duration * 1000);
|
|
936
|
+
}
|
|
937
|
+
[request, params] = this.handleUntilOption('end', request, params);
|
|
938
|
+
if (limit !== undefined) {
|
|
939
|
+
request['limit'] = limit; // default 1440, max 1440
|
|
940
|
+
}
|
|
941
|
+
return this.extend(request, params);
|
|
942
|
+
}
|
|
865
943
|
async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
866
944
|
/**
|
|
867
945
|
* @method
|
|
@@ -884,27 +962,8 @@ class bitvavo extends bitvavo$1 {
|
|
|
884
962
|
if (paginate) {
|
|
885
963
|
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 1440);
|
|
886
964
|
}
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
'interval': this.safeString(this.timeframes, timeframe, timeframe),
|
|
890
|
-
// "limit": 1440, // default 1440, max 1440
|
|
891
|
-
// "start": since,
|
|
892
|
-
// "end": this.milliseconds (),
|
|
893
|
-
};
|
|
894
|
-
if (since !== undefined) {
|
|
895
|
-
// https://github.com/ccxt/ccxt/issues/9227
|
|
896
|
-
const duration = this.parseTimeframe(timeframe);
|
|
897
|
-
request['start'] = since;
|
|
898
|
-
if (limit === undefined) {
|
|
899
|
-
limit = 1440;
|
|
900
|
-
}
|
|
901
|
-
request['end'] = this.sum(since, limit * duration * 1000);
|
|
902
|
-
}
|
|
903
|
-
[request, params] = this.handleUntilOption('end', request, params);
|
|
904
|
-
if (limit !== undefined) {
|
|
905
|
-
request['limit'] = limit; // default 1440, max 1440
|
|
906
|
-
}
|
|
907
|
-
const response = await this.publicGetMarketCandles(this.extend(request, params));
|
|
965
|
+
const request = this.fetchOHLCVRequest(symbol, timeframe, since, limit, params);
|
|
966
|
+
const response = await this.publicGetMarketCandles(request);
|
|
908
967
|
//
|
|
909
968
|
// [
|
|
910
969
|
// [1590383700000,"8088.5","8088.5","8088.5","8088.5","0.04788623"],
|
|
@@ -935,6 +994,7 @@ class bitvavo extends bitvavo$1 {
|
|
|
935
994
|
/**
|
|
936
995
|
* @method
|
|
937
996
|
* @name bitvavo#fetchBalance
|
|
997
|
+
* @see https://docs.bitvavo.com/#tag/Account/paths/~1balance/get
|
|
938
998
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
939
999
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
940
1000
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
@@ -984,33 +1044,7 @@ class bitvavo extends bitvavo$1 {
|
|
|
984
1044
|
'info': response,
|
|
985
1045
|
};
|
|
986
1046
|
}
|
|
987
|
-
|
|
988
|
-
/**
|
|
989
|
-
* @method
|
|
990
|
-
* @name bitvavo#createOrder
|
|
991
|
-
* @description create a trade order
|
|
992
|
-
* @see https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1order/post
|
|
993
|
-
* @param {string} symbol unified symbol of the market to create an order in
|
|
994
|
-
* @param {string} type 'market' or 'limit'
|
|
995
|
-
* @param {string} side 'buy' or 'sell'
|
|
996
|
-
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
997
|
-
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
998
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
999
|
-
* @param {string} [params.timeInForce] "GTC", "IOC", or "PO"
|
|
1000
|
-
* @param {float} [params.stopPrice] The price at which a trigger order is triggered at
|
|
1001
|
-
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
|
1002
|
-
* @param {bool} [params.postOnly] If true, the order will only be posted to the order book and not executed immediately
|
|
1003
|
-
* @param {float} [params.stopLossPrice] The price at which a stop loss order is triggered at
|
|
1004
|
-
* @param {float} [params.takeProfitPrice] The price at which a take profit order is triggered at
|
|
1005
|
-
* @param {string} [params.triggerType] "price"
|
|
1006
|
-
* @param {string} [params.triggerReference] "lastTrade", "bestBid", "bestAsk", "midPrice" Only for stop orders: Use this to determine which parameter will trigger the order
|
|
1007
|
-
* @param {string} [params.selfTradePrevention] "decrementAndCancel", "cancelOldest", "cancelNewest", "cancelBoth"
|
|
1008
|
-
* @param {bool} [params.disableMarketProtection] don't cancel if the next fill price is 10% worse than the best fill price
|
|
1009
|
-
* @param {bool} [params.responseRequired] Set this to 'false' when only an acknowledgement of success or failure is required, this is faster.
|
|
1010
|
-
* @param {string} [params.clientOrderId] An ID supplied by the client that must be unique among all open orders for the same market
|
|
1011
|
-
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1012
|
-
*/
|
|
1013
|
-
await this.loadMarkets();
|
|
1047
|
+
createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
|
|
1014
1048
|
const market = this.market(symbol);
|
|
1015
1049
|
const request = {
|
|
1016
1050
|
'market': market['id'],
|
|
@@ -1074,7 +1108,37 @@ class bitvavo extends bitvavo$1 {
|
|
|
1074
1108
|
if (postOnly) {
|
|
1075
1109
|
request['postOnly'] = true;
|
|
1076
1110
|
}
|
|
1077
|
-
|
|
1111
|
+
return this.extend(request, params);
|
|
1112
|
+
}
|
|
1113
|
+
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
1114
|
+
/**
|
|
1115
|
+
* @method
|
|
1116
|
+
* @name bitvavo#createOrder
|
|
1117
|
+
* @description create a trade order
|
|
1118
|
+
* @see https://docs.bitvavo.com/#tag/Orders/paths/~1order/post
|
|
1119
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
1120
|
+
* @param {string} type 'market' or 'limit'
|
|
1121
|
+
* @param {string} side 'buy' or 'sell'
|
|
1122
|
+
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
1123
|
+
* @param {float} price the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
1124
|
+
* @param {object} [params] extra parameters specific to the bitvavo api endpoint
|
|
1125
|
+
* @param {string} [params.timeInForce] "GTC", "IOC", or "PO"
|
|
1126
|
+
* @param {float} [params.stopPrice] The price at which a trigger order is triggered at
|
|
1127
|
+
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
|
1128
|
+
* @param {bool} [params.postOnly] If true, the order will only be posted to the order book and not executed immediately
|
|
1129
|
+
* @param {float} [params.stopLossPrice] The price at which a stop loss order is triggered at
|
|
1130
|
+
* @param {float} [params.takeProfitPrice] The price at which a take profit order is triggered at
|
|
1131
|
+
* @param {string} [params.triggerType] "price"
|
|
1132
|
+
* @param {string} [params.triggerReference] "lastTrade", "bestBid", "bestAsk", "midPrice" Only for stop orders: Use this to determine which parameter will trigger the order
|
|
1133
|
+
* @param {string} [params.selfTradePrevention] "decrementAndCancel", "cancelOldest", "cancelNewest", "cancelBoth"
|
|
1134
|
+
* @param {bool} [params.disableMarketProtection] don't cancel if the next fill price is 10% worse than the best fill price
|
|
1135
|
+
* @param {bool} [params.responseRequired] Set this to 'false' when only an acknowledgement of success or failure is required, this is faster.
|
|
1136
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1137
|
+
*/
|
|
1138
|
+
await this.loadMarkets();
|
|
1139
|
+
const market = this.market(symbol);
|
|
1140
|
+
const request = this.createOrderRequest(symbol, type, side, amount, price, params);
|
|
1141
|
+
const response = await this.privatePostOrder(request);
|
|
1078
1142
|
//
|
|
1079
1143
|
// {
|
|
1080
1144
|
// "orderId":"dec6a640-5b4c-45bc-8d22-3b41c6716630",
|
|
@@ -1117,29 +1181,61 @@ class bitvavo extends bitvavo$1 {
|
|
|
1117
1181
|
//
|
|
1118
1182
|
return this.parseOrder(response, market);
|
|
1119
1183
|
}
|
|
1184
|
+
editOrderRequest(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
1185
|
+
let request = {};
|
|
1186
|
+
const market = this.market(symbol);
|
|
1187
|
+
const amountRemaining = this.safeNumber(params, 'amountRemaining');
|
|
1188
|
+
const triggerPrice = this.safeStringN(params, ['triggerPrice', 'stopPrice', 'triggerAmount']);
|
|
1189
|
+
params = this.omit(params, ['amountRemaining', 'triggerPrice', 'stopPrice', 'triggerAmount']);
|
|
1190
|
+
if (price !== undefined) {
|
|
1191
|
+
request['price'] = this.priceToPrecision(symbol, price);
|
|
1192
|
+
}
|
|
1193
|
+
if (amount !== undefined) {
|
|
1194
|
+
request['amount'] = this.amountToPrecision(symbol, amount);
|
|
1195
|
+
}
|
|
1196
|
+
if (amountRemaining !== undefined) {
|
|
1197
|
+
request['amountRemaining'] = this.amountToPrecision(symbol, amountRemaining);
|
|
1198
|
+
}
|
|
1199
|
+
if (triggerPrice !== undefined) {
|
|
1200
|
+
request['triggerAmount'] = this.priceToPrecision(symbol, triggerPrice);
|
|
1201
|
+
}
|
|
1202
|
+
request = this.extend(request, params);
|
|
1203
|
+
if (this.isEmpty(request)) {
|
|
1204
|
+
throw new errors.ArgumentsRequired(this.id + ' editOrder() requires an amount argument, or a price argument, or non-empty params');
|
|
1205
|
+
}
|
|
1206
|
+
const clientOrderId = this.safeString(params, 'clientOrderId');
|
|
1207
|
+
if (clientOrderId === undefined) {
|
|
1208
|
+
request['orderId'] = id;
|
|
1209
|
+
}
|
|
1210
|
+
request['market'] = market['id'];
|
|
1211
|
+
return request;
|
|
1212
|
+
}
|
|
1120
1213
|
async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
1121
1214
|
/**
|
|
1122
1215
|
* @method
|
|
1123
1216
|
* @name bitvavo#editOrder
|
|
1124
1217
|
* @description edit a trade order
|
|
1125
|
-
* @see https://docs.bitvavo.com/#tag/
|
|
1218
|
+
* @see https://docs.bitvavo.com/#tag/Orders/paths/~1order/put
|
|
1219
|
+
* @param {string} id cancel order id
|
|
1126
1220
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
1127
1221
|
* @param {string} type 'market' or 'limit'
|
|
1128
1222
|
* @param {string} side 'buy' or 'sell'
|
|
1129
|
-
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
1130
|
-
* @param {float} [price] the price at which the order is to be fullfilled, in units of the
|
|
1131
|
-
* @param {object} [params] extra parameters specific to the
|
|
1132
|
-
* @param {string} [params.timeInForce] "GTC", "IOC", or "PO"
|
|
1133
|
-
* @param {bool} [params.postOnly] If true, the order will only be posted to the order book and not executed immediately
|
|
1134
|
-
* @param {float} [params.stopPrice] The price at which a trigger order is triggered at
|
|
1135
|
-
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
|
1136
|
-
* @param {string} [params.selfTradePrevention] "decrementAndCancel", "cancelOldest", "cancelNewest", "cancelBoth"
|
|
1137
|
-
* @param {bool} [params.responseRequired] Set this to 'false' when only an acknowledgement of success or failure is required, this is faster.
|
|
1138
|
-
* @param {string} [params.clientOrderId] An ID supplied by the client
|
|
1223
|
+
* @param {float} [amount] how much of currency you want to trade in units of base currency
|
|
1224
|
+
* @param {float} [price] the price at which the order is to be fullfilled, in units of the base currency, ignored in market orders
|
|
1225
|
+
* @param {object} [params] extra parameters specific to the bitvavo api endpoint
|
|
1139
1226
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1140
1227
|
*/
|
|
1141
1228
|
await this.loadMarkets();
|
|
1142
1229
|
const market = this.market(symbol);
|
|
1230
|
+
const request = this.editOrderRequest(id, symbol, type, side, amount, price, params);
|
|
1231
|
+
const response = await this.privatePutOrder(request);
|
|
1232
|
+
return this.parseOrder(response, market);
|
|
1233
|
+
}
|
|
1234
|
+
cancelOrderRequest(id, symbol = undefined, params = {}) {
|
|
1235
|
+
if (symbol === undefined) {
|
|
1236
|
+
throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
|
|
1237
|
+
}
|
|
1238
|
+
const market = this.market(symbol);
|
|
1143
1239
|
const request = {
|
|
1144
1240
|
'market': market['id'],
|
|
1145
1241
|
};
|
|
@@ -1147,35 +1243,13 @@ class bitvavo extends bitvavo$1 {
|
|
|
1147
1243
|
if (clientOrderId === undefined) {
|
|
1148
1244
|
request['orderId'] = id;
|
|
1149
1245
|
}
|
|
1150
|
-
|
|
1151
|
-
const triggerPrice = this.safeStringN(params, ['triggerPrice', 'stopPrice', 'triggerAmount']);
|
|
1152
|
-
params = this.omit(params, ['amountRemaining', 'triggerPrice', 'stopPrice', 'triggerAmount']);
|
|
1153
|
-
let updateRequest = {};
|
|
1154
|
-
if (price !== undefined) {
|
|
1155
|
-
updateRequest['price'] = this.priceToPrecision(symbol, price);
|
|
1156
|
-
}
|
|
1157
|
-
if (amount !== undefined) {
|
|
1158
|
-
updateRequest['amount'] = this.amountToPrecision(symbol, amount);
|
|
1159
|
-
}
|
|
1160
|
-
if (amountRemaining !== undefined) {
|
|
1161
|
-
updateRequest['amountRemaining'] = this.amountToPrecision(symbol, amountRemaining);
|
|
1162
|
-
}
|
|
1163
|
-
if (triggerPrice !== undefined) {
|
|
1164
|
-
updateRequest['triggerAmount'] = this.priceToPrecision(symbol, triggerPrice);
|
|
1165
|
-
}
|
|
1166
|
-
updateRequest = this.extend(updateRequest, params);
|
|
1167
|
-
if (Object.keys(updateRequest).length) {
|
|
1168
|
-
const response = await this.privatePutOrder(this.extend(request, updateRequest));
|
|
1169
|
-
return this.parseOrder(response, market);
|
|
1170
|
-
}
|
|
1171
|
-
else {
|
|
1172
|
-
throw new errors.ArgumentsRequired(this.id + ' editOrder() requires an amount argument, or a price argument, or non-empty params');
|
|
1173
|
-
}
|
|
1246
|
+
return this.extend(request, params);
|
|
1174
1247
|
}
|
|
1175
1248
|
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
1176
1249
|
/**
|
|
1177
1250
|
* @method
|
|
1178
1251
|
* @name bitvavo#cancelOrder
|
|
1252
|
+
* @see https://docs.bitvavo.com/#tag/Orders/paths/~1order/delete
|
|
1179
1253
|
* @description cancels an open order
|
|
1180
1254
|
* @see https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1order/delete
|
|
1181
1255
|
* @param {string} id order id
|
|
@@ -1183,19 +1257,10 @@ class bitvavo extends bitvavo$1 {
|
|
|
1183
1257
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1184
1258
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1185
1259
|
*/
|
|
1186
|
-
if (symbol === undefined) {
|
|
1187
|
-
throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
|
|
1188
|
-
}
|
|
1189
1260
|
await this.loadMarkets();
|
|
1190
1261
|
const market = this.market(symbol);
|
|
1191
|
-
const request =
|
|
1192
|
-
|
|
1193
|
-
};
|
|
1194
|
-
const clientOrderId = this.safeString(params, 'clientOrderId');
|
|
1195
|
-
if (clientOrderId === undefined) {
|
|
1196
|
-
request['orderId'] = id;
|
|
1197
|
-
}
|
|
1198
|
-
const response = await this.privateDeleteOrder(this.extend(request, params));
|
|
1262
|
+
const request = this.cancelOrderRequest(id, symbol, params);
|
|
1263
|
+
const response = await this.privateDeleteOrder(request);
|
|
1199
1264
|
//
|
|
1200
1265
|
// {
|
|
1201
1266
|
// "orderId": "2e7ce7fc-44e2-4d80-a4a7-d079c4750b61"
|
|
@@ -1207,6 +1272,7 @@ class bitvavo extends bitvavo$1 {
|
|
|
1207
1272
|
/**
|
|
1208
1273
|
* @method
|
|
1209
1274
|
* @name bitvavo#cancelAllOrders
|
|
1275
|
+
* @see https://docs.bitvavo.com/#tag/Orders/paths/~1orders/delete
|
|
1210
1276
|
* @description cancel all open orders
|
|
1211
1277
|
* @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
|
|
1212
1278
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -1288,6 +1354,25 @@ class bitvavo extends bitvavo$1 {
|
|
|
1288
1354
|
//
|
|
1289
1355
|
return this.parseOrder(response, market);
|
|
1290
1356
|
}
|
|
1357
|
+
fetchOrdersRequest(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1358
|
+
const market = this.market(symbol);
|
|
1359
|
+
let request = {
|
|
1360
|
+
'market': market['id'],
|
|
1361
|
+
// "limit": 500,
|
|
1362
|
+
// "start": since,
|
|
1363
|
+
// "end": this.milliseconds (),
|
|
1364
|
+
// "orderIdFrom": "af76d6ce-9f7c-4006-b715-bb5d430652d0",
|
|
1365
|
+
// "orderIdTo": "af76d6ce-9f7c-4006-b715-bb5d430652d0",
|
|
1366
|
+
};
|
|
1367
|
+
if (since !== undefined) {
|
|
1368
|
+
request['start'] = since;
|
|
1369
|
+
}
|
|
1370
|
+
if (limit !== undefined) {
|
|
1371
|
+
request['limit'] = limit; // default 500, max 1000
|
|
1372
|
+
}
|
|
1373
|
+
[request, params] = this.handleUntilOption('end', request, params);
|
|
1374
|
+
return this.extend(request, params);
|
|
1375
|
+
}
|
|
1291
1376
|
async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1292
1377
|
/**
|
|
1293
1378
|
* @method
|
|
@@ -1312,22 +1397,8 @@ class bitvavo extends bitvavo$1 {
|
|
|
1312
1397
|
return await this.fetchPaginatedCallDynamic('fetchOrders', symbol, since, limit, params);
|
|
1313
1398
|
}
|
|
1314
1399
|
const market = this.market(symbol);
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
// "limit": 500,
|
|
1318
|
-
// "start": since,
|
|
1319
|
-
// "end": this.milliseconds (),
|
|
1320
|
-
// "orderIdFrom": "af76d6ce-9f7c-4006-b715-bb5d430652d0",
|
|
1321
|
-
// "orderIdTo": "af76d6ce-9f7c-4006-b715-bb5d430652d0",
|
|
1322
|
-
};
|
|
1323
|
-
if (since !== undefined) {
|
|
1324
|
-
request['start'] = since;
|
|
1325
|
-
}
|
|
1326
|
-
if (limit !== undefined) {
|
|
1327
|
-
request['limit'] = limit; // default 500, max 1000
|
|
1328
|
-
}
|
|
1329
|
-
[request, params] = this.handleUntilOption('end', request, params);
|
|
1330
|
-
const response = await this.privateGetOrders(this.extend(request, params));
|
|
1400
|
+
const request = this.fetchOrdersRequest(symbol, since, limit, params);
|
|
1401
|
+
const response = await this.privateGetOrders(request);
|
|
1331
1402
|
//
|
|
1332
1403
|
// [
|
|
1333
1404
|
// {
|
|
@@ -1547,6 +1618,25 @@ class bitvavo extends bitvavo$1 {
|
|
|
1547
1618
|
'trades': rawTrades,
|
|
1548
1619
|
}, market);
|
|
1549
1620
|
}
|
|
1621
|
+
fetchMyTradesRequest(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1622
|
+
const market = this.market(symbol);
|
|
1623
|
+
let request = {
|
|
1624
|
+
'market': market['id'],
|
|
1625
|
+
// "limit": 500,
|
|
1626
|
+
// "start": since,
|
|
1627
|
+
// "end": this.milliseconds (),
|
|
1628
|
+
// "tradeIdFrom": "af76d6ce-9f7c-4006-b715-bb5d430652d0",
|
|
1629
|
+
// "tradeIdTo": "af76d6ce-9f7c-4006-b715-bb5d430652d0",
|
|
1630
|
+
};
|
|
1631
|
+
if (since !== undefined) {
|
|
1632
|
+
request['start'] = since;
|
|
1633
|
+
}
|
|
1634
|
+
if (limit !== undefined) {
|
|
1635
|
+
request['limit'] = limit; // default 500, max 1000
|
|
1636
|
+
}
|
|
1637
|
+
[request, params] = this.handleUntilOption('end', request, params);
|
|
1638
|
+
return this.extend(request, params);
|
|
1639
|
+
}
|
|
1550
1640
|
async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1551
1641
|
/**
|
|
1552
1642
|
* @method
|
|
@@ -1571,22 +1661,8 @@ class bitvavo extends bitvavo$1 {
|
|
|
1571
1661
|
return await this.fetchPaginatedCallDynamic('fetchMyTrades', symbol, since, limit, params);
|
|
1572
1662
|
}
|
|
1573
1663
|
const market = this.market(symbol);
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
// "limit": 500,
|
|
1577
|
-
// "start": since,
|
|
1578
|
-
// "end": this.milliseconds (),
|
|
1579
|
-
// "tradeIdFrom": "af76d6ce-9f7c-4006-b715-bb5d430652d0",
|
|
1580
|
-
// "tradeIdTo": "af76d6ce-9f7c-4006-b715-bb5d430652d0",
|
|
1581
|
-
};
|
|
1582
|
-
if (since !== undefined) {
|
|
1583
|
-
request['start'] = since;
|
|
1584
|
-
}
|
|
1585
|
-
if (limit !== undefined) {
|
|
1586
|
-
request['limit'] = limit; // default 500, max 1000
|
|
1587
|
-
}
|
|
1588
|
-
[request, params] = this.handleUntilOption('end', request, params);
|
|
1589
|
-
const response = await this.privateGetTrades(this.extend(request, params));
|
|
1664
|
+
const request = this.fetchMyTradesRequest(symbol, since, limit, params);
|
|
1665
|
+
const response = await this.privateGetTrades(request);
|
|
1590
1666
|
//
|
|
1591
1667
|
// [
|
|
1592
1668
|
// {
|
|
@@ -1606,6 +1682,20 @@ class bitvavo extends bitvavo$1 {
|
|
|
1606
1682
|
//
|
|
1607
1683
|
return this.parseTrades(response, market, since, limit);
|
|
1608
1684
|
}
|
|
1685
|
+
withdrawRequest(code, amount, address, tag = undefined, params = {}) {
|
|
1686
|
+
const currency = this.currency(code);
|
|
1687
|
+
const request = {
|
|
1688
|
+
'symbol': currency['id'],
|
|
1689
|
+
'amount': this.currencyToPrecision(code, amount),
|
|
1690
|
+
'address': address, // address or IBAN
|
|
1691
|
+
// 'internal': false, // transfer to another Bitvavo user address, no fees
|
|
1692
|
+
// 'addWithdrawalFee': false, // true = add the fee on top, otherwise the fee is subtracted from the amount
|
|
1693
|
+
};
|
|
1694
|
+
if (tag !== undefined) {
|
|
1695
|
+
request['paymentId'] = tag;
|
|
1696
|
+
}
|
|
1697
|
+
return this.extend(request, params);
|
|
1698
|
+
}
|
|
1609
1699
|
async withdraw(code, amount, address, tag = undefined, params = {}) {
|
|
1610
1700
|
/**
|
|
1611
1701
|
* @method
|
|
@@ -1622,17 +1712,8 @@ class bitvavo extends bitvavo$1 {
|
|
|
1622
1712
|
this.checkAddress(address);
|
|
1623
1713
|
await this.loadMarkets();
|
|
1624
1714
|
const currency = this.currency(code);
|
|
1625
|
-
const request =
|
|
1626
|
-
|
|
1627
|
-
'amount': this.currencyToPrecision(code, amount),
|
|
1628
|
-
'address': address, // address or IBAN
|
|
1629
|
-
// "internal": false, // transfer to another Bitvavo user address, no fees
|
|
1630
|
-
// "addWithdrawalFee": false, // true = add the fee on top, otherwise the fee is subtracted from the amount
|
|
1631
|
-
};
|
|
1632
|
-
if (tag !== undefined) {
|
|
1633
|
-
request['paymentId'] = tag;
|
|
1634
|
-
}
|
|
1635
|
-
const response = await this.privatePostWithdrawal(this.extend(request, params));
|
|
1715
|
+
const request = this.withdrawRequest(code, amount, address, tag, params);
|
|
1716
|
+
const response = await this.privatePostWithdrawal(request);
|
|
1636
1717
|
//
|
|
1637
1718
|
// {
|
|
1638
1719
|
// "success": true,
|
|
@@ -1642,18 +1723,7 @@ class bitvavo extends bitvavo$1 {
|
|
|
1642
1723
|
//
|
|
1643
1724
|
return this.parseTransaction(response, currency);
|
|
1644
1725
|
}
|
|
1645
|
-
|
|
1646
|
-
/**
|
|
1647
|
-
* @method
|
|
1648
|
-
* @name bitvavo#fetchWithdrawals
|
|
1649
|
-
* @description fetch all withdrawals made from an account
|
|
1650
|
-
* @param {string} code unified currency code
|
|
1651
|
-
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
1652
|
-
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
1653
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1654
|
-
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
1655
|
-
*/
|
|
1656
|
-
await this.loadMarkets();
|
|
1726
|
+
fetchWithdrawalsRequest(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1657
1727
|
const request = {
|
|
1658
1728
|
// 'symbol': currency['id'],
|
|
1659
1729
|
// 'limit': 500, // default 500, max 1000
|
|
@@ -1671,7 +1741,27 @@ class bitvavo extends bitvavo$1 {
|
|
|
1671
1741
|
if (limit !== undefined) {
|
|
1672
1742
|
request['limit'] = limit; // default 500, max 1000
|
|
1673
1743
|
}
|
|
1674
|
-
|
|
1744
|
+
return this.extend(request, params);
|
|
1745
|
+
}
|
|
1746
|
+
async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1747
|
+
/**
|
|
1748
|
+
* @method
|
|
1749
|
+
* @name bitvavo#fetchWithdrawals
|
|
1750
|
+
* @see https://docs.bitvavo.com/#tag/Account/paths/~1withdrawalHistory/get
|
|
1751
|
+
* @description fetch all withdrawals made from an account
|
|
1752
|
+
* @param {string} code unified currency code
|
|
1753
|
+
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
1754
|
+
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
1755
|
+
* @param {object} [params] extra parameters specific to the bitvavo api endpoint
|
|
1756
|
+
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
1757
|
+
*/
|
|
1758
|
+
await this.loadMarkets();
|
|
1759
|
+
const request = this.fetchWithdrawalsRequest(code, since, limit, params);
|
|
1760
|
+
let currency = undefined;
|
|
1761
|
+
if (code !== undefined) {
|
|
1762
|
+
currency = this.currency(code);
|
|
1763
|
+
}
|
|
1764
|
+
const response = await this.privateGetWithdrawalHistory(request);
|
|
1675
1765
|
//
|
|
1676
1766
|
// [
|
|
1677
1767
|
// {
|
|
@@ -1688,18 +1778,7 @@ class bitvavo extends bitvavo$1 {
|
|
|
1688
1778
|
//
|
|
1689
1779
|
return this.parseTransactions(response, currency, since, limit, { 'type': 'withdrawal' });
|
|
1690
1780
|
}
|
|
1691
|
-
|
|
1692
|
-
/**
|
|
1693
|
-
* @method
|
|
1694
|
-
* @name bitvavo#fetchDeposits
|
|
1695
|
-
* @description fetch all deposits made to an account
|
|
1696
|
-
* @param {string} code unified currency code
|
|
1697
|
-
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
1698
|
-
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
1699
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1700
|
-
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
1701
|
-
*/
|
|
1702
|
-
await this.loadMarkets();
|
|
1781
|
+
fetchDepositsRequest(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1703
1782
|
const request = {
|
|
1704
1783
|
// 'symbol': currency['id'],
|
|
1705
1784
|
// 'limit': 500, // default 500, max 1000
|
|
@@ -1717,7 +1796,27 @@ class bitvavo extends bitvavo$1 {
|
|
|
1717
1796
|
if (limit !== undefined) {
|
|
1718
1797
|
request['limit'] = limit; // default 500, max 1000
|
|
1719
1798
|
}
|
|
1720
|
-
|
|
1799
|
+
return this.extend(request, params);
|
|
1800
|
+
}
|
|
1801
|
+
async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1802
|
+
/**
|
|
1803
|
+
* @method
|
|
1804
|
+
* @name bitvavo#fetchDeposits
|
|
1805
|
+
* @see https://docs.bitvavo.com/#tag/Account/paths/~1depositHistory/get
|
|
1806
|
+
* @description fetch all deposits made to an account
|
|
1807
|
+
* @param {string} code unified currency code
|
|
1808
|
+
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
1809
|
+
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
1810
|
+
* @param {object} [params] extra parameters specific to the bitvavo api endpoint
|
|
1811
|
+
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
1812
|
+
*/
|
|
1813
|
+
await this.loadMarkets();
|
|
1814
|
+
const request = this.fetchDepositsRequest(code, since, limit, params);
|
|
1815
|
+
let currency = undefined;
|
|
1816
|
+
if (code !== undefined) {
|
|
1817
|
+
currency = this.currency(code);
|
|
1818
|
+
}
|
|
1819
|
+
const response = await this.privateGetDepositHistory(request);
|
|
1721
1820
|
//
|
|
1722
1821
|
// [
|
|
1723
1822
|
// {
|
|
@@ -814,8 +814,10 @@ class blockchaincom extends blockchaincom$1 {
|
|
|
814
814
|
let tag = undefined;
|
|
815
815
|
let address = undefined;
|
|
816
816
|
if (rawAddress !== undefined) {
|
|
817
|
+
const addressParts = rawAddress.split(';');
|
|
817
818
|
// if a tag or memo is used it is separated by a colon in the 'address' value
|
|
818
|
-
|
|
819
|
+
tag = this.safeString(addressParts, 0);
|
|
820
|
+
address = this.safeString(addressParts, 1);
|
|
819
821
|
}
|
|
820
822
|
const result = { 'info': response };
|
|
821
823
|
result['currency'] = currency['code'];
|