ccxt 4.4.67 → 4.4.69

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/js/src/luno.js CHANGED
@@ -29,6 +29,7 @@ export default class luno extends Exchange {
29
29
  'cancelOrder': true,
30
30
  'closeAllPositions': false,
31
31
  'closePosition': false,
32
+ 'createDepositAddress': true,
32
33
  'createOrder': true,
33
34
  'createReduceOnlyOrder': false,
34
35
  'fetchAccounts': true,
@@ -37,6 +38,7 @@ export default class luno extends Exchange {
37
38
  'fetchClosedOrders': true,
38
39
  'fetchCrossBorrowRate': false,
39
40
  'fetchCrossBorrowRates': false,
41
+ 'fetchDepositAddress': true,
40
42
  'fetchFundingHistory': false,
41
43
  'fetchFundingRate': false,
42
44
  'fetchFundingRateHistory': false,
@@ -1205,6 +1207,116 @@ export default class luno extends Exchange {
1205
1207
  'fee': undefined,
1206
1208
  }, currency);
1207
1209
  }
1210
+ /**
1211
+ * @method
1212
+ * @name luno#createDepositAddress
1213
+ * @description create a currency deposit address
1214
+ * @see https://www.luno.com/en/developers/api#tag/Receive/operation/createFundingAddress
1215
+ * @param {string} code unified currency code of the currency for the deposit address
1216
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1217
+ * @param {string} [params.name] an optional name for the new address
1218
+ * @param {int} [params.account_id] an optional account id for the new address
1219
+ * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
1220
+ */
1221
+ async createDepositAddress(code, params = {}) {
1222
+ await this.loadMarkets();
1223
+ const currency = this.currency(code);
1224
+ const request = {
1225
+ 'asset': currency['id'],
1226
+ };
1227
+ const response = await this.privatePostFundingAddress(this.extend(request, params));
1228
+ //
1229
+ // {
1230
+ // "account_id": "string",
1231
+ // "address": "string",
1232
+ // "address_meta": [
1233
+ // {
1234
+ // "label": "string",
1235
+ // "value": "string"
1236
+ // }
1237
+ // ],
1238
+ // "asset": "string",
1239
+ // "assigned_at": 0,
1240
+ // "name": "string",
1241
+ // "network": 0,
1242
+ // "qr_code_uri": "string",
1243
+ // "receive_fee": "string",
1244
+ // "total_received": "string",
1245
+ // "total_unconfirmed": "string"
1246
+ // }
1247
+ //
1248
+ return this.parseDepositAddress(response, currency);
1249
+ }
1250
+ /**
1251
+ * @method
1252
+ * @name luno#fetchDepositAddress
1253
+ * @description fetch the deposit address for a currency associated with this account
1254
+ * @see https://www.luno.com/en/developers/api#tag/Receive/operation/getFundingAddress
1255
+ * @param {string} code unified currency code
1256
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1257
+ * @param {string} [params.address] a specific cryptocurrency address to retrieve
1258
+ * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
1259
+ */
1260
+ async fetchDepositAddress(code, params = {}) {
1261
+ await this.loadMarkets();
1262
+ const currency = this.currency(code);
1263
+ const request = {
1264
+ 'asset': currency['id'],
1265
+ };
1266
+ const response = await this.privateGetFundingAddress(this.extend(request, params));
1267
+ //
1268
+ // {
1269
+ // "account_id": "string",
1270
+ // "address": "string",
1271
+ // "address_meta": [
1272
+ // {
1273
+ // "label": "string",
1274
+ // "value": "string"
1275
+ // }
1276
+ // ],
1277
+ // "asset": "string",
1278
+ // "assigned_at": 0,
1279
+ // "name": "string",
1280
+ // "network": 0,
1281
+ // "qr_code_uri": "string",
1282
+ // "receive_fee": "string",
1283
+ // "total_received": "string",
1284
+ // "total_unconfirmed": "string"
1285
+ // }
1286
+ //
1287
+ return this.parseDepositAddress(response, currency);
1288
+ }
1289
+ parseDepositAddress(depositAddress, currency = undefined) {
1290
+ //
1291
+ // {
1292
+ // "account_id": "string",
1293
+ // "address": "string",
1294
+ // "address_meta": [
1295
+ // {
1296
+ // "label": "string",
1297
+ // "value": "string"
1298
+ // }
1299
+ // ],
1300
+ // "asset": "string",
1301
+ // "assigned_at": 0,
1302
+ // "name": "string",
1303
+ // "network": 0,
1304
+ // "qr_code_uri": "string",
1305
+ // "receive_fee": "string",
1306
+ // "total_received": "string",
1307
+ // "total_unconfirmed": "string"
1308
+ // }
1309
+ //
1310
+ const currencyId = this.safeStringUpper(depositAddress, 'currency');
1311
+ const code = this.safeCurrencyCode(currencyId, currency);
1312
+ return {
1313
+ 'info': depositAddress,
1314
+ 'currency': code,
1315
+ 'network': undefined,
1316
+ 'address': this.safeString(depositAddress, 'address'),
1317
+ 'tag': this.safeString(depositAddress, 'name'),
1318
+ };
1319
+ }
1208
1320
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
1209
1321
  let url = this.urls['api'][api] + '/' + this.version + '/' + this.implodeParams(path, params);
