ccxt 4.1.91 → 4.1.95

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.
@@ -45,6 +45,7 @@ class coinone extends coinone$1 {
45
45
  'fetchClosedOrders': false,
46
46
  'fetchCrossBorrowRate': false,
47
47
  'fetchCrossBorrowRates': false,
48
+ 'fetchCurrencies': true,
48
49
  'fetchDepositAddresses': true,
49
50
  'fetchFundingHistory': false,
50
51
  'fetchFundingRate': false,
@@ -81,6 +82,9 @@ class coinone extends coinone$1 {
81
82
  'logo': 'https://user-images.githubusercontent.com/1294454/38003300-adc12fba-323f-11e8-8525-725f53c4a659.jpg',
82
83
  'api': {
83
84
  'rest': 'https://api.coinone.co.kr',
85
+ 'v2Public': 'https://api.coinone.co.kr/public/v2',
86
+ 'v2Private': 'https://api.coinone.co.kr/v2',
87
+ 'v2_1Private': 'https://api.coinone.co.kr/v2.1',
84
88
  },
85
89
  'www': 'https://coinone.co.kr',
86
90
  'doc': 'https://doc.coinone.co.kr',
@@ -92,31 +96,85 @@ class coinone extends coinone$1 {
92
96
  'api': {
93
97
  'public': {
94
98
  'get': [
95
- 'orderbook/',
96
- 'trades/',
97
- 'ticker/',
99
+ 'orderbook',
100
+ 'ticker',
101
+ 'ticker_utc',
102
+ 'trades',
103
+ ],
104
+ },
105
+ 'v2Public': {
106
+ 'get': [
107
+ 'range_units',
108
+ 'markets/{quote_currency}',
109
+ 'markets/{quote_currency}/{target_currency}',
110
+ 'orderbook/{quote_currency}/{target_currency}',
111
+ 'trades/{quote_currency}/{target_currency}',
112
+ 'ticker_new/{quote_currency}',
113
+ 'ticker_new/{quote_currency}/{target_currency}',
114
+ 'ticker_utc_new/{quote_currency}',
115
+ 'ticker_utc_new/{quote_currency}/{target_currency}',
116
+ 'currencies',
117
+ 'currencies/{currency}',
118
+ 'chart/{quote_currency}/{target_currency}',
98
119
  ],
99
120
  },
100
121
  'private': {
101
122
  'post': [
102
- 'account/deposit_address/',
103
- 'account/btc_deposit_address/',
104
- 'account/balance/',
105
- 'account/daily_balance/',
106
- 'account/user_info/',
107
- 'account/virtual_account/',
108
- 'order/cancel_all/',
109
- 'order/cancel/',
110
- 'order/limit_buy/',
111
- 'order/limit_sell/',
112
- 'order/complete_orders/',
113
- 'order/limit_orders/',
114
- 'order/query_order/',
115
- 'transaction/auth_number/',
116
- 'transaction/history/',
117
- 'transaction/krw/history/',
118
- 'transaction/btc/',
119
- 'transaction/coin/',
123
+ 'account/deposit_address',
124
+ 'account/btc_deposit_address',
125
+ 'account/balance',
126
+ 'account/daily_balance',
127
+ 'account/user_info',
128
+ 'account/virtual_account',
129
+ 'order/cancel_all',
130
+ 'order/cancel',
131
+ 'order/limit_buy',
132
+ 'order/limit_sell',
133
+ 'order/complete_orders',
134
+ 'order/limit_orders',
135
+ 'order/order_info',
136
+ 'transaction/auth_number',
137
+ 'transaction/history',
138
+ 'transaction/krw/history',
139
+ 'transaction/btc',
140
+ 'transaction/coin',
141
+ ],
142
+ },
143
+ 'v2Private': {
144
+ 'post': [
145
+ 'account/balance',
146
+ 'account/deposit_address',
147
+ 'account/user_info',
148
+ 'account/virtual_account',
149
+ 'order/cancel',
150
+ 'order/limit_buy',
151
+ 'order/limit_sell',
152
+ 'order/limit_orders',
153
+ 'order/complete_orders',
154
+ 'order/query_order',
155
+ 'transaction/auth_number',
156
+ 'transaction/btc',
157
+ 'transaction/history',
158
+ 'transaction/krw/history',
159
+ ],
160
+ },
161
+ 'v2_1Private': {
162
+ 'post': [
163
+ 'account/balance/all',
164
+ 'account/balance',
165
+ 'account/trade_fee',
166
+ 'account/trade_fee/{quote_currency}/{target_currency}',
167
+ 'order/limit',
168
+ 'order/cancel',
169
+ 'order/cancel/all',
170
+ 'order/open_orders',
171
+ 'order/open_orders/all',
172
+ 'order/complete_orders',
173
+ 'order/complete_orders/all',
174
+ 'order/info',
175
+ 'transaction/krw/history',
176
+ 'transaction/coin/history',
177
+ 'transaction/coin/withdrawal/limit',
120
178
  ],
121
179
  },
122
180
  },
@@ -140,53 +198,129 @@ class coinone extends coinone$1 {
140
198
  },
141
199
  });
142
200
  }
