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.
Files changed (82) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.js +1405 -274
  3. package/dist/ccxt.browser.min.js +6 -6
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/src/base/Exchange.js +37 -4
  6. package/dist/cjs/src/base/ws/WsClient.js +3 -1
  7. package/dist/cjs/src/bigone.js +1 -0
  8. package/dist/cjs/src/binance.js +14 -3
  9. package/dist/cjs/src/bitget.js +12 -2
  10. package/dist/cjs/src/bitrue.js +1 -0
  11. package/dist/cjs/src/bitvavo.js +271 -172
  12. package/dist/cjs/src/blockchaincom.js +3 -1
  13. package/dist/cjs/src/bybit.js +57 -9
  14. package/dist/cjs/src/coinbasepro.js +1 -0
  15. package/dist/cjs/src/coinex.js +37 -12
  16. package/dist/cjs/src/deribit.js +164 -0
  17. package/dist/cjs/src/gate.js +32 -1
  18. package/dist/cjs/src/novadax.js +26 -22
  19. package/dist/cjs/src/okcoin.js +3 -0
  20. package/dist/cjs/src/phemex.js +7 -3
  21. package/dist/cjs/src/poloniex.js +1 -0
  22. package/dist/cjs/src/pro/bequant.js +6 -1
  23. package/dist/cjs/src/pro/binance.js +7 -4
  24. package/dist/cjs/src/pro/binancecoinm.js +6 -1
  25. package/dist/cjs/src/pro/binanceus.js +6 -1
  26. package/dist/cjs/src/pro/bitcoincom.js +6 -1
  27. package/dist/cjs/src/pro/bitget.js +1 -1
  28. package/dist/cjs/src/pro/bitopro.js +7 -3
  29. package/dist/cjs/src/pro/bitrue.js +6 -1
  30. package/dist/cjs/src/pro/bitvavo.js +668 -22
  31. package/dist/cjs/src/pro/lbank.js +1 -1
  32. package/dist/cjs/src/pro/okx.js +13 -3
  33. package/dist/cjs/src/woo.js +1 -1
  34. package/js/ccxt.d.ts +1 -1
  35. package/js/ccxt.js +1 -1
  36. package/js/src/abstract/binance.d.ts +3 -0
  37. package/js/src/abstract/binancecoinm.d.ts +3 -0
  38. package/js/src/abstract/binanceus.d.ts +4 -0
  39. package/js/src/abstract/binanceusdm.d.ts +3 -0
  40. package/js/src/abstract/gate.d.ts +1 -0
  41. package/js/src/abstract/gateio.d.ts +1 -0
  42. package/js/src/abstract/novadax.d.ts +5 -1
  43. package/js/src/abstract/phemex.d.ts +1 -0
  44. package/js/src/base/Exchange.d.ts +12 -1
  45. package/js/src/base/Exchange.js +37 -4
  46. package/js/src/base/ws/WsClient.js +3 -2
  47. package/js/src/bigone.js +1 -0
  48. package/js/src/binance.js +14 -3
  49. package/js/src/bitget.js +12 -2
  50. package/js/src/bitrue.js +1 -0
  51. package/js/src/bitvavo.d.ts +14 -2
  52. package/js/src/bitvavo.js +271 -172
  53. package/js/src/blockchaincom.js +3 -1
  54. package/js/src/bybit.d.ts +2 -1
  55. package/js/src/bybit.js +57 -9
  56. package/js/src/coinbasepro.js +1 -0
  57. package/js/src/coinex.d.ts +1 -0
  58. package/js/src/coinex.js +37 -12
  59. package/js/src/deribit.d.ts +6 -1
  60. package/js/src/deribit.js +164 -0
  61. package/js/src/gate.d.ts +1 -0
  62. package/js/src/gate.js +32 -1
  63. package/js/src/novadax.js +26 -22
  64. package/js/src/okcoin.js +3 -0
  65. package/js/src/phemex.js +7 -3
  66. package/js/src/poloniex.js +1 -0
  67. package/js/src/pro/bequant.js +6 -1
  68. package/js/src/pro/binance.js +7 -4
  69. package/js/src/pro/binancecoinm.js +6 -1
  70. package/js/src/pro/binanceus.js +6 -1
  71. package/js/src/pro/bitcoincom.js +6 -1
  72. package/js/src/pro/bitget.js +1 -1
  73. package/js/src/pro/bitopro.js +7 -3
  74. package/js/src/pro/bitrue.js +6 -1
  75. package/js/src/pro/bitvavo.d.ts +35 -2
  76. package/js/src/pro/bitvavo.js +669 -23
  77. package/js/src/pro/lbank.js +1 -1
  78. package/js/src/pro/okx.js +13 -3
  79. package/js/src/woo.js +1 -1
  80. package/jsdoc2md.js +38 -16
  81. package/package.json +4 -1
  82. package/skip-tests.json +4 -0
