ccxt 4.4.34 → 4.4.36

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 (78) hide show
  1. package/README.md +6 -5
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +6 -1
  4. package/dist/cjs/src/abstract/defx.js +9 -0
  5. package/dist/cjs/src/bingx.js +339 -144
  6. package/dist/cjs/src/bitfinex2.js +20 -12
  7. package/dist/cjs/src/bitmex.js +104 -2
  8. package/dist/cjs/src/bitopro.js +22 -4
  9. package/dist/cjs/src/bitrue.js +2 -2
  10. package/dist/cjs/src/bitso.js +2 -1
  11. package/dist/cjs/src/btcmarkets.js +3 -3
  12. package/dist/cjs/src/btcturk.js +19 -19
  13. package/dist/cjs/src/bybit.js +20 -0
  14. package/dist/cjs/src/defx.js +2048 -0
  15. package/dist/cjs/src/deribit.js +34 -14
  16. package/dist/cjs/src/gate.js +158 -41
  17. package/dist/cjs/src/hashkey.js +1 -1
  18. package/dist/cjs/src/htx.js +14 -2
  19. package/dist/cjs/src/hyperliquid.js +73 -11
  20. package/dist/cjs/src/idex.js +3 -3
  21. package/dist/cjs/src/kraken.js +110 -102
  22. package/dist/cjs/src/kucoin.js +1 -1
  23. package/dist/cjs/src/okx.js +1 -0
  24. package/dist/cjs/src/onetrading.js +20 -395
  25. package/dist/cjs/src/pro/bitrue.js +13 -11
  26. package/dist/cjs/src/pro/defx.js +864 -0
  27. package/dist/cjs/src/pro/probit.js +58 -66
  28. package/dist/cjs/src/xt.js +5 -5
  29. package/js/ccxt.d.ts +8 -2
  30. package/js/ccxt.js +6 -2
  31. package/js/src/abstract/bingx.d.ts +1 -0
  32. package/js/src/abstract/bitopro.d.ts +1 -0
  33. package/js/src/abstract/bitpanda.d.ts +0 -12
  34. package/js/src/abstract/bitrue.d.ts +3 -3
  35. package/js/src/abstract/bybit.d.ts +15 -0
  36. package/js/src/abstract/defx.d.ts +72 -0
  37. package/js/src/abstract/defx.js +11 -0
  38. package/js/src/abstract/deribit.d.ts +1 -0
  39. package/js/src/abstract/gate.d.ts +14 -0
  40. package/js/src/abstract/gateio.d.ts +14 -0
  41. package/js/src/abstract/okx.d.ts +1 -0
  42. package/js/src/abstract/onetrading.d.ts +0 -12
  43. package/js/src/bingx.d.ts +8 -0
  44. package/js/src/bingx.js +339 -144
  45. package/js/src/bitfinex2.js +21 -13
  46. package/js/src/bitmex.js +104 -2
  47. package/js/src/bitopro.d.ts +11 -0
  48. package/js/src/bitopro.js +22 -4
  49. package/js/src/bitrue.js +2 -2
  50. package/js/src/bitso.js +2 -1
  51. package/js/src/btcmarkets.js +3 -3
  52. package/js/src/btcturk.js +19 -19
  53. package/js/src/bybit.js +20 -0
  54. package/js/src/defx.d.ts +349 -0
  55. package/js/src/defx.js +2049 -0
  56. package/js/src/deribit.d.ts +2 -0
  57. package/js/src/deribit.js +34 -14
  58. package/js/src/gate.d.ts +5 -5
  59. package/js/src/gate.js +158 -41
  60. package/js/src/hashkey.js +1 -1
  61. package/js/src/htx.d.ts +3 -0
  62. package/js/src/htx.js +14 -2
  63. package/js/src/hyperliquid.d.ts +10 -0
  64. package/js/src/hyperliquid.js +75 -13
  65. package/js/src/idex.js +4 -4
  66. package/js/src/kraken.d.ts +11 -8
  67. package/js/src/kraken.js +110 -102
  68. package/js/src/kucoin.js +1 -1
  69. package/js/src/okx.js +1 -0
  70. package/js/src/onetrading.d.ts +15 -67
  71. package/js/src/onetrading.js +20 -395
  72. package/js/src/pro/bitrue.js +13 -11
  73. package/js/src/pro/defx.d.ts +236 -0
  74. package/js/src/pro/defx.js +865 -0
  75. package/js/src/pro/probit.d.ts +2 -1
  76. package/js/src/pro/probit.js +58 -66
  77. package/js/src/xt.js +5 -5
  78. package/package.json +2 -1