1210
1322
  const query = this.omit(params, this.extractParams(path));
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/paradex.js';
2
- import type { Str, Num, Dict, Int, Market, OrderType, OrderSide, Order, OrderBook, Strings, Ticker, Tickers, Trade, Balances, Currency, Transaction, OHLCV, Position, int } from './base/types.js';
2
+ import type { Str, Num, Dict, Int, Market, OrderType, OrderSide, Order, OrderBook, Strings, Ticker, Tickers, Trade, Balances, Currency, Transaction, OHLCV, Position, int, MarginMode, Leverage } from './base/types.js';
3
3
  /**
4
4
  * @class paradex
5
5
  * @description Paradex is a decentralized exchange built on the StarkWare layer 2 scaling solution. To access private methods you can either use the ETH public key and private key by setting (exchange.privateKey and exchange.walletAddress)
@@ -311,6 +311,53 @@ export default class paradex extends Exchange {
311
311
  fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
312
312
  parseTransaction(transaction: Dict, currency?: Currency): Transaction;
313
313
  parseTransactionStatus(status: Str): string;
314
+ /**
315
+ * @method
316
+ * @name paradex#fetchMarginMode
317
+ * @description fetches the margin mode of a specific symbol
318
+ * @see https://docs.api.testnet.paradex.trade/#get-account-margin-configuration
319
+ * @param {string} symbol unified symbol of the market the order was made in
320
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
321
+ * @returns {object} a [margin mode structure]{@link https://docs.ccxt.com/#/?id=margin-mode-structure}
322
+ */
323
+ fetchMarginMode(symbol: string, params?: {}): Promise<MarginMode>;
324
+ parseMarginMode(rawMarginMode: Dict, market?: any): MarginMode;
325
+ /**
326
+ * @method
327
+ * @name paradex#setMarginMode
328
+ * @description set margin mode to 'cross' or 'isolated'
329
+ * @see https://docs.api.testnet.paradex.trade/#set-margin-configuration
330
+ * @param {string} marginMode 'cross' or 'isolated'
331
+ * @param {string} symbol unified market symbol
332
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
333
+ * @param {float} [params.leverage] the rate of leverage
334
+ * @returns {object} response from the exchange
335
+ */
336
+ setMarginMode(marginMode: string, symbol?: Str, params?: {}): Promise<any>;
337
+ /**
338
+ * @method
339
+ * @name paradex#fetchLeverage
340
+ * @description fetch the set leverage for a market
341
+ * @see https://docs.api.testnet.paradex.trade/#get-account-margin-configuration
342
+ * @param {string} symbol unified market symbol
343
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
344
+ * @returns {object} a [leverage structure]{@link https://docs.ccxt.com/#/?id=leverage-structure}
345
+ */
346
+ fetchLeverage(symbol: string, params?: {}): Promise<Leverage>;
347
+ parseLeverage(leverage: Dict, market?: Market): Leverage;
348
+ encodeMarginMode(mode: any): string;
349
+ /**
350
+ * @method
351
+ * @name paradex#setLeverage
352
+ * @description set the level of leverage for a market
353
+ * @see https://docs.api.testnet.paradex.trade/#set-margin-configuration
354
+ * @param {float} leverage the rate of leverage
355
+ * @param {string} [symbol] unified market symbol (is mandatory for swap markets)
356
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
357
+ * @param {string} [params.marginMode] 'cross' or 'isolated'
358
+ * @returns {object} response from the exchange
359
+ */
360
+ setLeverage(leverage: Int, symbol?: Str, params?: {}): Promise<any>;
314
361
  sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