@@ -685,7 +685,7 @@ export default class lbank extends lbankRest {
685
685
  };
686
686
  const request = this.deepExtend(subscribe, params);
687
687
  const orderbook = await this.watch(url, messageHash, request, messageHash);
688
- return orderbook.limit(limit);
688
+ return orderbook.limit();
689
689
  }
690
690
  async watchOrderBook(symbol, limit = undefined, params = {}) {
691
691
  /**
package/js/src/pro/okx.js CHANGED
@@ -1014,17 +1014,20 @@ export default class okx extends okxRest {
1014
1014
  /**
1015
1015
  * @method
1016
1016
  * @name okx#watchOrders
1017
- * @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-ws-order-channel
1018
1017
  * @description watches information on multiple orders made by the user
1019
- * @param {string} [symbol] unified market symbol of the market orders were made in
1018
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-ws-order-channel
1019
+ * @param {string} [symbol] unified market symbol of the market the orders were made in
1020
1020
  * @param {int} [since] the earliest time in ms to fetch orders for
1021
1021
  * @param {int} [limit] the maximum number of order structures to retrieve
1022
1022
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1023
1023
  * @param {bool} [params.stop] true if fetching trigger or conditional orders
1024
+ * @param {string} [params.type] 'spot', 'swap', 'future', 'option', 'ANY', 'SPOT', 'MARGIN', 'SWAP', 'FUTURES' or 'OPTION'
1025
+ * @param {string} [params.marginMode] 'cross' or 'isolated', for automatically setting the type to spot margin
1024
1026
  * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1025
1027
  */
1026
1028
  let type = undefined;
1027
1029
  // By default, receive order updates from any instrument type
1030
+ [type, params] = this.handleOptionAndParams(params, 'watchOrders', 'defaultType');
1028
1031
  [type, params] = this.handleOptionAndParams(params, 'watchOrders', 'type', 'ANY');
1029
1032
  const isStop = this.safeValue2(params, 'stop', 'trigger', false);
1030
1033
  params = this.omit(params, ['stop', 'trigger']);
@@ -1039,7 +1042,14 @@ export default class okx extends okxRest {
1039
1042
  if (type === 'future') {
1040
1043
  type = 'futures';
1041
1044
  }
1042
- const uppercaseType = type.toUpperCase();
1045
+ let uppercaseType = type.toUpperCase();
1046
+ let marginMode = undefined;
1047
+ [marginMode, params] = this.handleMarginModeAndParams('watchOrders', params);
1048
+ if (uppercaseType === 'SPOT') {
1049
+ if (marginMode !== undefined) {
1050
+ uppercaseType = 'MARGIN';
1051
+ }
1052
+ }
1043
1053
  const request = {
1044
1054
  'instType': uppercaseType,
1045
1055
  };
package/js/src/woo.js CHANGED
@@ -61,7 +61,7 @@ export default class woo extends Exchange {
61
61
  'fetchClosedOrder': false,
62
62
  'fetchClosedOrders': false,
63
63
  'fetchCurrencies': true,
64
- 'fetchDepositAddress': false,
64
+ 'fetchDepositAddress': true,
65
65
  'fetchDeposits': true,
66
66
  'fetchDepositsWithdrawals': true,
67
67
  'fetchFundingHistory': true,
package/jsdoc2md.js CHANGED
@@ -29,9 +29,12 @@ const findByExtensionSync = (dir, ext) => {
29
29
  // Get all files to read js docs
30
30
  const inputFiles = findByExtensionSync('js/src', 'js')
31
31
  const proInputFiles = findByExtensionSync('js/src/pro', 'js');
32
- const partials = './wiki/partials/'
33
- const partial = fs.readdirSync (partials).map (file => partials + file)
34
- const outputFile = './wiki/spec.md'
32
+ const basePartials = './wiki/basePartials/'
33
+ const basePartial = fs.readdirSync (basePartials).map (file => basePartials + file)
34
+ const exchangePartials = './wiki/exchangePartials/'
35
+ const exchangePartial = fs.readdirSync (exchangePartials).map (file => exchangePartials + file)
36
+ const outputFolder = './wiki/'
37
+ const outputFile = './wiki/baseSpec.md'
35
38
  const helper = './wiki/helpers.cjs'
36
39
 
37
40
  console.log ('πŸ“° loading js docs...')
@@ -54,6 +57,7 @@ proTemplateData.forEach((proData) => {
54
57
  console.log ('πŸ“° rendering docs for each exchange...')
55
58
  const template = fs.readFileSync ('./wiki/spec.hbs', 'utf8')
56
59
 
60
+ const outputByExchange = await Promise.all (templateData.map (data => jsdoc2md.render ({ template, data, partial: exchangePartial, helper })))
57
61
  // Group docs by method
58
62
  const groupedByMethod = templateData.reduce((acc, arr) => {
59
63
  arr.filter(obj => obj.kind === 'function' && !obj.ignore).forEach(obj => {
@@ -79,21 +83,39 @@ const groupedByMethod = templateData.reduce((acc, arr) => {
79
83
 
80
84
  const templateDataGroupedByMethod = Object.values(groupedByMethod).sort((a, b) =>a[0].name < b[0].name ? -1 : 1)
81
85
 
82
- const outputs = await Promise.all (templateDataGroupedByMethod.map (data => jsdoc2md.render ({ template, data, partial, helper})))
86
+
87
+ const baseOutput = await Promise.all (templateDataGroupedByMethod.map (data => jsdoc2md.render ({ template, data, partial: basePartial, helper})))
83
88
 
84
89
  console.log ('πŸ“° creating index of exchange functions')
85
- const functions = Object.keys(groupedByMethod).sort ()
86
- const alphabet = Array.from ( Array (26)).map((e, i) => String.fromCharCode(i + 97));
87
-
88
- const index = {}
89
- let i = -1
90
- for (const char of alphabet) {
91
- do {
92
- index[char] = functions[++i]
93
- } while (char > functions[i])
94
- }
95
-
96
- fs.writeFileSync (outputFile, outputs.join ('\n---\n'))
90
+ const exchangeLinks = []
91
+ outputByExchange.forEach ((output, i) => {
92
+ const name = templateData[i][0].id
93
+ const fileName = 'exchanges/' + name + '.md'
94
+ fs.writeFileSync (outputFolder + fileName, output)
95
+ exchangeLinks.push (`\t- [${name}](${fileName})`)
96
+ })
97
+
98
+
99
+ fs.writeFileSync (outputFile, baseOutput.join ('\n---\n'))
100
+
101
+ const sidebar =
102
+ `
103
+ - [Install](Install.md)
104
+ - [Examples](Examples.md)
105
+ - [Manual](Manual.md)
106
+ - [CCXT Pro](ccxt.pro.manual.md)
107
+ - [Contributing](CONTRIBUTING.md)
108
+ - [Supported Exchanges](Exchange-Markets.md)
109
+ - [Exchanges By Country](Exchange-Markets-By-Country.md)
110
+ - [API Spec By Method](baseSpec.md)
111
+ - API Spec by Exchange
112
+ ${exchangeLinks.join('\n')}
113
+ - [Changelog](CHANGELOG.md)
114
+ - [Awesome](Awesome.md)
115
+ `
116
+ fs.writeFileSync('./wiki/_sidebar.md', sidebar);
117
+
97
118
  console.log ('πŸ“° finished rendering docs! πŸ™Œ πŸ˜Άβ€πŸŒ«')
98
119
 
99
120
  })()
121
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.2.20",
3
+ "version": "4.2.22",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.js",
6
6
  "type": "module",
@@ -22,6 +22,9 @@
22
22
  },
23
23
  "readme": "README.md",
24
24
  "scripts": {
25
+ "instrument": "nyc instrument js/ jsInstrumented/",
26
+ "nyc-coverage": "nyc --reporter=html --reporter=lcov --exclude='js/src/pro/**' --exclude='js/src/base/**' --exclude='js/src/test/**' --exclude='js/src/abstract/**' --exclude='js/src/static_dependencies' node jsInstrumented/src/test/test.js --requestTests --responseTests",
27
+ "coverage-js": "npm run instrument && npm run nyc-coverage && rm -rf jsInstrumented",
25
28
  "docker": "docker-compose run --rm ccxt",
26
29
  "fixTSBug": "node build/fixTSBug",
27
30
  "build-docs": "node jsdoc2md.js && node examples2md.js",
package/skip-tests.json CHANGED
@@ -1433,6 +1433,10 @@
1433
1433
  },
1434
1434
  "watchOrderBook": {
1435
1435
  "nonce": "missing https://app.travis-ci.com/github/ccxt/ccxt/builds/267900037#L6909"
1436
+ },
1437
+ "watchTickers": {
1438
+ "quoteVolume": "same",
1439
+ "baseVolume": "same"
1436
1440
  }
1437
1441
  }
1438
1442
  },