@@ -37,7 +37,7 @@ export default class onetrading extends Exchange {
37
37
  'cancelOrders': true,
38
38
  'closeAllPositions': false,
39
39
  'closePosition': false,
40
- 'createDepositAddress': true,
40
+ 'createDepositAddress': false,
41
41
  'createOrder': true,
42
42
  'createReduceOnlyOrder': false,
43
43
  'createStopLimitOrder': true,
@@ -52,10 +52,10 @@ export default class onetrading extends Exchange {
52
52
  'fetchCrossBorrowRates': false,
53
53
  'fetchCurrencies': true,
54
54
  'fetchDeposit': false,
55
- 'fetchDepositAddress': true,
55
+ 'fetchDepositAddress': false,
56
56
  'fetchDepositAddresses': false,
57
57
  'fetchDepositAddressesByNetwork': false,
58
- 'fetchDeposits': true,
58
+ 'fetchDeposits': false,
59
59
  'fetchDepositsWithdrawals': false,
60
60
  'fetchFundingHistory': false,
61
61
  'fetchFundingRate': false,
@@ -88,7 +88,7 @@ export default class onetrading extends Exchange {
88
88
  'fetchTicker': true,
89
89
  'fetchTickers': true,
90
90
  'fetchTime': true,
91
- 'fetchTrades': true,
91
+ 'fetchTrades': false,
92
92
  'fetchTradingFee': false,
93
93
  'fetchTradingFees': true,
94
94
  'fetchTransactionFee': false,
@@ -97,14 +97,14 @@ export default class onetrading extends Exchange {
97
97
  'fetchTransfer': false,
98
98
  'fetchTransfers': false,
99
99
  'fetchWithdrawal': false,
100
- 'fetchWithdrawals': true,
100
+ 'fetchWithdrawals': false,
101
101
  'reduceMargin': false,
102
102
  'setLeverage': false,
103
103
  'setMargin': false,
104
104
  'setMarginMode': false,
105
105
  'setPositionMode': false,
106
106
  'transfer': false,
107
- 'withdraw': true,
107
+ 'withdraw': false,
108
108
  },
109
109
  'timeframes': {
110
110
  '1m': '1/MINUTES',
@@ -139,32 +139,20 @@ export default class onetrading extends Exchange {
139
139
  'order-book/{instrument_code}',
140
140
  'market-ticker',
141
141
  'market-ticker/{instrument_code}',
142
- 'price-ticks/{instrument_code}',
143
142
  'time',
144
143
  ],
145
144
  },
146
145
  'private': {
147
146
  'get': [
148
147
  'account/balances',
149
- 'account/deposit/crypto/{currency_code}',
150
- 'account/deposit/fiat/EUR',
151
- 'account/deposits',
152
- 'account/deposits/bitpanda',
153
- 'account/withdrawals',
154
- 'account/withdrawals/bitpanda',
155
148
  'account/fees',
156
149
  'account/orders',
157
150
  'account/orders/{order_id}',
158
151
  'account/orders/{order_id}/trades',
159
152
  'account/trades',
160
153
  'account/trades/{trade_id}',
161
- 'account/trading-volume',
162
154
  ],
163
155
  'post': [
164
- 'account/deposit/crypto',
165
- 'account/withdraw/crypto',
166
- 'account/withdraw/fiat',
167
- 'account/fees',
168
156
  'account/orders',
169
157
  ],
170
158
  'delete': [
@@ -634,6 +622,7 @@ export default class onetrading extends Exchange {
634
622
  * @method
635
623
  * @name onetrading#fetchTicker
636
624
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
625
+ * @see https://docs.onetrading.com/#market-ticker-for-instrument
637
626
  * @param {string} symbol unified symbol of the market to fetch the ticker for
638
627
  * @param {object} [params] extra parameters specific to the exchange API endpoint
639
628
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -669,7 +658,8 @@ export default class onetrading extends Exchange {
669
658
  * @method
670
659
  * @name onetrading#fetchTickers
671
660
  * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
672
- * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
661
+ * @see https://docs.onetrading.com/#market-ticker
662
+ * @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
673
663
  * @param {object} [params] extra parameters specific to the exchange API endpoint
674
664
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
675
665
  */
@@ -709,6 +699,7 @@ export default class onetrading extends Exchange {
709
699
  * @method
710
700
  * @name onetrading#fetchOrderBook
711
701
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
702
+ * @see https://docs.onetrading.com/#order-book
712
703
  * @param {string} symbol unified symbol of the market to fetch the order book for
713
704
  * @param {int} [limit] the maximum amount of order book entries to return
714
705
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -834,6 +825,7 @@ export default class onetrading extends Exchange {
834
825
  * @method
835
826
  * @name onetrading#fetchOHLCV
836
827
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
828
+ * @see https://docs.onetrading.com/#candlesticks
837
829
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
838
830
  * @param {string} timeframe the length of time each candle represents
839
831
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -958,47 +950,6 @@ export default class onetrading extends Exchange {
958
950
  'info': trade,
959
951
  }, market);
960
952
  }
961
- /**
962
- * @method
963
- * @name onetrading#fetchTrades
964
- * @description get the list of most recent trades for a particular symbol
965
- * @param {string} symbol unified symbol of the market to fetch trades for
966
- * @param {int} [since] timestamp in ms of the earliest trade to fetch
967
- * @param {int} [limit] the maximum amount of trades to fetch
968
- * @param {object} [params] extra parameters specific to the exchange API endpoint
969
- * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
970
- */
971
- async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
972
- await this.loadMarkets();
973
- const market = this.market(symbol);
974
- const request = {
975
- 'instrument_code': market['id'],
976
- // 'from': this.iso8601 (since),
977
- // 'to': this.iso8601 (this.milliseconds ()),
978
- };
979
- if (since !== undefined) {
980
- // returns price ticks for a specific market with an interval of maximum of 4 hours
981
- // sorted by latest first
982
- request['from'] = this.iso8601(since);
983
- request['to'] = this.iso8601(this.sum(since, 14400000));
984
- }
985
- const response = await this.publicGetPriceTicksInstrumentCode(this.extend(request, params));
986
- //
987
- // [
988
- // {
989
- // "instrument_code":"BTC_EUR",
990
- // "price":"8137.28",
991
- // "amount":"0.22269",
992
- // "taker_side":"BUY",
993
- // "volume":"1812.0908832",
994
- // "time":"2020-07-10T14:44:32.299Z",
995
- // "trade_timestamp":1594392272299,
996
- // "sequence":603047
997
- // }
998
- // ]
999
- //
1000
- return this.parseTrades(response, market, since, limit);
1001
- }
1002
953
  parseBalance(response) {
1003
954
  const balances = this.safeValue(response, 'balances', []);
1004
955
  const result = { 'info': response };
@@ -1017,6 +968,7 @@ export default class onetrading extends Exchange {
1017
968
  * @method
1018
969
  * @name onetrading#fetchBalance
1019
970
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
971
+ * @see https://docs.onetrading.com/#balances
1020
972
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1021
973
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
1022
974
  */
@@ -1041,341 +993,6 @@ export default class onetrading extends Exchange {
1041
993
  //
1042
994
  return this.parseBalance(response);
1043
995
  }
1044
- parseDepositAddress(depositAddress, currency = undefined) {
1045
- let code = undefined;
1046
- if (currency !== undefined) {
1047
- code = currency['code'];
1048
- }
1049
- const address = this.safeString(depositAddress, 'address');
1050
- const tag = this.safeString(depositAddress, 'destination_tag');
1051
- this.checkAddress(address);
1052
- return {
1053
- 'info': depositAddress,
1054
- 'currency': code,
1055
- 'network': undefined,
1056
- 'address': address,
1057
- 'tag': tag,
1058
- };
1059
- }
1060
- /**
1061
- * @method
1062
- * @name onetrading#createDepositAddress
1063
- * @description create a currency deposit address
1064
- * @param {string} code unified currency code of the currency for the deposit address
1065
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1066
- * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
1067
- */
1068
- async createDepositAddress(code, params = {}) {
1069
- await this.loadMarkets();
1070
- const currency = this.currency(code);
1071
- const request = {
1072
- 'currency': currency['id'],
1073
- };
1074
- const response = await this.privatePostAccountDepositCrypto(this.extend(request, params));
1075
- //
1076
- // {
1077
- // "address":"rBnNhk95FrdNisZtXcStzriFS8vEzz53DM",
1078
- // "destination_tag":"865690307",
1079
- // "enabled":true,
1080
- // "is_smart_contract":false
1081
- // }
1082
- //
1083
- return this.parseDepositAddress(response, currency);
1084
- }
1085
- /**
1086
- * @method
1087
- * @name onetrading#fetchDepositAddress
1088
- * @description fetch the deposit address for a currency associated with this account
1089
- * @param {string} code unified currency code
1090
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1091
- * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
1092
- */
1093
- async fetchDepositAddress(code, params = {}) {
1094
- await this.loadMarkets();
1095
- const currency = this.currency(code);
1096
- const request = {
1097
- 'currency_code': currency['id'],
1098
- };
1099
- const response = await this.privateGetAccountDepositCryptoCurrencyCode(this.extend(request, params));
1100
- //
1101
- // {
1102
- // "address":"rBnNhk95FrdNisZtXcStzriFS8vEzz53DM",
1103
- // "destination_tag":"865690307",
1104
- // "enabled":true,
1105
- // "is_smart_contract":false,
1106
- // "can_create_more":false
1107
- // }
1108
- //
1109
- return this.parseDepositAddress(response, currency);
1110
- }
1111
- /**
1112
- * @method
1113
- * @name onetrading#fetchDeposits
1114
- * @description fetch all deposits made to an account
1115
- * @param {string} code unified currency code
1116
- * @param {int} [since] the earliest time in ms to fetch deposits for
1117
- * @param {int} [limit] the maximum number of deposits structures to retrieve
1118
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1119
- * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
1120
- */
1121
- async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
1122
- await this.loadMarkets();
1123
- const request = {
1124
- // 'cursor': 'string', // pointer specifying the position from which the next pages should be returned
1125
- };
1126
- let currency = undefined;
1127
- if (code !== undefined) {
1128
- currency = this.currency(code);
1129
- request['currency_code'] = currency['id'];
1130
- }
1131
- if (limit !== undefined) {
1132
- request['max_page_size'] = limit;
1133
- }
1134
- if (since !== undefined) {
1135
- const to = this.safeString(params, 'to');
1136
- if (to === undefined) {
1137
- throw new ArgumentsRequired(this.id + ' fetchDeposits() requires a "to" iso8601 string param with the since argument is specified');
1138
- }
1139
- request['from'] = this.iso8601(since);
1140
- }
1141
- const response = await this.privateGetAccountDeposits(this.extend(request, params));
1142
- //
1143
- // {
1144
- // "deposit_history": [
1145
- // {
1146
- // "transaction_id": "e5342efcd-d5b7-4a56-8e12-b69ffd68c5ef",
1147
- // "account_id": "c2d0076a-c20d-41f8-9e9a-1a1d028b2b58",
1148
- // "amount": "100",
1149
- // "type": "CRYPTO",
1150
- // "funds_source": "INTERNAL",
1151
- // "time": "2020-04-22T09:57:47Z",
1152
- // "currency": "BTC",
1153
- // "fee_amount": "0.0",
1154
- // "fee_currency": "BTC"
1155
- // },
1156
- // {
1157
- // "transaction_id": "79793d00-2899-4a4d-95b7-73ae6b31384f",
1158
- // "account_id": "c2d0076a-c20d-41f8-9e9a-1a1d028b2b58",
1159
- // "time": "2020-05-05T11:22:07.925Z",
1160
- // "currency": "EUR",
1161
- // "funds_source": "EXTERNAL",
1162
- // "type": "FIAT",
1163
- // "amount": "50.0",
1164
- // "fee_amount": "0.01",
1165
- // "fee_currency": "EUR"
1166
- // }
1167
- // ],
1168
- // "max_page_size": 2,
1169
- // "cursor": "eyJhY2NvdW50X2lkIjp7InMiOiJlMzY5YWM4MC00NTc3LTExZTktYWUwOC05YmVkYzQ3OTBiODQiLCJzcyI6W10sIm5zIjpbXSwiYnMiOltdLCJtIjp7fSwibCI6W119LCJpdGVtX2tleSI6eyJzIjoiV0lUSERSQVdBTDo6MmFlMjYwY2ItOTk3MC00YmNiLTgxNmEtZGY4MDVmY2VhZTY1Iiwic3MiOltdLCJucyI6W10sImJzIjpbXSwibSI6e30sImwiOltdfSwiZ2xvYmFsX3dpdGhkcmF3YWxfaW5kZXhfaGFzaF9rZXkiOnsicyI6ImUzNjlhYzgwLTQ1NzctMTFlOS1hZTA4LTliZWRjNDc5MGI4NCIsInNzIjpbXSwibnMiOltdLCJicyI6W10sIm0iOnt9LCJsIjpbXX0sInRpbWVzdGFtcCI6eyJuIjoiMTU4ODA1ODc2Nzk0OCIsInNzIjpbXSwibnMiOltdLCJicyI6W10sIm0iOnt9LCJsIjpbXX19"
1170
- // }
1171
- //
1172
- const depositHistory = this.safeList(response, 'deposit_history', []);
1173
- return this.parseTransactions(depositHistory, currency, since, limit, { 'type': 'deposit' });
1174
- }
1175
- /**
1176
- * @method
1177
- * @name onetrading#fetchWithdrawals
1178
- * @description fetch all withdrawals made from an account
1179
- * @param {string} code unified currency code
1180
- * @param {int} [since] the earliest time in ms to fetch withdrawals for
1181
- * @param {int} [limit] the maximum number of withdrawals structures to retrieve
1182
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1183
- * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
1184
- */
1185
- async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
1186
- await this.loadMarkets();
1187
- const request = {
1188
- // 'cursor': 'string', // pointer specifying the position from which the next pages should be returned
1189
- };
1190
- let currency = undefined;
1191
- if (code !== undefined) {
1192
- currency = this.currency(code);
1193
- request['currency_code'] = currency['id'];
1194
- }
1195
- if (limit !== undefined) {
1196
- request['max_page_size'] = limit;
1197
- }
1198
- if (since !== undefined) {
1199
- const to = this.safeString(params, 'to');
1200
- if (to === undefined) {
1201
- throw new ArgumentsRequired(this.id + ' fetchWithdrawals() requires a "to" iso8601 string param with the since argument is specified');
1202
- }
1203
- request['from'] = this.iso8601(since);
1204
- }
1205
- const response = await this.privateGetAccountWithdrawals(this.extend(request, params));
1206
- //
1207
- // {
1208
- // "withdrawal_history": [
1209
- // {
1210
- // "account_id": "e369ac80-4577-11e9-ae08-9bedc4790b84",
1211
- // "amount": "0.1",
1212
- // "currency": "BTC",
1213
- // "fee_amount": "0.00002",
1214
- // "fee_currency": "BTC",
1215
- // "funds_source": "EXTERNAL",
1216
- // "related_transaction_id": "e298341a-3855-405e-bce3-92db368a3157",
1217
- // "time": "2020-05-05T11:11:32.110Z",
1218
- // "transaction_id": "6693ff40-bb10-4dcf-ada7-3b287727c882",
1219
- // "type": "CRYPTO"
1220
- // },
1221
- // {
1222
- // "account_id": "e369ac80-4577-11e9-ae08-9bedc4790b84",
1223
- // "amount": "0.1",
1224
- // "currency": "BTC",
1225
- // "fee_amount": "0.0",
1226
- // "fee_currency": "BTC",
1227
- // "funds_source": "INTERNAL",
1228
- // "time": "2020-05-05T10:29:53.464Z",
1229
- // "transaction_id": "ec9703b1-954b-4f76-adea-faac66eabc0b",
1230
- // "type": "CRYPTO"
1231
- // }
1232
- // ],
1233
- // "cursor": "eyJhY2NvdW50X2lkIjp7InMiOiJlMzY5YWM4MC00NTc3LTExZTktYWUwOC05YmVkYzQ3OTBiODQiLCJzcyI6W10sIm5zIjpbXSwiYnMiOltdLCJtIjp7fSwibCI6W119LCJpdGVtX2tleSI6eyJzIjoiV0lUSERSQVdBTDo6ZWM5NzAzYjEtOTU0Yi00Zjc2LWFkZWEtZmFhYzY2ZWFiYzBiIiwic3MiOltdLCJucyI6W10sImJzIjpbXSwibSI6e30sImwiOltdfSwiZ2xvYmFsX3dpdGhkcmF3YWxfaW5kZXhfaGFzaF9rZXkiOnsicyI6ImUzNjlhYzgwLTQ1NzctMTFlOS1hZTA4LTliZWRjNDc5MGI4NCIsInNzIjpbXSwibnMiOltdLCJicyI6W10sIm0iOnt9LCJsIjpbXX0sInRpbWVzdGFtcCI6eyJuIjoiMTU4ODY3NDU5MzQ2NCIsInNzIjpbXSwibnMiOltdLCJicyI6W10sIm0iOnt9LCJsIjpbXX19",
1234
- // "max_page_size": 2
1235
- // }
1236
- //
1237
- const withdrawalHistory = this.safeList(response, 'withdrawal_history', []);
1238
- return this.parseTransactions(withdrawalHistory, currency, since, limit, { 'type': 'withdrawal' });
1239
- }
1240
- /**
1241
- * @method
1242
- * @name onetrading#withdraw
1243
- * @description make a withdrawal
1244
- * @param {string} code unified currency code
1245
- * @param {float} amount the amount to withdraw
1246
- * @param {string} address the address to withdraw to
1247
- * @param {string} tag
1248
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1249
- * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
1250
- */
1251
- async withdraw(code, amount, address, tag = undefined, params = {}) {
1252
- [tag, params] = this.handleWithdrawTagAndParams(tag, params);
1253
- this.checkAddress(address);
1254
- await this.loadMarkets();
1255
- const currency = this.currency(code);
1256
- const request = {
1257
- 'currency': code,
1258
- 'amount': this.currencyToPrecision(code, amount),
1259
- // 'payout_account_id': '66756a10-3e86-48f4-9678-b634c4b135b2', // fiat only
1260
- // 'recipient': { // crypto only
1261
- // 'address': address,
1262
- // // 'destination_tag': '',
1263
- // },
1264
- };
1265
- const options = this.safeValue(this.options, 'fiat', []);
1266
- const isFiat = this.inArray(code, options);
1267
- const method = isFiat ? 'privatePostAccountWithdrawFiat' : 'privatePostAccountWithdrawCrypto';
1268
- if (isFiat) {
1269
- const payoutAccountId = this.safeString(params, 'payout_account_id');
1270
- if (payoutAccountId === undefined) {
1271
- throw new ArgumentsRequired(this.id + ' withdraw() requires a payout_account_id param for fiat ' + code + ' withdrawals');
1272
- }
1273
- }
1274
- else {
1275
- const recipient = { 'address': address };
1276
- if (tag !== undefined) {
1277
- recipient['destination_tag'] = tag;
1278
- }
1279
- request['recipient'] = recipient;
1280
- }
1281
- const response = await this[method](this.extend(request, params));
1282
- //
1283
- // crypto
1284
- //
1285
- // {
1286
- // "amount": "1234.5678",
1287
- // "fee": "1234.5678",
1288
- // "recipient": "3NacQ7rzZdhfyAtfJ5a11k8jFPdcMP2Bq7",
1289
- // "destination_tag": "",
1290
- // "transaction_id": "d0f8529f-f832-4e6a-9dc5-b8d5797badb2"
1291
- // }
1292
- //
1293
- // fiat
1294
- //
1295
- // {
1296
- // "transaction_id": "54236cd0-4413-11e9-93fb-5fea7e5b5df6"
1297
- // }
1298
- //
1299
- return this.parseTransaction(response, currency);
1300
- }
1301
- parseTransaction(transaction, currency = undefined) {
1302
- //
1303
- // fetchDeposits, fetchWithdrawals
1304
- //
1305
- // {
1306
- // "transaction_id": "C2b42efcd-d5b7-4a56-8e12-b69ffd68c5ef",
1307
- // "type": "FIAT",
1308
- // "account_id": "c2d0076a-c20d-41f8-9e9a-1a1d028b2b58",
1309
- // "amount": "1234.5678",
1310
- // "time": "2019-08-24T14:15:22Z",
1311
- // "funds_source": "INTERNAL",
1312
- // "currency": "BTC",
1313
- // "fee_amount": "1234.5678",
1314
- // "fee_currency": "BTC",
1315
- // "blockchain_transaction_id": "f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16",
1316
- // "related_transaction_id": "e298341a-3855-405e-bce3-92db368a3157"
1317
- // }
1318
- //
1319
- // withdraw
1320
- //
1321
- //
1322
- // crypto
1323
- //
1324
- // {
1325
- // "amount": "1234.5678",
1326
- // "fee": "1234.5678",
1327
- // "recipient": "3NacQ7rzZdhfyAtfJ5a11k8jFPdcMP2Bq7",
1328
- // "destination_tag": "",
1329
- // "transaction_id": "d0f8529f-f832-4e6a-9dc5-b8d5797badb2"
1330
- // }
1331
- //
1332
- // fiat
1333
- //
1334
- // {
1335
- // "transaction_id": "54236cd0-4413-11e9-93fb-5fea7e5b5df6"
1336
- // }
1337
- //
1338
- const id = this.safeString(transaction, 'transaction_id');
1339
- const amount = this.safeNumber(transaction, 'amount');
1340
- const timestamp = this.parse8601(this.safeString(transaction, 'time'));
1341
- const currencyId = this.safeString(transaction, 'currency');
1342
- currency = this.safeCurrency(currencyId, currency);
1343
- const status = 'ok'; // the exchange returns cleared transactions only
1344
- const feeCost = this.safeNumber2(transaction, 'fee_amount', 'fee');
1345
- let fee = undefined;
1346
- const addressTo = this.safeString(transaction, 'recipient');
1347
- const tagTo = this.safeString(transaction, 'destination_tag');
1348
- if (feeCost !== undefined) {
1349
- const feeCurrencyId = this.safeString(transaction, 'fee_currency', currencyId);
1350
- const feeCurrencyCode = this.safeCurrencyCode(feeCurrencyId);
1351
- fee = {
1352
- 'cost': feeCost,
1353
- 'currency': feeCurrencyCode,
1354
- };
1355
- }
1356
- return {
1357
- 'info': transaction,
1358
- 'id': id,
1359
- 'currency': currency['code'],
1360
- 'amount': amount,
1361
- 'network': undefined,
1362
- 'address': addressTo,
1363
- 'addressFrom': undefined,
1364
- 'addressTo': addressTo,
1365
- 'tag': tagTo,
1366
- 'tagFrom': undefined,
1367
- 'tagTo': tagTo,
1368
- 'status': status,
1369
- 'type': undefined,
1370
- 'updated': undefined,
1371
- 'txid': this.safeString(transaction, 'blockchain_transaction_id'),
1372
- 'comment': undefined,
1373
- 'internal': undefined,
1374
- 'timestamp': timestamp,
1375
- 'datetime': this.iso8601(timestamp),
1376
- 'fee': fee,
1377
- };
1378
- }
1379
996
  parseOrderStatus(status) {
1380
997
  const statuses = {
1381
998
  'FILLED': 'open',
@@ -1584,6 +1201,7 @@ export default class onetrading extends Exchange {
1584
1201
  * @method
1585
1202
  * @name onetrading#cancelOrder
1586
1203
  * @description cancels an open order
1204
+ * @see https://docs.onetrading.com/#close-order-by-order-id
1587
1205
  * @param {string} id order id
1588
1206
  * @param {string} symbol not used by bitmex cancelOrder ()
1589
1207
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -1612,6 +1230,7 @@ export default class onetrading extends Exchange {
1612
1230
  * @method
1613
1231
  * @name onetrading#cancelAllOrders
1614
1232
  * @description cancel all open orders
1233
+ * @see https://docs.onetrading.com/#close-all-orders
1615
1234
  * @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
1616
1235
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1617
1236
  * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -1635,6 +1254,7 @@ export default class onetrading extends Exchange {
1635
1254
  * @method
1636
1255
  * @name onetrading#cancelOrders
1637
1256
  * @description cancel multiple orders
1257
+ * @see https://docs.onetrading.com/#close-all-orders
1638
1258
  * @param {string[]} ids order ids
1639
1259
  * @param {string} symbol unified market symbol, default is undefined
1640
1260
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -1657,6 +1277,7 @@ export default class onetrading extends Exchange {
1657
1277
  * @method
1658
1278
  * @name onetrading#fetchOrder
1659
1279
  * @description fetches information on an order made by the user
1280
+ * @see https://docs.onetrading.com/#get-order
1660
1281
  * @param {string} id the order id
1661
1282
  * @param {string} symbol not used by onetrading fetchOrder
1662
1283
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -1715,6 +1336,7 @@ export default class onetrading extends Exchange {
1715
1336
  * @method
1716
1337
  * @name onetrading#fetchOpenOrders
1717
1338
  * @description fetch all unfilled currently open orders
1339
+ * @see https://docs.onetrading.com/#get-orders
1718
1340
  * @param {string} symbol unified market symbol
1719
1341
  * @param {int} [since] the earliest time in ms to fetch open orders for
1720
1342
  * @param {int} [limit] the maximum number of open orders structures to retrieve
@@ -1835,6 +1457,7 @@ export default class onetrading extends Exchange {
1835
1457
  * @method
1836
1458
  * @name onetrading#fetchClosedOrders
1837
1459
  * @description fetches information on multiple closed orders made by the user
1460
+ * @see https://docs.onetrading.com/#get-orders
1838
1461
  * @param {string} symbol unified market symbol of the market orders were made in
1839
1462
  * @param {int} [since] the earliest time in ms to fetch orders for
1840
1463
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -1851,6 +1474,7 @@ export default class onetrading extends Exchange {
1851
1474
  * @method
1852
1475
  * @name onetrading#fetchOrderTrades
1853
1476
  * @description fetch all the trades made from a single order
1477
+ * @see https://docs.onetrading.com/#trades-for-order
1854
1478
  * @param {string} id order id
1855
1479
  * @param {string} symbol unified market symbol
1856
1480
  * @param {int} [since] the earliest time in ms to fetch trades for
@@ -1910,6 +1534,7 @@ export default class onetrading extends Exchange {
1910
1534
  * @method
1911
1535
  * @name onetrading#fetchMyTrades
1912
1536
  * @description fetch all trades made by the user
1537
+ * @see https://docs.onetrading.com/#all-trades
1913
1538
  * @param {string} symbol unified market symbol
1914
1539
  * @param {int} [since] the earliest time in ms to fetch trades for
1915
1540
  * @param {int} [limit] the maximum number of trades structures to retrieve
@@ -33,15 +33,17 @@ export default class bitrue extends bitrueRest {
33
33
  },
34
34
  'api': {
35
35
  'open': {
36
- 'private': {
37
- 'post': {
38
- 'poseidon/api/v1/listenKey': 1,
39
- },
40
- 'put': {
41
- 'poseidon/api/v1/listenKey/{listenKey}': 1,
42
- },
43
- 'delete': {
44
- 'poseidon/api/v1/listenKey/{listenKey}': 1,
36
+ 'v1': {
37
+ 'private': {
38
+ 'post': {
39
+ 'poseidon/api/v1/listenKey': 1,
40
+ },
41
+ 'put': {
42
+ 'poseidon/api/v1/listenKey/{listenKey}': 1,
43
+ },
44
+ 'delete': {
45
+ 'poseidon/api/v1/listenKey/{listenKey}': 1,
46
+ },
45
47
  },
46
48
  },
47
49
  },
@@ -414,7 +416,7 @@ export default class bitrue extends bitrueRest {
414
416
  async authenticate(params = {}) {
415
417
  const listenKey = this.safeValue(this.options, 'listenKey');
416
418
  if (listenKey === undefined) {
417
- const response = await this.openPrivatePostPoseidonApiV1ListenKey(params);
419
+ const response = await this.openV1PrivatePostPoseidonApiV1ListenKey(params);
418
420
  //
419
421
  // {
420
422
  // "msg": "succ",
@@ -439,7 +441,7 @@ export default class bitrue extends bitrueRest {
439
441
  'listenKey': listenKey,
440
442
  };
441
443
  try {
442
- await this.openPrivatePutPoseidonApiV1ListenKeyListenKey(this.extend(request, params));
444
+ await this.openV1PrivatePutPoseidonApiV1ListenKeyListenKey(this.extend(request, params));
443
445
  //
444
446
  // ಠ_ಠ
445
447
  // {