315
362
  url: string;
316
363
  method: string;
package/js/src/paradex.js CHANGED
@@ -73,10 +73,10 @@ export default class paradex extends Exchange {
73
73
  'fetchIsolatedBorrowRate': false,
74
74
  'fetchIsolatedBorrowRates': false,
75
75
  'fetchLedger': false,
76
- 'fetchLeverage': false,
76
+ 'fetchLeverage': true,
77
77
  'fetchLeverageTiers': false,
78
78
  'fetchLiquidations': true,
79
- 'fetchMarginMode': undefined,
79
+ 'fetchMarginMode': true,
80
80
  'fetchMarketLeverageTiers': false,
81
81
  'fetchMarkets': true,
82
82
  'fetchMarkOHLCV': false,
@@ -110,8 +110,8 @@ export default class paradex extends Exchange {
110
110
  'repayCrossMargin': false,
111
111
  'repayIsolatedMargin': false,
112
112
  'sandbox': true,
113
- 'setLeverage': false,
114
- 'setMarginMode': false,
113
+ 'setLeverage': true,
114
+ 'setMarginMode': true,
115
115
  'setPositionMode': false,
116
116
  'transfer': false,
117
117
  'withdraw': false,
@@ -153,12 +153,23 @@ export default class paradex extends Exchange {
153
153
  'system/state': 1,
154
154
  'system/time': 1,
155
155
  'trades': 1,
156
+ 'vaults': 1,
157
+ 'vaults/balance': 1,
158
+ 'vaults/config': 1,
159
+ 'vaults/history': 1,
160
+ 'vaults/positions': 1,
161
+ 'vaults/summary': 1,
162
+ 'vaults/transfers': 1,
156
163
  },
157
164
  },
158
165
  'private': {
159
166
  'get': {
160
167
  'account': 1,
168
+ 'account/info': 1,
169
+ 'account/history': 1,
170
+ 'account/margin': 1,
161
171
  'account/profile': 1,
172
+ 'account/subaccounts': 1,
162
173
  'balance': 1,
163
174
  'fills': 1,
164
175
  'funding/payments': 1,
@@ -171,20 +182,34 @@ export default class paradex extends Exchange {
171
182
  'orders/by_client_id/{client_id}': 1,
172
183
  'orders/{order_id}': 1,
173
184
  'points_data/{market}/{program}': 1,
185
+ 'referrals/qr-code': 1,
174
186
  'referrals/summary': 1,
175
187
  'transfers': 1,
188
+ 'algo/orders': 1,
189
+ 'algo/orders-history': 1,
190
+ 'algo/orders/{algo_id}': 1,
191
+ 'vaults/account-summary': 1,
176
192
  },
177
193
  'post': {
194
+ 'account/margin/{market}': 1,
195
+ 'account/profile/max_slippage': 1,
178
196
  'account/profile/referral_code': 1,
179
197
  'account/profile/username': 1,
180
198
  'auth': 1,
181
199
  'onboarding': 1,
182
200
  'orders': 1,
201
+ 'orders/batch': 1,
202
+ 'algo/orders': 1,
203
+ 'vaults': 1,
204
+ },
205
+ 'put': {
206
+ 'orders/{order_id}': 1,
183
207
  },
184
208
  'delete': {
185
209
  'orders': 1,
186
210
  'orders/by_client_id/{client_id}': 1,
187
211
  'orders/{order_id}': 1,
212
+ 'algo/orders/{algo_id}': 1,
188
213
  },
189
214
  },
190
215
  },
@@ -2123,6 +2148,149 @@ export default class paradex extends Exchange {
2123
2148
  };
2124
2149
  return this.safeString(statuses, status, status);
2125
2150
  }
