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/js/src/bitvavo.js
CHANGED
|
@@ -313,6 +313,7 @@ export default class bitvavo extends Exchange {
|
|
|
313
313
|
/**
|
|
314
314
|
* @method
|
|
315
315
|
* @name bitvavo#fetchMarkets
|
|
316
|
+
* @see https://docs.bitvavo.com/#tag/General/paths/~1markets/get
|
|
316
317
|
* @description retrieves data on all markets for bitvavo
|
|
317
318
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
318
319
|
* @returns {object[]} an array of objects representing market data
|
|
@@ -332,12 +333,15 @@ export default class bitvavo extends Exchange {
|
|
|
332
333
|
// }
|
|
333
334
|
// ]
|
|
334
335
|
//
|
|
336
|
+
return this.parseMarkets(response);
|
|
337
|
+
}
|
|
338
|
+
parseMarkets(markets) {
|
|
335
339
|
const currencies = this.currencies;
|
|
336
340
|
const currenciesById = this.indexBy(currencies, 'id');
|
|
337
341
|
const result = [];
|
|
338
342
|
const fees = this.fees;
|
|
339
|
-
for (let i = 0; i <
|
|
340
|
-
const market =
|
|
343
|
+
for (let i = 0; i < markets.length; i++) {
|
|
344
|
+
const market = markets[i];
|
|
341
345
|
const id = this.safeString(market, 'market');
|
|
342
346
|
const baseId = this.safeString(market, 'base');
|
|
343
347
|
const quoteId = this.safeString(market, 'quote');
|
|
@@ -404,11 +408,48 @@ export default class bitvavo extends Exchange {
|
|
|
404
408
|
/**
|
|
405
409
|
* @method
|
|
406
410
|
* @name bitvavo#fetchCurrencies
|
|
411
|
+
* @see https://docs.bitvavo.com/#tag/General/paths/~1assets/get
|
|
407
412
|
* @description fetches all available currencies on an exchange
|
|
408
413
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
409
414
|
* @returns {object} an associative dictionary of currencies
|
|
410
415
|
*/
|
|
411
416
|
const response = await this.publicGetAssets(params);
|
|
417
|
+
//
|
|
418
|
+
// [
|
|
419
|
+
// {
|
|
420
|
+
// "symbol": "USDT",
|
|
421
|
+
// "displayTicker": "USDT",
|
|
422
|
+
// "name": "Tether",
|
|
423
|
+
// "slug": "tether",
|
|
424
|
+
// "popularity": -1,
|
|
425
|
+
// "decimals": 6,
|
|
426
|
+
// "depositFee": "0",
|
|
427
|
+
// "depositConfirmations": 64,
|
|
428
|
+
// "depositStatus": "OK",
|
|
429
|
+
// "withdrawalFee": "3.2",
|
|
430
|
+
// "withdrawalMinAmount": "3.2",
|
|
431
|
+
// "withdrawalStatus": "OK",
|
|
432
|
+
// "networks": [
|
|
433
|
+
// "ETH"
|
|
434
|
+
// ],
|
|
435
|
+
// "light": {
|
|
436
|
+
// "color": "#009393",
|
|
437
|
+
// "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://..."
|
|
438
|
+
// }
|
|
439
|
+
// },
|
|
440
|
+
// "dark": {
|
|
441
|
+
// "color": "#009393",
|
|
442
|
+
// "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://..."
|
|
443
|
+
// }
|
|
444
|
+
// },
|
|
445
|
+
// "visibility": "PUBLIC",
|
|
446
|
+
// "message": ""
|
|
447
|
+
// },
|
|
448
|
+
// ]
|
|
449
|
+
//
|
|
450
|
+
return this.parseCurrencies(response);
|
|
451
|
+
}
|
|
452
|
+
parseCurrencies(currencies) {
|
|
412
453
|
//
|
|
413
454
|
// [
|
|
414
455
|
// {
|
|
@@ -443,8 +484,8 @@ export default class bitvavo extends Exchange {
|
|
|
443
484
|
// ]
|
|
444
485
|
//
|
|
445
486
|
const result = {};
|
|
446
|
-
for (let i = 0; i <
|
|
447
|
-
const currency =
|
|
487
|
+
for (let i = 0; i < currencies.length; i++) {
|
|
488
|
+
const currency = currencies[i];
|
|
448
489
|
const id = this.safeString(currency, 'symbol');
|
|
449
490
|
const code = this.safeCurrencyCode(id);
|
|
450
491
|
const networks = {};
|
|
@@ -773,6 +814,7 @@ export default class bitvavo extends Exchange {
|
|
|
773
814
|
/**
|
|
774
815
|
* @method
|
|
775
816
|
* @name bitvavo#fetchTradingFees
|
|
817
|
+
* @see https://docs.bitvavo.com/#tag/Account/paths/~1account/get
|
|
776
818
|
* @description fetch the trading fees for multiple markets
|
|
777
819
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
778
820
|
* @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
|
|
@@ -788,14 +830,26 @@ export default class bitvavo extends Exchange {
|
|
|
788
830
|
// }
|
|
789
831
|
// }
|
|
790
832
|
//
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
833
|
+
return this.parseTradingFees(response);
|
|
834
|
+
}
|
|
835
|
+
parseTradingFees(fees, market = undefined) {
|
|
836
|
+
//
|
|
837
|
+
// {
|
|
838
|
+
// "fees": {
|
|
839
|
+
// "taker": "0.0025",
|
|
840
|
+
// "maker": "0.0015",
|
|
841
|
+
// "volume": "10000.00"
|
|
842
|
+
// }
|
|
843
|
+
// }
|
|
844
|
+
//
|
|
845
|
+
const feesValue = this.safeValue(fees, 'fees');
|
|
846
|
+
const maker = this.safeNumber(feesValue, 'maker');
|
|
847
|
+
const taker = this.safeNumber(feesValue, 'taker');
|
|
794
848
|
const result = {};
|
|
795
849
|
for (let i = 0; i < this.symbols.length; i++) {
|
|
796
850
|
const symbol = this.symbols[i];
|
|
797
851
|
result[symbol] = {
|
|
798
|
-
'info':
|
|
852
|
+
'info': fees,
|
|
799
853
|
'symbol': symbol,
|
|
800
854
|
'maker': maker,
|
|
801
855
|
'taker': taker,
|
|
@@ -865,6 +919,30 @@ export default class bitvavo extends Exchange {
|
|
|
865
919
|
this.safeNumber(ohlcv, 5),
|
|
866
920
|
];
|
|
867
921
|
}
|
|
922
|
+
fetchOHLCVRequest(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
923
|
+
const market = this.market(symbol);
|
|
924
|
+
let request = {
|
|
925
|
+
'market': market['id'],
|
|
926
|
+
'interval': this.safeString(this.timeframes, timeframe, timeframe),
|
|
927
|
+
// "limit": 1440, // default 1440, max 1440
|
|
928
|
+
// "start": since,
|
|
929
|
+
// "end": this.milliseconds (),
|
|
930
|
+
};
|
|
931
|
+
if (since !== undefined) {
|
|
932
|
+
// https://github.com/ccxt/ccxt/issues/9227
|
|
933
|
+
const duration = this.parseTimeframe(timeframe);
|
|
934
|
+
request['start'] = since;
|
|
935
|
+
if (limit === undefined) {
|
|
936
|
+
limit = 1440;
|
|
937
|
+
}
|
|
938
|
+
request['end'] = this.sum(since, limit * duration * 1000);
|
|
939
|
+
}
|
|
940
|
+
[request, params] = this.handleUntilOption('end', request, params);
|
|
941
|
+
if (limit !== undefined) {
|
|
942
|
+
request['limit'] = limit; // default 1440, max 1440
|
|
943
|
+
}
|
|
944
|
+
return this.extend(request, params);
|
|
945
|
+
}
|
|
868
946
|
async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
869
947
|
/**
|
|
870
948
|
* @method
|
|
@@ -887,27 +965,8 @@ export default class bitvavo extends Exchange {
|
|
|
887
965
|
if (paginate) {
|
|
888
966
|
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 1440);
|
|
889
967
|
}
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
'interval': this.safeString(this.timeframes, timeframe, timeframe),
|
|
893
|
-
// "limit": 1440, // default 1440, max 1440
|
|
894
|
-
// "start": since,
|
|
895
|
-
// "end": this.milliseconds (),
|
|
896
|
-
};
|
|
897
|
-
if (since !== undefined) {
|
|
898
|
-
// https://github.com/ccxt/ccxt/issues/9227
|
|
899
|
-
const duration = this.parseTimeframe(timeframe);
|
|
900
|
-
request['start'] = since;
|
|
901
|
-
if (limit === undefined) {
|
|
902
|
-
limit = 1440;
|
|
903
|
-
}
|
|
904
|
-
request['end'] = this.sum(since, limit * duration * 1000);
|
|
905
|
-
}
|
|
906
|
-
[request, params] = this.handleUntilOption('end', request, params);
|
|
907
|
-
if (limit !== undefined) {
|
|
908
|
-
request['limit'] = limit; // default 1440, max 1440
|
|
909
|
-
}
|
|
910
|
-
const response = await this.publicGetMarketCandles(this.extend(request, params));
|
|
968
|
+
const request = this.fetchOHLCVRequest(symbol, timeframe, since, limit, params);
|
|
969
|
+
const response = await this.publicGetMarketCandles(request);
|
|
911
970
|
//
|
|
912
971
|
// [
|
|
913
972
|
// [1590383700000,"8088.5","8088.5","8088.5","8088.5","0.04788623"],
|
|
@@ -938,6 +997,7 @@ export default class bitvavo extends Exchange {
|
|
|
938
997
|
/**
|
|
939
998
|
* @method
|
|
940
999
|
* @name bitvavo#fetchBalance
|
|
1000
|
+
* @see https://docs.bitvavo.com/#tag/Account/paths/~1balance/get
|
|
941
1001
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
942
1002
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
943
1003
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
@@ -987,33 +1047,7 @@ export default class bitvavo extends Exchange {
|
|
|
987
1047
|
'info': response,
|
|
988
1048
|
};
|
|
989
1049
|
}
|
|
990
|
-
|
|
991
|
-
/**
|
|
992
|
-
* @method
|
|
993
|
-
* @name bitvavo#createOrder
|
|
994
|
-
* @description create a trade order
|
|
995
|
-
* @see https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1order/post
|
|
996
|
-
* @param {string} symbol unified symbol of the market to create an order in
|
|
997
|
-
* @param {string} type 'market' or 'limit'
|
|
998
|
-
* @param {string} side 'buy' or 'sell'
|
|
999
|
-
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
1000
|
-
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
1001
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1002
|
-
* @param {string} [params.timeInForce] "GTC", "IOC", or "PO"
|
|
1003
|
-
* @param {float} [params.stopPrice] The price at which a trigger order is triggered at
|
|
1004
|
-
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
|
1005
|
-
* @param {bool} [params.postOnly] If true, the order will only be posted to the order book and not executed immediately
|
|
1006
|
-
* @param {float} [params.stopLossPrice] The price at which a stop loss order is triggered at
|
|
1007
|
-
* @param {float} [params.takeProfitPrice] The price at which a take profit order is triggered at
|
|
1008
|
-
* @param {string} [params.triggerType] "price"
|
|
1009
|
-
* @param {string} [params.triggerReference] "lastTrade", "bestBid", "bestAsk", "midPrice" Only for stop orders: Use this to determine which parameter will trigger the order
|
|
1010
|
-
* @param {string} [params.selfTradePrevention] "decrementAndCancel", "cancelOldest", "cancelNewest", "cancelBoth"
|
|
1011
|
-
* @param {bool} [params.disableMarketProtection] don't cancel if the next fill price is 10% worse than the best fill price
|
|
1012
|
-
* @param {bool} [params.responseRequired] Set this to 'false' when only an acknowledgement of success or failure is required, this is faster.
|
|
1013
|
-
* @param {string} [params.clientOrderId] An ID supplied by the client that must be unique among all open orders for the same market
|
|
1014
|
-
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1015
|
-
*/
|
|
1016
|
-
await this.loadMarkets();
|
|
1050
|
+
createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
|
|
1017
1051
|
const market = this.market(symbol);
|
|
1018
1052
|
const request = {
|
|
1019
1053
|
'market': market['id'],
|
|
@@ -1077,7 +1111,37 @@ export default class bitvavo extends Exchange {
|
|
|
1077
1111
|
if (postOnly) {
|
|
1078
1112
|
request['postOnly'] = true;
|
|
1079
1113
|
}
|
|
1080
|
-
|
|
1114
|
+
return this.extend(request, params);
|
|
1115
|
+
}
|
|
1116
|
+
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
1117
|
+
/**
|
|
1118
|
+
* @method
|
|
1119
|
+
* @name bitvavo#createOrder
|
|
1120
|
+
* @description create a trade order
|
|
1121
|
+
* @see https://docs.bitvavo.com/#tag/Orders/paths/~1order/post
|
|
1122
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
1123
|
+
* @param {string} type 'market' or 'limit'
|
|
1124
|
+
* @param {string} side 'buy' or 'sell'
|
|
1125
|
+
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
1126
|
+
* @param {float} price the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
1127
|
+
* @param {object} [params] extra parameters specific to the bitvavo api endpoint
|
|
1128
|
+
* @param {string} [params.timeInForce] "GTC", "IOC", or "PO"
|
|
1129
|
+
* @param {float} [params.stopPrice] The price at which a trigger order is triggered at
|
|
1130
|
+
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
|
1131
|
+
* @param {bool} [params.postOnly] If true, the order will only be posted to the order book and not executed immediately
|
|
1132
|
+
* @param {float} [params.stopLossPrice] The price at which a stop loss order is triggered at
|
|
1133
|
+
* @param {float} [params.takeProfitPrice] The price at which a take profit order is triggered at
|
|
1134
|
+
* @param {string} [params.triggerType] "price"
|
|
1135
|
+
* @param {string} [params.triggerReference] "lastTrade", "bestBid", "bestAsk", "midPrice" Only for stop orders: Use this to determine which parameter will trigger the order
|
|
1136
|
+
* @param {string} [params.selfTradePrevention] "decrementAndCancel", "cancelOldest", "cancelNewest", "cancelBoth"
|
|
1137
|
+
* @param {bool} [params.disableMarketProtection] don't cancel if the next fill price is 10% worse than the best fill price
|
|
1138
|
+
* @param {bool} [params.responseRequired] Set this to 'false' when only an acknowledgement of success or failure is required, this is faster.
|
|
1139
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1140
|
+
*/
|
|
1141
|
+
await this.loadMarkets();
|
|
1142
|
+
const market = this.market(symbol);
|
|
1143
|
+
const request = this.createOrderRequest(symbol, type, side, amount, price, params);
|
|
1144
|
+
const response = await this.privatePostOrder(request);
|
|
1081
1145
|
//
|
|
1082
1146
|
// {
|
|
1083
1147
|
// "orderId":"dec6a640-5b4c-45bc-8d22-3b41c6716630",
|
|
@@ -1120,29 +1184,61 @@ export default class bitvavo extends Exchange {
|
|
|
1120
1184
|
//
|
|
1121
1185
|
return this.parseOrder(response, market);
|
|
1122
1186
|
}
|
|
1187
|
+
editOrderRequest(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
1188
|
+
let request = {};
|
|
1189
|
+
const market = this.market(symbol);
|
|
1190
|
+
const amountRemaining = this.safeNumber(params, 'amountRemaining');
|
|
1191
|
+
const triggerPrice = this.safeStringN(params, ['triggerPrice', 'stopPrice', 'triggerAmount']);
|
|
1192
|
+
params = this.omit(params, ['amountRemaining', 'triggerPrice', 'stopPrice', 'triggerAmount']);
|
|
1193
|
+
if (price !== undefined) {
|
|
1194
|
+
request['price'] = this.priceToPrecision(symbol, price);
|
|
1195
|
+
}
|
|
1196
|
+
if (amount !== undefined) {
|
|
1197
|
+
request['amount'] = this.amountToPrecision(symbol, amount);
|
|
1198
|
+
}
|
|
1199
|
+
if (amountRemaining !== undefined) {
|
|
1200
|
+
request['amountRemaining'] = this.amountToPrecision(symbol, amountRemaining);
|
|
1201
|
+
}
|
|
1202
|
+
if (triggerPrice !== undefined) {
|
|
1203
|
+
request['triggerAmount'] = this.priceToPrecision(symbol, triggerPrice);
|
|
1204
|
+
}
|
|
1205
|
+
request = this.extend(request, params);
|
|
1206
|
+
if (this.isEmpty(request)) {
|
|
1207
|
+
throw new ArgumentsRequired(this.id + ' editOrder() requires an amount argument, or a price argument, or non-empty params');
|
|
1208
|
+
}
|
|
1209
|
+
const clientOrderId = this.safeString(params, 'clientOrderId');
|
|
1210
|
+
if (clientOrderId === undefined) {
|
|
1211
|
+
request['orderId'] = id;
|
|
1212
|
+
}
|
|
1213
|
+
request['market'] = market['id'];
|
|
1214
|
+
return request;
|
|
1215
|
+
}
|
|
1123
1216
|
async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
1124
1217
|
/**
|
|
1125
1218
|
* @method
|
|
1126
1219
|
* @name bitvavo#editOrder
|
|
1127
1220
|
* @description edit a trade order
|
|
1128
|
-
* @see https://docs.bitvavo.com/#tag/
|
|
1221
|
+
* @see https://docs.bitvavo.com/#tag/Orders/paths/~1order/put
|
|
1222
|
+
* @param {string} id cancel order id
|
|
1129
1223
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
1130
1224
|
* @param {string} type 'market' or 'limit'
|
|
1131
1225
|
* @param {string} side 'buy' or 'sell'
|
|
1132
|
-
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
1133
|
-
* @param {float} [price] the price at which the order is to be fullfilled, in units of the
|
|
1134
|
-
* @param {object} [params] extra parameters specific to the
|
|
1135
|
-
* @param {string} [params.timeInForce] "GTC", "IOC", or "PO"
|
|
1136
|
-
* @param {bool} [params.postOnly] If true, the order will only be posted to the order book and not executed immediately
|
|
1137
|
-
* @param {float} [params.stopPrice] The price at which a trigger order is triggered at
|
|
1138
|
-
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
|
1139
|
-
* @param {string} [params.selfTradePrevention] "decrementAndCancel", "cancelOldest", "cancelNewest", "cancelBoth"
|
|
1140
|
-
* @param {bool} [params.responseRequired] Set this to 'false' when only an acknowledgement of success or failure is required, this is faster.
|
|
1141
|
-
* @param {string} [params.clientOrderId] An ID supplied by the client
|
|
1226
|
+
* @param {float} [amount] how much of currency you want to trade in units of base currency
|
|
1227
|
+
* @param {float} [price] the price at which the order is to be fullfilled, in units of the base currency, ignored in market orders
|
|
1228
|
+
* @param {object} [params] extra parameters specific to the bitvavo api endpoint
|
|
1142
1229
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1143
1230
|
*/
|
|
1144
1231
|
await this.loadMarkets();
|
|
1145
1232
|
const market = this.market(symbol);
|
|
1233
|
+
const request = this.editOrderRequest(id, symbol, type, side, amount, price, params);
|
|
1234
|
+
const response = await this.privatePutOrder(request);
|
|
1235
|
+
return this.parseOrder(response, market);
|
|
1236
|
+
}
|
|
1237
|
+
cancelOrderRequest(id, symbol = undefined, params = {}) {
|
|
1238
|
+
if (symbol === undefined) {
|
|
1239
|
+
throw new ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
|
|
1240
|
+
}
|
|
1241
|
+
const market = this.market(symbol);
|
|
1146
1242
|
const request = {
|
|
1147
1243
|
'market': market['id'],
|
|
1148
1244
|
};
|
|
@@ -1150,35 +1246,13 @@ export default class bitvavo extends Exchange {
|
|
|
1150
1246
|
if (clientOrderId === undefined) {
|
|
1151
1247
|
request['orderId'] = id;
|
|
1152
1248
|
}
|
|
1153
|
-
|
|
1154
|
-
const triggerPrice = this.safeStringN(params, ['triggerPrice', 'stopPrice', 'triggerAmount']);
|
|
1155
|
-
params = this.omit(params, ['amountRemaining', 'triggerPrice', 'stopPrice', 'triggerAmount']);
|
|
1156
|
-
let updateRequest = {};
|
|
1157
|
-
if (price !== undefined) {
|
|
1158
|
-
updateRequest['price'] = this.priceToPrecision(symbol, price);
|
|
1159
|
-
}
|
|
1160
|
-
if (amount !== undefined) {
|
|
1161
|
-
updateRequest['amount'] = this.amountToPrecision(symbol, amount);
|
|
1162
|
-
}
|
|
1163
|
-
if (amountRemaining !== undefined) {
|
|
1164
|
-
updateRequest['amountRemaining'] = this.amountToPrecision(symbol, amountRemaining);
|
|
1165
|
-
}
|
|
1166
|
-
if (triggerPrice !== undefined) {
|
|
1167
|
-
updateRequest['triggerAmount'] = this.priceToPrecision(symbol, triggerPrice);
|
|
1168
|
-
}
|
|
1169
|
-
updateRequest = this.extend(updateRequest, params);
|
|
1170
|
-
if (Object.keys(updateRequest).length) {
|
|
1171
|
-
const response = await this.privatePutOrder(this.extend(request, updateRequest));
|
|
1172
|
-
return this.parseOrder(response, market);
|
|
1173
|
-
}
|
|
1174
|
-
else {
|
|
1175
|
-
throw new ArgumentsRequired(this.id + ' editOrder() requires an amount argument, or a price argument, or non-empty params');
|
|
1176
|
-
}
|
|
1249
|
+
return this.extend(request, params);
|
|
1177
1250
|
}
|
|
1178
1251
|
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
1179
1252
|
/**
|
|
1180
1253
|
* @method
|
|
1181
1254
|
* @name bitvavo#cancelOrder
|
|
1255
|
+
* @see https://docs.bitvavo.com/#tag/Orders/paths/~1order/delete
|
|
1182
1256
|
* @description cancels an open order
|
|
1183
1257
|
* @see https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1order/delete
|
|
1184
1258
|
* @param {string} id order id
|
|
@@ -1186,19 +1260,10 @@ export default class bitvavo extends Exchange {
|
|
|
1186
1260
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1187
1261
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1188
1262
|
*/
|
|
1189
|
-
if (symbol === undefined) {
|
|
1190
|
-
throw new ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
|
|
1191
|
-
}
|
|
1192
1263
|
await this.loadMarkets();
|
|
1193
1264
|
const market = this.market(symbol);
|
|
1194
|
-
const request =
|
|
1195
|
-
|
|
1196
|
-
};
|
|
1197
|
-
const clientOrderId = this.safeString(params, 'clientOrderId');
|
|
1198
|
-
if (clientOrderId === undefined) {
|
|
1199
|
-
request['orderId'] = id;
|
|
1200
|
-
}
|
|
1201
|
-
const response = await this.privateDeleteOrder(this.extend(request, params));
|
|
1265
|
+
const request = this.cancelOrderRequest(id, symbol, params);
|
|
1266
|
+
const response = await this.privateDeleteOrder(request);
|
|
1202
1267
|
//
|
|
1203
1268
|
// {
|
|
1204
1269
|
// "orderId": "2e7ce7fc-44e2-4d80-a4a7-d079c4750b61"
|
|
@@ -1210,6 +1275,7 @@ export default class bitvavo extends Exchange {
|
|
|
1210
1275
|
/**
|
|
1211
1276
|
* @method
|
|
1212
1277
|
* @name bitvavo#cancelAllOrders
|
|
1278
|
+
* @see https://docs.bitvavo.com/#tag/Orders/paths/~1orders/delete
|
|
1213
1279
|
* @description cancel all open orders
|
|
1214
1280
|
* @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
|
|
1215
1281
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -1291,6 +1357,25 @@ export default class bitvavo extends Exchange {
|
|
|
1291
1357
|
//
|
|
1292
1358
|
return this.parseOrder(response, market);
|
|
1293
1359
|
}
|
|
1360
|
+
fetchOrdersRequest(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1361
|
+
const market = this.market(symbol);
|
|
1362
|
+
let request = {
|
|
1363
|
+
'market': market['id'],
|
|
1364
|
+
// "limit": 500,
|
|
1365
|
+
// "start": since,
|
|
1366
|
+
// "end": this.milliseconds (),
|
|
1367
|
+
// "orderIdFrom": "af76d6ce-9f7c-4006-b715-bb5d430652d0",
|
|
1368
|
+
// "orderIdTo": "af76d6ce-9f7c-4006-b715-bb5d430652d0",
|
|
1369
|
+
};
|
|
1370
|
+
if (since !== undefined) {
|
|
1371
|
+
request['start'] = since;
|
|
1372
|
+
}
|
|
1373
|
+
if (limit !== undefined) {
|
|
1374
|
+
request['limit'] = limit; // default 500, max 1000
|
|
1375
|
+
}
|
|
1376
|
+
[request, params] = this.handleUntilOption('end', request, params);
|
|
1377
|
+
return this.extend(request, params);
|
|
1378
|
+
}
|
|
1294
1379
|
async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1295
1380
|
/**
|
|
1296
1381
|
* @method
|
|
@@ -1315,22 +1400,8 @@ export default class bitvavo extends Exchange {
|
|
|
1315
1400
|
return await this.fetchPaginatedCallDynamic('fetchOrders', symbol, since, limit, params);
|
|
1316
1401
|
}
|
|
1317
1402
|
const market = this.market(symbol);
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
// "limit": 500,
|
|
1321
|
-
// "start": since,
|
|
1322
|
-
// "end": this.milliseconds (),
|
|
1323
|
-
// "orderIdFrom": "af76d6ce-9f7c-4006-b715-bb5d430652d0",
|
|
1324
|
-
// "orderIdTo": "af76d6ce-9f7c-4006-b715-bb5d430652d0",
|
|
1325
|
-
};
|
|
1326
|
-
if (since !== undefined) {
|
|
1327
|
-
request['start'] = since;
|
|
1328
|
-
}
|
|
1329
|
-
if (limit !== undefined) {
|
|
1330
|
-
request['limit'] = limit; // default 500, max 1000
|
|
1331
|
-
}
|
|
1332
|
-
[request, params] = this.handleUntilOption('end', request, params);
|
|
1333
|
-
const response = await this.privateGetOrders(this.extend(request, params));
|
|
1403
|
+
const request = this.fetchOrdersRequest(symbol, since, limit, params);
|
|
1404
|
+
const response = await this.privateGetOrders(request);
|
|
1334
1405
|
//
|
|
1335
1406
|
// [
|
|
1336
1407
|
// {
|
|
@@ -1550,6 +1621,25 @@ export default class bitvavo extends Exchange {
|
|
|
1550
1621
|
'trades': rawTrades,
|
|
1551
1622
|
}, market);
|
|
1552
1623
|
}
|
|
1624
|
+
fetchMyTradesRequest(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1625
|
+
const market = this.market(symbol);
|
|
1626
|
+
let request = {
|
|
1627
|
+
'market': market['id'],
|
|
1628
|
+
// "limit": 500,
|
|
1629
|
+
// "start": since,
|
|
1630
|
+
// "end": this.milliseconds (),
|
|
1631
|
+
// "tradeIdFrom": "af76d6ce-9f7c-4006-b715-bb5d430652d0",
|
|
1632
|
+
// "tradeIdTo": "af76d6ce-9f7c-4006-b715-bb5d430652d0",
|
|
1633
|
+
};
|
|
1634
|
+
if (since !== undefined) {
|
|
1635
|
+
request['start'] = since;
|
|
1636
|
+
}
|
|
1637
|
+
if (limit !== undefined) {
|
|
1638
|
+
request['limit'] = limit; // default 500, max 1000
|
|
1639
|
+
}
|
|
1640
|
+
[request, params] = this.handleUntilOption('end', request, params);
|
|
1641
|
+
return this.extend(request, params);
|
|
1642
|
+
}
|
|
1553
1643
|
async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1554
1644
|
/**
|
|
1555
1645
|
* @method
|
|
@@ -1574,22 +1664,8 @@ export default class bitvavo extends Exchange {
|
|
|
1574
1664
|
return await this.fetchPaginatedCallDynamic('fetchMyTrades', symbol, since, limit, params);
|
|
1575
1665
|
}
|
|
1576
1666
|
const market = this.market(symbol);
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
// "limit": 500,
|
|
1580
|
-
// "start": since,
|
|
1581
|
-
// "end": this.milliseconds (),
|
|
1582
|
-
// "tradeIdFrom": "af76d6ce-9f7c-4006-b715-bb5d430652d0",
|
|
1583
|
-
// "tradeIdTo": "af76d6ce-9f7c-4006-b715-bb5d430652d0",
|
|
1584
|
-
};
|
|
1585
|
-
if (since !== undefined) {
|
|
1586
|
-
request['start'] = since;
|
|
1587
|
-
}
|
|
1588
|
-
if (limit !== undefined) {
|
|
1589
|
-
request['limit'] = limit; // default 500, max 1000
|
|
1590
|
-
}
|
|
1591
|
-
[request, params] = this.handleUntilOption('end', request, params);
|
|
1592
|
-
const response = await this.privateGetTrades(this.extend(request, params));
|
|
1667
|
+
const request = this.fetchMyTradesRequest(symbol, since, limit, params);
|
|
1668
|
+
const response = await this.privateGetTrades(request);
|
|
1593
1669
|
//
|
|
1594
1670
|
// [
|
|
1595
1671
|
// {
|
|
@@ -1609,6 +1685,20 @@ export default class bitvavo extends Exchange {
|
|
|
1609
1685
|
//
|
|
1610
1686
|
return this.parseTrades(response, market, since, limit);
|
|
1611
1687
|
}
|
|
1688
|
+
withdrawRequest(code, amount, address, tag = undefined, params = {}) {
|
|
1689
|
+
const currency = this.currency(code);
|
|
1690
|
+
const request = {
|
|
1691
|
+
'symbol': currency['id'],
|
|
1692
|
+
'amount': this.currencyToPrecision(code, amount),
|
|
1693
|
+
'address': address, // address or IBAN
|
|
1694
|
+
// 'internal': false, // transfer to another Bitvavo user address, no fees
|
|
1695
|
+
// 'addWithdrawalFee': false, // true = add the fee on top, otherwise the fee is subtracted from the amount
|
|
1696
|
+
};
|
|
1697
|
+
if (tag !== undefined) {
|
|
1698
|
+
request['paymentId'] = tag;
|
|
1699
|
+
}
|
|
1700
|
+
return this.extend(request, params);
|
|
1701
|
+
}
|
|
1612
1702
|
async withdraw(code, amount, address, tag = undefined, params = {}) {
|
|
1613
1703
|
/**
|
|
1614
1704
|
* @method
|
|
@@ -1625,17 +1715,8 @@ export default class bitvavo extends Exchange {
|
|
|
1625
1715
|
this.checkAddress(address);
|
|
1626
1716
|
await this.loadMarkets();
|
|
1627
1717
|
const currency = this.currency(code);
|
|
1628
|
-
const request =
|
|
1629
|
-
|
|
1630
|
-
'amount': this.currencyToPrecision(code, amount),
|
|
1631
|
-
'address': address, // address or IBAN
|
|
1632
|
-
// "internal": false, // transfer to another Bitvavo user address, no fees
|
|
1633
|
-
// "addWithdrawalFee": false, // true = add the fee on top, otherwise the fee is subtracted from the amount
|
|
1634
|
-
};
|
|
1635
|
-
if (tag !== undefined) {
|
|
1636
|
-
request['paymentId'] = tag;
|
|
1637
|
-
}
|
|
1638
|
-
const response = await this.privatePostWithdrawal(this.extend(request, params));
|
|
1718
|
+
const request = this.withdrawRequest(code, amount, address, tag, params);
|
|
1719
|
+
const response = await this.privatePostWithdrawal(request);
|
|
1639
1720
|
//
|
|
1640
1721
|
// {
|
|
1641
1722
|
// "success": true,
|
|
@@ -1645,18 +1726,7 @@ export default class bitvavo extends Exchange {
|
|
|
1645
1726
|
//
|
|
1646
1727
|
return this.parseTransaction(response, currency);
|
|
1647
1728
|
}
|
|
1648
|
-
|
|
1649
|
-
/**
|
|
1650
|
-
* @method
|
|
1651
|
-
* @name bitvavo#fetchWithdrawals
|
|
1652
|
-
* @description fetch all withdrawals made from an account
|
|
1653
|
-
* @param {string} code unified currency code
|
|
1654
|
-
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
1655
|
-
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
1656
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1657
|
-
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
1658
|
-
*/
|
|
1659
|
-
await this.loadMarkets();
|
|
1729
|
+
fetchWithdrawalsRequest(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1660
1730
|
const request = {
|
|
1661
1731
|
// 'symbol': currency['id'],
|
|
1662
1732
|
// 'limit': 500, // default 500, max 1000
|
|
@@ -1674,7 +1744,27 @@ export default class bitvavo extends Exchange {
|
|
|
1674
1744
|
if (limit !== undefined) {
|
|
1675
1745
|
request['limit'] = limit; // default 500, max 1000
|
|
1676
1746
|
}
|
|
1677
|
-
|
|
1747
|
+
return this.extend(request, params);
|
|
1748
|
+
}
|
|
1749
|
+
async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1750
|
+
/**
|
|
1751
|
+
* @method
|
|
1752
|
+
* @name bitvavo#fetchWithdrawals
|
|
1753
|
+
* @see https://docs.bitvavo.com/#tag/Account/paths/~1withdrawalHistory/get
|
|
1754
|
+
* @description fetch all withdrawals made from an account
|
|
1755
|
+
* @param {string} code unified currency code
|
|
1756
|
+
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
1757
|
+
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
1758
|
+
* @param {object} [params] extra parameters specific to the bitvavo api endpoint
|
|
1759
|
+
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
1760
|
+
*/
|
|
1761
|
+
await this.loadMarkets();
|
|
1762
|
+
const request = this.fetchWithdrawalsRequest(code, since, limit, params);
|
|
1763
|
+
let currency = undefined;
|
|
1764
|
+
if (code !== undefined) {
|
|
1765
|
+
currency = this.currency(code);
|
|
1766
|
+
}
|
|
1767
|
+
const response = await this.privateGetWithdrawalHistory(request);
|
|
1678
1768
|
//
|
|
1679
1769
|
// [
|
|
1680
1770
|
// {
|
|
@@ -1691,18 +1781,7 @@ export default class bitvavo extends Exchange {
|
|
|
1691
1781
|
//
|
|
1692
1782
|
return this.parseTransactions(response, currency, since, limit, { 'type': 'withdrawal' });
|
|
1693
1783
|
}
|
|
1694
|
-
|
|
1695
|
-
/**
|
|
1696
|
-
* @method
|
|
1697
|
-
* @name bitvavo#fetchDeposits
|
|
1698
|
-
* @description fetch all deposits made to an account
|
|
1699
|
-
* @param {string} code unified currency code
|
|
1700
|
-
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
1701
|
-
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
1702
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1703
|
-
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
1704
|
-
*/
|
|
1705
|
-
await this.loadMarkets();
|
|
1784
|
+
fetchDepositsRequest(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1706
1785
|
const request = {
|
|
1707
1786
|
// 'symbol': currency['id'],
|
|
1708
1787
|
// 'limit': 500, // default 500, max 1000
|
|
@@ -1720,7 +1799,27 @@ export default class bitvavo extends Exchange {
|
|
|
1720
1799
|
if (limit !== undefined) {
|
|
1721
1800
|
request['limit'] = limit; // default 500, max 1000
|
|
1722
1801
|
}
|
|
1723
|
-
|
|
1802
|
+
return this.extend(request, params);
|
|
1803
|
+
}
|
|
1804
|
+
async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1805
|
+
/**
|
|
1806
|
+
* @method
|
|
1807
|
+
* @name bitvavo#fetchDeposits
|
|
1808
|
+
* @see https://docs.bitvavo.com/#tag/Account/paths/~1depositHistory/get
|
|
1809
|
+
* @description fetch all deposits made to an account
|
|
1810
|
+
* @param {string} code unified currency code
|
|
1811
|
+
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
1812
|
+
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
1813
|
+
* @param {object} [params] extra parameters specific to the bitvavo api endpoint
|
|
1814
|
+
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
1815
|
+
*/
|
|
1816
|
+
await this.loadMarkets();
|
|
1817
|
+
const request = this.fetchDepositsRequest(code, since, limit, params);
|
|
1818
|
+
let currency = undefined;
|
|
1819
|
+
if (code !== undefined) {
|
|
1820
|
+
currency = this.currency(code);
|
|
1821
|
+
}
|
|
1822
|
+
const response = await this.privateGetDepositHistory(request);
|
|
1724
1823
|
//
|
|
1725
1824
|
// [
|
|
1726
1825
|
// {
|
package/js/src/blockchaincom.js
CHANGED
|
@@ -817,8 +817,10 @@ export default class blockchaincom extends Exchange {
|
|
|
817
817
|
let tag = undefined;
|
|
818
818
|
let address = undefined;
|
|
819
819
|
if (rawAddress !== undefined) {
|
|
820
|
+
const addressParts = rawAddress.split(';');
|
|
820
821
|
// if a tag or memo is used it is separated by a colon in the 'address' value
|
|
821
|
-
|
|
822
|
+
tag = this.safeString(addressParts, 0);
|
|
823
|
+
address = this.safeString(addressParts, 1);
|
|
822
824
|
}
|
|
823
825
|
const result = { 'info': response };
|
|
824
826
|
result['currency'] = currency['code'];
|