201
+ async fetchCurrencies(params = {}) {
202
+ /**
203
+ * @method
204
+ * @name coinone#fetchCurrencies
205
+ * @description fetches all available currencies on an exchange
206
+ * @see https://docs.coinone.co.kr/reference/currencies
207
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
208
+ * @returns {object} an associative dictionary of currencies
209
+ */
210
+ const response = await this.v2PublicGetCurrencies(params);
211
+ //
212
+ // {
213
+ // "result": "success",
214
+ // "error_code": "0",
215
+ // "server_time": 1701054555578,
216
+ // "currencies": [
217
+ // {
218
+ // "name": "Polygon",
219
+ // "symbol": "MATIC",
220
+ // "deposit_status": "normal",
221
+ // "withdraw_status": "normal",
222
+ // "deposit_confirm_count": 150,
223
+ // "max_precision": 8,
224
+ // "deposit_fee": "0.0",
225
+ // "withdrawal_min_amount": "1.0",
226
+ // "withdrawal_fee": "3.0"
227
+ // }
228
+ // ]
229
+ // }
230
+ //
231
+ const result = {};
232
+ const currencies = this.safeValue(response, 'currencies', []);
233
+ for (let i = 0; i < currencies.length; i++) {
234
+ const entry = currencies[i];
235
+ const id = this.safeString(entry, 'symbol');
236
+ const name = this.safeString(entry, 'name');
237
+ const code = this.safeCurrencyCode(id);
238
+ const withdrawStatus = this.safeString(entry, 'withdraw_status', '');
239
+ const depositStatus = this.safeString(entry, 'deposit_status', '');
240
+ const isWithdrawEnabled = withdrawStatus === 'normal';
241
+ const isDepositEnabled = depositStatus === 'normal';
242
+ result[code] = {
243
+ 'id': id,
244
+ 'code': code,
245
+ 'info': entry,
246
+ 'name': name,
247
+ 'active': isWithdrawEnabled && isDepositEnabled,
248
+ 'deposit': isDepositEnabled,
249
+ 'withdraw': isWithdrawEnabled,
250
+ 'fee': this.safeNumber(entry, 'withdrawal_fee'),
251
+ 'precision': this.parseNumber(this.parsePrecision(this.safeString(entry, 'max_precision'))),
252
+ 'limits': {
253
+ 'amount': {
254
+ 'min': undefined,
255
+ 'max': undefined,
256
+ },
257
+ 'withdraw': {
258
+ 'min': this.safeNumber(entry, 'withdrawal_min_amount'),
259
+ 'max': undefined,
260
+ },
261
+ },
262
+ 'networks': {},
263
+ };
264
+ }
265
+ return result;
266
+ }
143
267
  async fetchMarkets(params = {}) {
144
268
  /**
145
269
  * @method
146
270
  * @name coinone#fetchMarkets
147
271
  * @description retrieves data on all markets for coinone
272
+ * @see https://docs.coinone.co.kr/v1.0/reference/tickers
148
273
  * @param {object} [params] extra parameters specific to the exchange API endpoint
149
274
  * @returns {object[]} an array of objects representing market data
150
275
  */
151
276
  const request = {
152
- 'currency': 'all',
277
+ 'quote_currency': 'KRW',
153
278
  };
154
- const response = await this.publicGetTicker(request);
155
- //
156
- // {
157
- // "result": "success",
158
- // "errorCode": "0",
159
- // "timestamp": "1643676668",
160
- // "xec": {
161
- // "currency": "xec",
162
- // "first": "0.0914",
163
- // "low": "0.0894",
164
- // "high": "0.096",
165
- // "last": "0.0937",
166
- // "volume": "1673283662.9797",
167
- // "yesterday_first": "0.0929",
168
- // "yesterday_low": "0.0913",
169
- // "yesterday_high": "0.0978",
170
- // "yesterday_last": "0.0913",
171
- // "yesterday_volume": "1167285865.4571"
172
- // },
173
- // ...
174
- // }
279
+ const response = await this.v2PublicGetTickerNewQuoteCurrency(request);
280
+ //
281
+ // {
282
+ // "result": "success",
283
+ // "error_code": "0",
284
+ // "server_time": 1701067923060,
285
+ // "tickers": [
286
+ // {
287
+ // "quote_currency": "krw",
288
+ // "target_currency": "stg",
289
+ // "timestamp": 1701067920001,
290
+ // "high": "667.5",
291
+ // "low": "667.5",
292
+ // "first": "667.5",
293
+ // "last": "667.5",
294
+ // "quote_volume": "0.0",
295
+ // "target_volume": "0.0",
296
+ // "best_asks": [
297
+ // {
298
+ // "price": "777.0",
299
+ // "qty": "73.9098"
300
+ // }
301
+ // ],
302
+ // "best_bids": [
303
+ // {
304
+ // "price": "690.8",
305
+ // "qty": "40.7768"
306
+ // }
307
+ // ],
308
+ // "id": "1701067920001001"
309
+ // }
310
+ // ]
311
+ // }
175
312
  //
313
+ const tickers = this.safeValue(response, 'tickers', []);
176
314
  const result = [];
177
- const quoteId = 'krw';
178
- const quote = this.safeCurrencyCode(quoteId);
179
- const baseIds = Object.keys(response);
180
- for (let i = 0; i < baseIds.length; i++) {
181
- const baseId = baseIds[i];
182
- const ticker = this.safeValue(response, baseId, {});
183
- const currency = this.safeValue(ticker, 'currency');
184
- if (currency === undefined) {
185
- continue;
186
- }
315
+ for (let i = 0; i < tickers.length; i++) {
316
+ const entry = this.safeValue(tickers, i);
317
+ const id = this.safeString(entry, 'id');
318
+ const baseId = this.safeStringUpper(entry, 'target_currency');
319
+ const quoteId = this.safeStringUpper(entry, 'quote_currency');
187
320
  const base = this.safeCurrencyCode(baseId);
321
+ const quote = this.safeCurrencyCode(quoteId);
188
322
  result.push({
189
- 'id': baseId,
323
+ 'id': id,
190
324
  'symbol': base + '/' + quote,
191
325
  'base': base,
192
326
  'quote': quote,
@@ -233,7 +367,7 @@ class coinone extends coinone$1 {
233
367
  },
234
368
  },
235
369
  'created': undefined,
236
- 'info': ticker,
370
+ 'info': entry,
237
371
  });
238
372
  }
239
373
  return result;
@@ -262,11 +396,12 @@ class coinone extends coinone$1 {
262
396
  * @method
263
397
  * @name coinone#fetchBalance
264
398
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
399
+ * @see https://docs.coinone.co.kr/v1.0/reference/v21
265
400
  * @param {object} [params] extra parameters specific to the exchange API endpoint
266
401
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
267
402
  */
268
403
  await this.loadMarkets();
269
- const response = await this.privatePostAccountBalance(params);
404
+ const response = await this.v2PrivatePostAccountBalance(params);
270
405
  return this.parseBalance(response);
271
406
  }
272
407
  async fetchOrderBook(symbol, limit = undefined, params = {}) {
@@ -274,6 +409,7 @@ class coinone extends coinone$1 {
274
409
  * @method
275
410
  * @name coinone#fetchOrderBook
276
411
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
412
+ * @see https://docs.coinone.co.kr/v1.0/reference/orderbook
277
413
  * @param {string} symbol unified symbol of the market to fetch the order book for
278
414
  * @param {int} [limit] the maximum amount of order book entries to return
279
415
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -282,18 +418,46 @@ class coinone extends coinone$1 {
282
418
  await this.loadMarkets();
283
419
  const market = this.market(symbol);
284
420
  const request = {
285
- 'currency': market['id'],
286
- 'format': 'json',
421
+ 'quote_currency': market['quote'],
422
+ 'target_currency': market['base'],
287
423
  };
288
- const response = await this.publicGetOrderbook(this.extend(request, params));
289
- const timestamp = this.safeTimestamp(response, 'timestamp');
290
- return this.parseOrderBook(response, market['symbol'], timestamp, 'bid', 'ask', 'price', 'qty');
424
+ if (limit !== undefined) {
425
+ request['size'] = limit; // only support 5, 10, 15, 16
426
+ }
427
+ const response = await this.v2PublicGetOrderbookQuoteCurrencyTargetCurrency(this.extend(request, params));
428
+ //
429
+ // {
430
+ // "result": "success",
431
+ // "error_code": "0",
432
+ // "timestamp": 1701071108673,
433
+ // "id": "1701071108673001",
434
+ // "quote_currency": "KRW",
435
+ // "target_currency": "BTC",
436
+ // "order_book_unit": "0.0",
437
+ // "bids": [
438
+ // {
439
+ // "price": "50048000",
440
+ // "qty": "0.01080229"
441
+ // }
442
+ // ],
443
+ // "asks": [
444
+ // {
445
+ // "price": "50058000",
446
+ // "qty": "0.00272592"
447
+ // }
448
+ // ]
449
+ // }
450
+ //
451
+ const timestamp = this.safeInteger(response, 'timestamp');
452
+ return this.parseOrderBook(response, market['symbol'], timestamp, 'bids', 'asks', 'price', 'qty');
291
453
  }
292
454
  async fetchTickers(symbols = undefined, params = {}) {
293
455
  /**
294
456
  * @method
295
457
  * @name coinone#fetchTickers
296
458
  * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
459
+ * @see https://docs.coinone.co.kr/v1.0/reference/tickers
460
+ * @see https://docs.coinone.co.kr/v1.0/reference/ticker
297
461
  * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
298
462
  * @param {object} [params] extra parameters specific to the exchange API endpoint
299
463
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -301,28 +465,62 @@ class coinone extends coinone$1 {
301
465
  await this.loadMarkets();
302
466
  symbols = this.marketSymbols(symbols);
303
467
  const request = {
304
- 'currency': 'all',
305
- 'format': 'json',
468
+ 'quote_currency': 'KRW',
306
469
  };
307
- const response = await this.publicGetTicker(this.extend(request, params));
308
- const result = {};
309
- const ids = Object.keys(response);
310
- const timestamp = this.safeTimestamp(response, 'timestamp');
311
- for (let i = 0; i < ids.length; i++) {
312
- const id = ids[i];
313
- const market = this.safeMarket(id);
314
- const symbol = market['symbol'];
315
- const ticker = response[id];
316
- result[symbol] = this.parseTicker(ticker, market);
317
- result[symbol]['timestamp'] = timestamp;
470
+ let market = undefined;
471
+ let response = undefined;
472
+ if (symbols !== undefined) {
473
+ const first = this.safeString(symbols, 0);
474
+ market = this.market(first);
475
+ request['quote_currency'] = market['quote'];
476
+ request['target_currency'] = market['base'];
477
+ response = await this.v2PublicGetTickerNewQuoteCurrencyTargetCurrency(this.extend(request, params));
478
+ }
479
+ else {
480
+ response = await this.v2PublicGetTickerNewQuoteCurrency(this.extend(request, params));
318
481
  }
319
- return this.filterByArrayTickers(result, 'symbol', symbols);
482
+ //
483
+ // {
484
+ // "result": "success",
485
+ // "error_code": "0",
486
+ // "server_time": 1701073358487,
487
+ // "tickers": [
488
+ // {
489
+ // "quote_currency": "krw",
490
+ // "target_currency": "btc",
491
+ // "timestamp": 1701073357818,
492
+ // "high": "50543000.0",
493
+ // "low": "49945000.0",
494
+ // "first": "50487000.0",
495
+ // "last": "50062000.0",
496
+ // "quote_volume": "11349804285.3859",
497
+ // "target_volume": "226.07268994",
498
+ // "best_asks": [
499
+ // {
500
+ // "price": "50081000.0",
501
+ // "qty": "0.18471358"
502
+ // }
503
+ // ],
504
+ // "best_bids": [
505
+ // {
506
+ // "price": "50062000.0",
507
+ // "qty": "0.04213455"
508
+ // }
509
+ // ],
510
+ // "id": "1701073357818001"
511
+ // }
512
+ // ]
513
+ // }
514
+ //
515
+ const data = this.safeValue(response, 'tickers', []);
516
+ return this.parseTickers(data, symbols);
320
517
  }
321
518
  async fetchTicker(symbol, params = {}) {
322
519
  /**
323
520
  * @method
324
521
  * @name coinone#fetchTicker
325
522
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
523
+ * @see https://docs.coinone.co.kr/v1.0/reference/ticker
326
524
  * @param {string} symbol unified symbol of the market to fetch the ticker for
327
525
  * @param {object} [params] extra parameters specific to the exchange API endpoint
328
526
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -330,53 +528,102 @@ class coinone extends coinone$1 {
330
528
  await this.loadMarkets();
331
529
  const market = this.market(symbol);
332
530
  const request = {
333
- 'currency': market['id'],
334
- 'format': 'json',
531
+ 'quote_currency': market['quote'],
532
+ 'target_currency': market['base'],
335
533
  };
336
- const response = await this.publicGetTicker(this.extend(request, params));
337
- return this.parseTicker(response, market);
534
+ const response = await this.v2PublicGetTickerNewQuoteCurrencyTargetCurrency(this.extend(request, params));
535
+ //
536
+ // {
537
+ // "result": "success",
538
+ // "error_code": "0",
539
+ // "server_time": 1701073358487,
540
+ // "tickers": [
541
+ // {
542
+ // "quote_currency": "krw",
543
+ // "target_currency": "btc",
544
+ // "timestamp": 1701073357818,
545
+ // "high": "50543000.0",
546
+ // "low": "49945000.0",
547
+ // "first": "50487000.0",
548
+ // "last": "50062000.0",
549
+ // "quote_volume": "11349804285.3859",
550
+ // "target_volume": "226.07268994",
551
+ // "best_asks": [
552
+ // {
553
+ // "price": "50081000.0",
554
+ // "qty": "0.18471358"
555
+ // }
556
+ // ],
557
+ // "best_bids": [
558
+ // {
559
+ // "price": "50062000.0",
560
+ // "qty": "0.04213455"
561
+ // }
562
+ // ],
563
+ // "id": "1701073357818001"
564
+ // }
565
+ // ]
566
+ // }
567
+ //
568
+ const data = this.safeValue(response, 'tickers', []);
569
+ const ticker = this.safeValue(data, 0, {});
570
+ return this.parseTicker(ticker, market);
338
571
  }
339
572
  parseTicker(ticker, market = undefined) {
340
573
  //
341
574
  // {
342
- // "currency":"xec",
343
- // "first":"0.1069",
344
- // "low":"0.09",
345
- // "high":"0.1069",
346
- // "last":"0.0911",
347
- // "volume":"4591217267.4974",
348
- // "yesterday_first":"0.1128",
349
- // "yesterday_low":"0.1035",
350
- // "yesterday_high":"0.1167",
351
- // "yesterday_last":"0.1069",
352
- // "yesterday_volume":"4014832231.5102"
575
+ // "quote_currency": "krw",
576
+ // "target_currency": "btc",
577
+ // "timestamp": 1701073357818,
578
+ // "high": "50543000.0",
579
+ // "low": "49945000.0",
580
+ // "first": "50487000.0",
581
+ // "last": "50062000.0",
582
+ // "quote_volume": "11349804285.3859",
583
+ // "target_volume": "226.07268994",
584
+ // "best_asks": [
585
+ // {
586
+ // "price": "50081000.0",
587
+ // "qty": "0.18471358"
588
+ // }
589
+ // ],
590
+ // "best_bids": [
591
+ // {
592
+ // "price": "50062000.0",
593
+ // "qty": "0.04213455"
594
+ // }
595
+ // ],
596
+ // "id": "1701073357818001"
353
597
  // }
354
598
  //
355
- const timestamp = this.safeTimestamp(ticker, 'timestamp');
356
- const open = this.safeString(ticker, 'first');
599
+ const timestamp = this.safeInteger(ticker, 'timestamp');
357
600
  const last = this.safeString(ticker, 'last');
358
- const previousClose = this.safeString(ticker, 'yesterday_last');
359
- const symbol = this.safeSymbol(undefined, market);
601
+ const asks = this.safeValue(ticker, 'best_asks');
602
+ const bids = this.safeValue(ticker, 'best_bids');
603
+ const baseId = this.safeString(ticker, 'target_currency');
604
+ const quoteId = this.safeString(ticker, 'quote_currency');
605
+ const base = this.safeCurrencyCode(baseId);
606
+ const quote = this.safeCurrencyCode(quoteId);
360
607
  return this.safeTicker({
361
- 'symbol': symbol,
608
+ 'symbol': base + '/' + quote,
362
609
  'timestamp': timestamp,
363
610
  'datetime': this.iso8601(timestamp),
364
611
  'high': this.safeString(ticker, 'high'),
365
612
  'low': this.safeString(ticker, 'low'),
366
- 'bid': undefined,
367
- 'bidVolume': undefined,
368
- 'ask': undefined,
369
- 'askVolume': undefined,
613
+ 'bid': this.safeString(bids, 'price'),
614
+ 'bidVolume': this.safeString(bids, 'qty'),
615
+ 'ask': this.safeString(asks, 'price'),
616
+ 'askVolume': this.safeString(asks, 'qty'),
370
617
  'vwap': undefined,
371
- 'open': open,
618
+ 'open': this.safeString(ticker, 'first'),
372
619
  'close': last,
373
620
  'last': last,
374
- 'previousClose': previousClose,
621
+ 'previousClose': undefined,
375
622
  'change': undefined,
376
623
  'percentage': undefined,
377
624
  'average': undefined,
378
- 'baseVolume': this.safeString(ticker, 'volume'),
379
- 'quoteVolume': undefined,
625
+ 'baseVolume': this.safeString(ticker, 'target_volume'),
626
+ 'quoteVolume': this.safeString(ticker, 'quote_volume'),
380
627
  'info': ticker,
381
628
  }, market);
382
629
  }
@@ -385,10 +632,11 @@ class coinone extends coinone$1 {
385
632
  // fetchTrades (public)
386
633
  //
387
634
  // {
388
- // "timestamp": "1416893212",
389
- // "price": "420000.0",
390
- // "qty": "0.1",
391
- // "is_ask": "1"
635
+ // "id": "1701075265708001",
636
+ // "timestamp": 1701075265708,
637
+ // "price": "50020000",
638
+ // "qty": "0.00155177",
639
+ // "is_seller_maker": false
392
640
  // }
393
641
  //
394
642
  // fetchMyTrades (private)
@@ -403,25 +651,12 @@ class coinone extends coinone$1 {
403
651
  // "orderId": "E84A1AC2-8088-4FA0-B093-A3BCDB9B3C85"
404
652
  // }
405
653
  //
406
- const timestamp = this.safeTimestamp(trade, 'timestamp');
654
+ const timestamp = this.safeInteger(trade, 'timestamp');
407
655
  market = this.safeMarket(undefined, market);
408
- const is_ask = this.safeString(trade, 'is_ask');
409
- let side = this.safeString(trade, 'type');
410
- if (is_ask !== undefined) {
411
- if (is_ask === '1') {
412
- side = 'sell';
413
- }
414
- else if (is_ask === '0') {
415
- side = 'buy';
416
- }
417
- }
418
- else {
419
- if (side === 'ask') {
420
- side = 'sell';
421
- }
422
- else if (side === 'bid') {
423
- side = 'buy';
424
- }
656
+ const isSellerMaker = this.safeValue(trade, 'is_seller_maker');
657
+ let side = undefined;
658
+ if (isSellerMaker !== undefined) {
659
+ side = isSellerMaker ? 'sell' : 'buy';
425
660
  }
426
661
  const priceString = this.safeString(trade, 'price');
427
662
  const amountString = this.safeString(trade, 'qty');
@@ -460,6 +695,7 @@ class coinone extends coinone$1 {
460
695
  * @method
461
696
  * @name coinone#fetchTrades
462
697
  * @description get the list of most recent trades for a particular symbol
698
+ * @see https://docs.coinone.co.kr/v1.0/reference/recent-completed-orders
463
699
  * @param {string} symbol unified symbol of the market to fetch trades for
464
700
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
465
701
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -469,28 +705,33 @@ class coinone extends coinone$1 {
469
705
  await this.loadMarkets();
470
706
  const market = this.market(symbol);
471
707
  const request = {
472
- 'currency': market['id'],
473
- 'format': 'json',
708
+ 'quote_currency': market['quote'],
709
+ 'target_currency': market['base'],
474
710
  };
475
- const response = await this.publicGetTrades(this.extend(request, params));
711
+ if (limit !== undefined) {
712
+ request['size'] = limit; // only support 10, 50, 100, 150, 200
713
+ }
714
+ const response = await this.v2PublicGetTradesQuoteCurrencyTargetCurrency(this.extend(request, params));
476
715
  //
477
716
  // {
478
717
  // "result": "success",
479
- // "errorCode": "0",
480
- // "timestamp": "1416895635",
481
- // "currency": "btc",
482
- // "completeOrders": [
718
+ // "error_code": "0",
719
+ // "server_time": 1701075315771,
720
+ // "quote_currency": "KRW",
721
+ // "target_currency": "BTC",
722
+ // "transactions": [
483
723
  // {
484
- // "timestamp": "1416893212",
485
- // "price": "420000.0",
486
- // "qty": "0.1",
487
- // "is_ask": "1"
724
+ // "id": "1701075265708001",
725
+ // "timestamp": 1701075265708,
726
+ // "price": "50020000",
727
+ // "qty": "0.00155177",
728
+ // "is_seller_maker": false
488
729
  // }
489
730
  // ]
490
731
  // }
491
732
  //
492
- const completeOrders = this.safeValue(response, 'completeOrders', []);
493
- return this.parseTrades(completeOrders, market, since, limit);
733
+ const data = this.safeValue(response, 'transactions', []);
734
+ return this.parseTrades(data, market, since, limit);
494
735
  }
495
736
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
496
737
  /**
@@ -546,7 +787,7 @@ class coinone extends coinone$1 {
546
787
  'order_id': id,
547
788
  'currency': market['id'],
548
789
  };
549
- const response = await this.privatePostOrderQueryOrder(this.extend(request, params));
790
+ const response = await this.v2PrivatePostOrderQueryOrder(this.extend(request, params));
550
791
  //
551
792
  // {
552
793
  // "result": "success",
@@ -757,7 +998,7 @@ class coinone extends coinone$1 {
757
998
  const request = {
758
999
  'currency': market['id'],
759
1000
  };
760
- const response = await this.privatePostOrderCompleteOrders(this.extend(request, params));
1001
+ const response = await this.v2PrivatePostOrderCompleteOrders(this.extend(request, params));
761
1002
  //
762
1003
  // despite the name of the endpoint it returns trades which may have a duplicate orderId
763
1004
  // https://github.com/ccxt/ccxt/pull/7067
@@ -810,7 +1051,7 @@ class coinone extends coinone$1 {
810
1051
  'is_ask': isAsk,
811
1052
  'currency': this.marketId(symbol),
812
1053
  };
813
- const response = await this.privatePostOrderCancel(this.extend(request, params));
1054
+ const response = await this.v2PrivatePostOrderCancel(this.extend(request, params));
814
1055
  //
815
1056
  // {
816
1057
  // "result": "success",
@@ -829,7 +1070,7 @@ class coinone extends coinone$1 {
829
1070
  * @returns {object} a list of [address structures]{@link https://docs.ccxt.com/#/?id=address-structure}
830
1071
  */
831
1072
  await this.loadMarkets();
832
- const response = await this.privatePostAccountDepositAddress(params);
1073
+ const response = await this.v2PrivatePostAccountDepositAddress(params);
833
1074
  //
834
1075
  // {
835
1076
  // "result": "success",
@@ -882,6 +1123,16 @@ class coinone extends coinone$1 {
882
1123
  const request = this.implodeParams(path, params);
883
1124
  const query = this.omit(params, this.extractParams(path));
884
1125
  let url = this.urls['api']['rest'] + '/';
1126
+ if (api === 'v2Public') {
1127
+ url = this.urls['api']['v2Public'] + '/';
1128
+ api = 'public';
1129
+ }
1130
+ else if (api === 'v2Private') {
1131
+ url = this.urls['api']['v2Private'] + '/';
1132
+ }
1133
+ else if (api === 'v2_1Private') {
1134
+ url = this.urls['api']['v2_1Private'] + '/';
1135
+ }
885
1136
  if (api === 'public') {
886
1137
  url += request;
887
1138
  if (Object.keys(query).length) {
@@ -890,7 +1141,7 @@ class coinone extends coinone$1 {
890
1141
  }
891
1142
  else {
892
1143
  this.checkRequiredCredentials();
893
- url += this.version + '/' + request;
1144
+ url += request;
894
1145
  const nonce = this.nonce().toString();
895
1146
  const json = this.json(this.extend({
896
1147
  'access_token': this.apiKey,