2151
+ /**
2152
+ * @method
2153
+ * @name paradex#fetchMarginMode
2154
+ * @description fetches the margin mode of a specific symbol
2155
+ * @see https://docs.api.testnet.paradex.trade/#get-account-margin-configuration
2156
+ * @param {string} symbol unified symbol of the market the order was made in
2157
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2158
+ * @returns {object} a [margin mode structure]{@link https://docs.ccxt.com/#/?id=margin-mode-structure}
2159
+ */
2160
+ async fetchMarginMode(symbol, params = {}) {
2161
+ await this.authenticateRest();
2162
+ await this.loadMarkets();
2163
+ const market = this.market(symbol);
2164
+ const request = {
2165
+ 'market': market['id'],
2166
+ };
2167
+ const response = await this.privateGetAccountMargin(this.extend(request, params));
2168
+ //
2169
+ // {
2170
+ // "account": "0x6343248026a845b39a8a73fbe9c7ef0a841db31ed5c61ec1446aa9d25e54dbc",
2171
+ // "configs": [
2172
+ // {
2173
+ // "market": "SOL-USD-PERP",
2174
+ // "leverage": 50,
2175
+ // "margin_type": "CROSS"
2176
+ // }
2177
+ // ]
2178
+ // }
2179
+ //
2180
+ const configs = this.safeList(response, 'configs');
2181
+ return this.parseMarginMode(this.safeDict(configs, 0), market);
2182
+ }
2183
+ parseMarginMode(rawMarginMode, market = undefined) {
2184
+ const marketId = this.safeString(rawMarginMode, 'market');
2185
+ market = this.safeMarket(marketId, market);
2186
+ const marginMode = this.safeStringLower(rawMarginMode, 'margin_type');
2187
+ return {
2188
+ 'info': rawMarginMode,
2189
+ 'symbol': market['symbol'],
2190
+ 'marginMode': marginMode,
2191
+ };
2192
+ }
2193
+ /**
2194
+ * @method
2195
+ * @name paradex#setMarginMode
2196
+ * @description set margin mode to 'cross' or 'isolated'
2197
+ * @see https://docs.api.testnet.paradex.trade/#set-margin-configuration
2198
+ * @param {string} marginMode 'cross' or 'isolated'
2199
+ * @param {string} symbol unified market symbol
2200
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2201
+ * @param {float} [params.leverage] the rate of leverage
2202
+ * @returns {object} response from the exchange
2203
+ */
2204
+ async setMarginMode(marginMode, symbol = undefined, params = {}) {
2205
+ this.checkRequiredArgument('setMarginMode', symbol, 'symbol');
2206
+ await this.authenticateRest();
2207
+ await this.loadMarkets();
2208
+ const market = this.market(symbol);
2209
+ let leverage = undefined;
2210
+ [leverage, params] = this.handleOptionAndParams(params, 'setMarginMode', 'leverage', 1);
2211
+ const request = {
2212
+ 'market': market['id'],
2213
+ 'leverage': leverage,
2214
+ 'margin_type': this.encodeMarginMode(marginMode),
2215
+ };
2216
+ return await this.privatePostAccountMarginMarket(this.extend(request, params));
2217
+ }
2218
+ /**
2219
+ * @method
2220
+ * @name paradex#fetchLeverage
2221
+ * @description fetch the set leverage for a market
2222
+ * @see https://docs.api.testnet.paradex.trade/#get-account-margin-configuration
2223
+ * @param {string} symbol unified market symbol
2224
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2225
+ * @returns {object} a [leverage structure]{@link https://docs.ccxt.com/#/?id=leverage-structure}
2226
+ */
2227
+ async fetchLeverage(symbol, params = {}) {
2228
+ await this.authenticateRest();
2229
+ await this.loadMarkets();
2230
+ const market = this.market(symbol);
2231
+ const request = {
2232
+ 'market': market['id'],
2233
+ };
2234
+ const response = await this.privateGetAccountMargin(this.extend(request, params));
2235
+ //
2236
+ // {
2237
+ // "account": "0x6343248026a845b39a8a73fbe9c7ef0a841db31ed5c61ec1446aa9d25e54dbc",
2238
+ // "configs": [
2239
+ // {
2240
+ // "market": "SOL-USD-PERP",
2241
+ // "leverage": 50,
2242
+ // "margin_type": "CROSS"
2243
+ // }
2244
+ // ]
2245
+ // }
2246
+ //
2247
+ const configs = this.safeList(response, 'configs');
2248
+ return this.parseLeverage(this.safeDict(configs, 0), market);
2249
+ }
2250
+ parseLeverage(leverage, market = undefined) {
2251
+ const marketId = this.safeString(leverage, 'market');
2252
+ market = this.safeMarket(marketId, market);
2253
+ const marginMode = this.safeStringLower(leverage, 'margin_type');
2254
+ return {
2255
+ 'info': leverage,
2256
+ 'symbol': this.safeSymbol(marketId, market),
2257
+ 'marginMode': marginMode,
2258
+ 'longLeverage': this.safeInteger(leverage, 'leverage'),
2259
+ 'shortLeverage': this.safeInteger(leverage, 'leverage'),
2260
+ };
2261
+ }
2262
+ encodeMarginMode(mode) {
2263
+ const modes = {
2264
+ 'cross': 'CROSS',
2265
+ 'isolated': 'ISOLATED',
2266
+ };
2267
+ return this.safeString(modes, mode, mode);
2268
+ }
2269
+ /**
2270
+ * @method
2271
+ * @name paradex#setLeverage
2272
+ * @description set the level of leverage for a market
2273
+ * @see https://docs.api.testnet.paradex.trade/#set-margin-configuration
2274
+ * @param {float} leverage the rate of leverage
2275
+ * @param {string} [symbol] unified market symbol (is mandatory for swap markets)
2276
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2277
+ * @param {string} [params.marginMode] 'cross' or 'isolated'
2278
+ * @returns {object} response from the exchange
2279
+ */
2280
+ async setLeverage(leverage, symbol = undefined, params = {}) {
2281
+ this.checkRequiredArgument('setLeverage', symbol, 'symbol');
2282
+ await this.authenticateRest();
2283
+ await this.loadMarkets();
2284
+ const market = this.market(symbol);
2285
+ let marginMode = undefined;
2286
+ [marginMode, params] = this.handleMarginModeAndParams('setLeverage', params, 'cross');
2287
+ const request = {
2288
+ 'market': market['id'],
2289
+ 'leverage': leverage,
2290
+ 'margin_type': this.encodeMarginMode(marginMode),
2291
+ };
2292
+ return await this.privatePostAccountMarginMarket(this.extend(request, params));
2293
+ }
2126
2294
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
2127
2295
  let url = this.implodeHostname(this.urls['api'][this.version]) + '/' + this.implodeParams(path, params);
