ccxt 4.2.21 β†’ 4.2.23

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 (63) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.js +574 -81
  3. package/dist/ccxt.browser.min.js +3 -3
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/src/bigone.js +1 -0
  6. package/dist/cjs/src/binance.js +14 -3
  7. package/dist/cjs/src/bitfinex2.js +89 -0
  8. package/dist/cjs/src/bitget.js +11 -1
  9. package/dist/cjs/src/bitrue.js +1 -0
  10. package/dist/cjs/src/bybit.js +57 -9
  11. package/dist/cjs/src/coinbasepro.js +1 -0
  12. package/dist/cjs/src/coinex.js +60 -14
  13. package/dist/cjs/src/deribit.js +164 -0
  14. package/dist/cjs/src/okcoin.js +3 -0
  15. package/dist/cjs/src/okx.js +81 -31
  16. package/dist/cjs/src/phemex.js +17 -5
  17. package/dist/cjs/src/poloniex.js +1 -0
  18. package/dist/cjs/src/pro/bequant.js +6 -1
  19. package/dist/cjs/src/pro/binance.js +8 -5
  20. package/dist/cjs/src/pro/binancecoinm.js +6 -1
  21. package/dist/cjs/src/pro/binanceus.js +6 -1
  22. package/dist/cjs/src/pro/bitcoincom.js +6 -1
  23. package/dist/cjs/src/pro/bitget.js +1 -1
  24. package/dist/cjs/src/pro/bitrue.js +6 -1
  25. package/dist/cjs/src/pro/hitbtc.js +6 -0
  26. package/dist/cjs/src/pro/okx.js +23 -5
  27. package/dist/cjs/src/woo.js +1 -1
  28. package/js/ccxt.d.ts +1 -1
  29. package/js/ccxt.js +1 -1
  30. package/js/src/abstract/binance.d.ts +3 -0
  31. package/js/src/abstract/binancecoinm.d.ts +3 -0
  32. package/js/src/abstract/binanceus.d.ts +4 -0
  33. package/js/src/abstract/binanceusdm.d.ts +3 -0
  34. package/js/src/bigone.js +1 -0
  35. package/js/src/binance.js +14 -3
  36. package/js/src/bitfinex2.d.ts +2 -0
  37. package/js/src/bitfinex2.js +89 -0
  38. package/js/src/bitget.js +11 -1
  39. package/js/src/bitrue.js +1 -0
  40. package/js/src/bybit.d.ts +2 -1
  41. package/js/src/bybit.js +57 -9
  42. package/js/src/coinbasepro.js +1 -0
  43. package/js/src/coinex.d.ts +1 -0
  44. package/js/src/coinex.js +60 -14
  45. package/js/src/deribit.d.ts +6 -1
  46. package/js/src/deribit.js +164 -0
  47. package/js/src/okcoin.js +3 -0
  48. package/js/src/okx.js +81 -31
  49. package/js/src/phemex.js +17 -5
  50. package/js/src/poloniex.js +1 -0
  51. package/js/src/pro/bequant.js +6 -1
  52. package/js/src/pro/binance.js +8 -5
  53. package/js/src/pro/binancecoinm.js +6 -1
  54. package/js/src/pro/binanceus.js +6 -1
  55. package/js/src/pro/bitcoincom.js +6 -1
  56. package/js/src/pro/bitget.js +1 -1
  57. package/js/src/pro/bitrue.js +6 -1
  58. package/js/src/pro/hitbtc.js +6 -0
  59. package/js/src/pro/okx.js +23 -5
  60. package/js/src/woo.js +1 -1
  61. package/jsdoc2md.js +38 -16
  62. package/package.json +4 -1
  63. package/skip-tests.json +4 -0
package/js/src/pro/okx.js CHANGED
@@ -853,13 +853,15 @@ export default class okx extends okxRest {
853
853
  /**
854
854
  * @method
855
855
  * @name okx#watchMyTrades
856
- * @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-ws-order-channel
857
856
  * @description watches information on multiple trades made by the user
857
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-ws-order-channel
858
858
  * @param {string} [symbol] unified market symbol of the market trades were made in
859
859
  * @param {int} [since] the earliest time in ms to fetch trades for
860
860
  * @param {int} [limit] the maximum number of trade structures to retrieve
861
861
  * @param {object} [params] extra parameters specific to the exchange API endpoint
862
862
  * @param {bool} [params.stop] true if fetching trigger or conditional trades
863
+ * @param {string} [params.type] 'spot', 'swap', 'future', 'option', 'ANY', 'SPOT', 'MARGIN', 'SWAP', 'FUTURES' or 'OPTION'
864
+ * @param {string} [params.marginMode] 'cross' or 'isolated', for automatically setting the type to spot margin
863
865
  * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure
864
866
  */
865
867
  // By default, receive order updates from any instrument type
@@ -881,7 +883,14 @@ export default class okx extends okxRest {
881
883
  if (type === 'future') {
882
884
  type = 'futures';
883
885
  }
884
- const uppercaseType = type.toUpperCase();
886
+ let uppercaseType = type.toUpperCase();
887
+ let marginMode = undefined;
888
+ [marginMode, params] = this.handleMarginModeAndParams('watchMyTrades', params);
889
+ if (uppercaseType === 'SPOT') {
890
+ if (marginMode !== undefined) {
891
+ uppercaseType = 'MARGIN';
892
+ }
893
+ }
885
894
  const request = {
886
895
  'instType': uppercaseType,
887
896
  };
@@ -1014,13 +1023,15 @@ export default class okx extends okxRest {
1014
1023
  /**
1015
1024
  * @method
1016
1025
  * @name okx#watchOrders
1017
- * @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-ws-order-channel
1018
1026
  * @description watches information on multiple orders made by the user
1019
- * @param {string} [symbol] unified market symbol of the market orders were made in
1027
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-ws-order-channel
1028
+ * @param {string} [symbol] unified market symbol of the market the orders were made in
1020
1029
  * @param {int} [since] the earliest time in ms to fetch orders for
1021
1030
  * @param {int} [limit] the maximum number of order structures to retrieve
1022
1031
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1023
1032
  * @param {bool} [params.stop] true if fetching trigger or conditional orders
1033
+ * @param {string} [params.type] 'spot', 'swap', 'future', 'option', 'ANY', 'SPOT', 'MARGIN', 'SWAP', 'FUTURES' or 'OPTION'
1034
+ * @param {string} [params.marginMode] 'cross' or 'isolated', for automatically setting the type to spot margin
1024
1035
  * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1025
1036
  */
1026
1037
  let type = undefined;
@@ -1039,7 +1050,14 @@ export default class okx extends okxRest {
1039
1050
  if (type === 'future') {
1040
1051
  type = 'futures';
1041
1052
  }
1042
- const uppercaseType = type.toUpperCase();
1053
+ let uppercaseType = type.toUpperCase();
1054
+ let marginMode = undefined;
1055
+ [marginMode, params] = this.handleMarginModeAndParams('watchOrders', params);
1056
+ if (uppercaseType === 'SPOT') {
1057
+ if (marginMode !== undefined) {
1058
+ uppercaseType = 'MARGIN';
1059
+ }
1060
+ }
1043
1061
  const request = {
1044
1062
  'instType': uppercaseType,
1045
1063
  };
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.21",
3
+ "version": "4.2.23",
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
  },