2128
2296
  const query = this.omit(params, this.extractParams(path));
@@ -289,7 +289,7 @@ export default class phemex extends Exchange {
289
289
  * @see https://phemex-docs.github.io/#query-account-positions-with-unrealized-pnl
290
290
  * @param {string[]} [symbols] list of unified market symbols
291
291
  * @param {object} [params] extra parameters specific to the exchange API endpoint
292
- * @param {string} [params.code] the currency code to fetch positions for, USD, BTC or USDT, USD is the default
292
+ * @param {string} [params.code] the currency code to fetch positions for, USD, BTC or USDT, USDT is the default
293
293
  * @param {string} [params.method] *USDT contracts only* 'privateGetGAccountsAccountPositions' or 'privateGetAccountsPositions' default is 'privateGetGAccountsAccountPositions'
294
294
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
295
295
  */
package/js/src/phemex.js CHANGED
@@ -3798,7 +3798,7 @@ export default class phemex extends Exchange {
3798
3798
  * @see https://phemex-docs.github.io/#query-account-positions-with-unrealized-pnl
3799
3799
  * @param {string[]} [symbols] list of unified market symbols
3800
3800
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3801
- * @param {string} [params.code] the currency code to fetch positions for, USD, BTC or USDT, USD is the default
3801
+ * @param {string} [params.code] the currency code to fetch positions for, USD, BTC or USDT, USDT is the default
3802
3802
  * @param {string} [params.method] *USDT contracts only* 'privateGetGAccountsAccountPositions' or 'privateGetAccountsPositions' default is 'privateGetGAccountsAccountPositions'
3803
3803
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
3804
3804
  */
@@ -3806,7 +3806,7 @@ export default class phemex extends Exchange {
3806
3806
  await this.loadMarkets();
3807
3807
  symbols = this.marketSymbols(symbols);
3808
3808
  let subType = undefined;
3809
- let code = this.safeString2(params, 'currency', 'code', 'USD');
3809
+ let code = this.safeString2(params, 'currency', 'code', 'USDT');
3810
3810
  params = this.omit(params, ['currency', 'code']);
3811
3811
  let settle = undefined;
3812
3812
  let market = undefined;
@@ -44,6 +44,7 @@ export default class tradeogre extends Exchange {
44
44
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
45
45
  * @param {int} [limit] the maximum amount of candles to fetch
46
46
  * @param {object} [params] extra parameters specific to the exchange API endpoint
47
+ * @param {int} [params.until] timestamp of the latest candle in ms
47
48
  * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
48
49
  */
49
50
  fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
@@ -126,6 +126,7 @@ export default class tradeogre extends Exchange {
126
126
  'ticker/{market}': 1,
127
127
  'history/{market}': 1,
128
128
  'chart/{interval}/{market}/{timestamp}': 1,
129
+ 'chart/{interval}/{market}': 1,
129
130
  },
130
131
  },
131
132
  'private': {
@@ -417,15 +418,15 @@ export default class tradeogre extends Exchange {
417
418
  'ask': this.safeString(ticker, 'ask'),
418
419
  'askVolume': undefined,
419
420
  'vwap': undefined,
420
- 'open': this.safeString(ticker, 'open'),
421
- 'close': undefined,
421
+ 'open': this.safeString(ticker, 'initialprice'),
422
+ 'close': this.safeString(ticker, 'price'),
422
423
  'last': undefined,
423
424
  'previousClose': undefined,
424
425
  'change': undefined,
425
426
  'percentage': undefined,
426
427
  'average': undefined,
427
- 'baseVolume': this.safeString(ticker, 'volume'),
428
- 'quoteVolume': undefined,
428
+ 'baseVolume': undefined,
429
+ 'quoteVolume': this.safeString(ticker, 'volume'),
429
430
  'info': ticker,
430
431
  }, market);
431
432
  }
@@ -438,6 +439,7 @@ export default class tradeogre extends Exchange {
438
439
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
439
440
  * @param {int} [limit] the maximum amount of candles to fetch
440
441
  * @param {object} [params] extra parameters specific to the exchange API endpoint
442
+ * @param {int} [params.until] timestamp of the latest candle in ms
441
443
  * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
442
444
  */
443
445
  async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
@@ -447,13 +449,16 @@ export default class tradeogre extends Exchange {
447
449
  'market': market['id'],
448
450
  'interval': this.safeString(this.timeframes, timeframe, timeframe),
449
451
  };
450
- if (since === undefined) {
451
- throw new BadRequest(this.id + ' fetchOHLCV requires a since argument');
452
+ let response = undefined;
453
+ const until = this.safeInteger(params, 'until');
454
+ if (until !== undefined) {
455
+ params = this.omit(params, 'until');
456
+ request['timestamp'] = this.parseToInt(until / 1000);
457
+ response = await this.publicGetChartIntervalMarketTimestamp(this.extend(request, params));
452
458
  }
453
459
  else {
454
- request['timestamp'] = since;
460
+ response = await this.publicGetChartIntervalMarket(this.extend(request, params));
455
461
  }
456
- const response = await this.publicGetChartIntervalMarketTimestamp(this.extend(request, params));
457
462
  //
458
463
  // [
459
464
  // [
@@ -482,9 +487,9 @@ export default class tradeogre extends Exchange {
482
487
  return [
483
488
  this.safeTimestamp(ohlcv, 0),
484
489
  this.safeNumber(ohlcv, 1),
490
+ this.safeNumber(ohlcv, 2),
485
491
  this.safeNumber(ohlcv, 3),
486
492
  this.safeNumber(ohlcv, 4),
487
- this.safeNumber(ohlcv, 2),
488
493
  this.safeNumber(ohlcv, 5),
489
494
  ];
490
495
  }
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/whitebit.js';
2
- import type { TransferEntry, Balances, Currency, Int, Market, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, Num, Currencies, TradingFees, Dict, int, FundingRate, FundingRates, DepositAddress, Conversion, BorrowInterest, FundingHistory } from './base/types.js';
2
+ import type { TransferEntry, Balances, Currency, Int, Market, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, Num, Currencies, TradingFees, Dict, int, FundingRate, FundingRates, DepositAddress, Conversion, BorrowInterest, FundingHistory, Position } from './base/types.js';
3
3
  /**
4
4
  * @class whitebit
5
5
  * @augments Exchange
@@ -490,6 +490,40 @@ export default class whitebit extends Exchange {
490
490
  */
491
491
  fetchConvertTradeHistory(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Conversion[]>;
492
492
  parseConversion(conversion: Dict, fromCurrency?: Currency, toCurrency?: Currency): Conversion;
493
+ /**
494
+ * @method
495
+ * @name whitebit#fetchPositionHistory
496
+ * @description fetches historical positions
497
+ * @see https://docs.whitebit.com/private/http-trade-v4/#positions-history
498
+ * @param {string} symbol unified contract symbol
499
+ * @param {int} [since] the earliest time in ms to fetch positions for
500
+ * @param {int} [limit] the maximum amount of records to fetch
501
+ * @param {object} [params] extra parameters specific to the exchange api endpoint
502
+ * @param {int} [params.positionId] the id of the requested position
503
+ * @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
504
+ */
505
+ fetchPositionHistory(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Position[]>;
506
+ /**
507
+ * @method
508
+ * @name whitebit#fetchPositions
509
+ * @description fetch all open positions
510
+ * @see https://docs.whitebit.com/private/http-trade-v4/#open-positions
511
+ * @param {string[]} [symbols] list of unified market symbols
512
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
513
+ * @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
514
+ */
515
+ fetchPositions(symbols?: Strings, params?: {}): Promise<Position[]>;
516
+ /**
517
+ * @method
518
+ * @name whitebit#fetchPosition
519
+ * @description fetch data on a single open contract trade position
520
+ * @see https://docs.whitebit.com/private/http-trade-v4/#open-positions
521
+ * @param {string} symbol unified market symbol of the market the position is held in
522
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
523
+ * @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
524
+ */
525
+ fetchPosition(symbol: string, params?: {}): Promise<Position>;
526
+ parsePosition(position: Dict, market?: Market): Position;
493
527
  isFiat(currency: string): boolean;
494
528
  nonce(): number;
495
529
  sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {