ccxt 4.1.91__py2.py3-none-any.whl → 4.1.95__py2.py3-none-any.whl

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.
@@ -52,6 +52,7 @@ class coinone(Exchange, ImplicitAPI):
52
52
  'fetchClosedOrders': False, # the endpoint that should return closed orders actually returns trades, https://github.com/ccxt/ccxt/pull/7067
53
53
  'fetchCrossBorrowRate': False,
54
54
  'fetchCrossBorrowRates': False,
55
+ 'fetchCurrencies': True,
55
56
  'fetchDepositAddresses': True,
56
57
  'fetchFundingHistory': False,
57
58
  'fetchFundingRate': False,
@@ -88,6 +89,9 @@ class coinone(Exchange, ImplicitAPI):
88
89
  'logo': 'https://user-images.githubusercontent.com/1294454/38003300-adc12fba-323f-11e8-8525-725f53c4a659.jpg',
89
90
  'api': {
90
91
  'rest': 'https://api.coinone.co.kr',
92
+ 'v2Public': 'https://api.coinone.co.kr/public/v2',
93
+ 'v2Private': 'https://api.coinone.co.kr/v2',
94
+ 'v2_1Private': 'https://api.coinone.co.kr/v2.1',
91
95
  },
92
96
  'www': 'https://coinone.co.kr',
93
97
  'doc': 'https://doc.coinone.co.kr',
@@ -99,31 +103,85 @@ class coinone(Exchange, ImplicitAPI):
99
103
  'api': {
100
104
  'public': {
101
105
  'get': [
102
- 'orderbook/',
103
- 'trades/',
104
- 'ticker/',
106
+ 'orderbook',
107
+ 'ticker',
108
+ 'ticker_utc',
109
+ 'trades',
110
+ ],
111
+ },
112
+ 'v2Public': {
113
+ 'get': [
114
+ 'range_units',
115
+ 'markets/{quote_currency}',
116
+ 'markets/{quote_currency}/{target_currency}',
117
+ 'orderbook/{quote_currency}/{target_currency}',
118
+ 'trades/{quote_currency}/{target_currency}',
119
+ 'ticker_new/{quote_currency}',
120
+ 'ticker_new/{quote_currency}/{target_currency}',
121
+ 'ticker_utc_new/{quote_currency}',
122
+ 'ticker_utc_new/{quote_currency}/{target_currency}',
123
+ 'currencies',
124
+ 'currencies/{currency}',
125
+ 'chart/{quote_currency}/{target_currency}',
105
126
  ],
106
127
  },
107
128
  'private': {
108
129
  'post': [
109
- 'account/deposit_address/',
110
- 'account/btc_deposit_address/',
111
- 'account/balance/',
112
- 'account/daily_balance/',
113
- 'account/user_info/',
114
- 'account/virtual_account/',
115
- 'order/cancel_all/',
116
- 'order/cancel/',
117
- 'order/limit_buy/',
118
- 'order/limit_sell/',
119
- 'order/complete_orders/',
120
- 'order/limit_orders/',
121
- 'order/query_order/',
122
- 'transaction/auth_number/',
123
- 'transaction/history/',
124
- 'transaction/krw/history/',
125
- 'transaction/btc/',
126
- 'transaction/coin/',
130
+ 'account/deposit_address',
131
+ 'account/btc_deposit_address',
132
+ 'account/balance',
133
+ 'account/daily_balance',
134
+ 'account/user_info',
135
+ 'account/virtual_account',
136
+ 'order/cancel_all',
137
+ 'order/cancel',
138
+ 'order/limit_buy',
139
+ 'order/limit_sell',
140
+ 'order/complete_orders',
141
+ 'order/limit_orders',
142
+ 'order/order_info',
143
+ 'transaction/auth_number',
144
+ 'transaction/history',
145
+ 'transaction/krw/history',
146
+ 'transaction/btc',
147
+ 'transaction/coin',
148
+ ],
149
+ },
150
+ 'v2Private': {
151
+ 'post': [
152
+ 'account/balance',
153
+ 'account/deposit_address',
154
+ 'account/user_info',
155
+ 'account/virtual_account',
156
+ 'order/cancel',
157
+ 'order/limit_buy',
158
+ 'order/limit_sell',
159
+ 'order/limit_orders',
160
+ 'order/complete_orders',
161
+ 'order/query_order',
162
+ 'transaction/auth_number',
163
+ 'transaction/btc',
164
+ 'transaction/history',
165
+ 'transaction/krw/history',
166
+ ],
167
+ },
168
+ 'v2_1Private': {
169
+ 'post': [
170
+ 'account/balance/all',
171
+ 'account/balance',
172
+ 'account/trade_fee',
173
+ 'account/trade_fee/{quote_currency}/{target_currency}',
174
+ 'order/limit',
175
+ 'order/cancel',
176
+ 'order/cancel/all',
177
+ 'order/open_orders',
178
+ 'order/open_orders/all',
179
+ 'order/complete_orders',
180
+ 'order/complete_orders/all',
181
+ 'order/info',
182
+ 'transaction/krw/history',
183
+ 'transaction/coin/history',
184
+ 'transaction/coin/withdrawal/limit',
127
185
  ],
128
186
  },
129
187
  },
@@ -147,50 +205,124 @@ class coinone(Exchange, ImplicitAPI):
147
205
  },
148
206
  })
149
207
 
208
+ async def fetch_currencies(self, params={}):
209
+ """
210
+ fetches all available currencies on an exchange
211
+ :see: https://docs.coinone.co.kr/reference/currencies
212
+ :param dict [params]: extra parameters specific to the exchange API endpoint
213
+ :returns dict: an associative dictionary of currencies
214
+ """
215
+ response = await self.v2PublicGetCurrencies(params)
216
+ #
217
+ # {
218
+ # "result": "success",
219
+ # "error_code": "0",
220
+ # "server_time": 1701054555578,
221
+ # "currencies": [
222
+ # {
223
+ # "name": "Polygon",
224
+ # "symbol": "MATIC",
225
+ # "deposit_status": "normal",
226
+ # "withdraw_status": "normal",
227
+ # "deposit_confirm_count": 150,
228
+ # "max_precision": 8,
229
+ # "deposit_fee": "0.0",
230
+ # "withdrawal_min_amount": "1.0",
231
+ # "withdrawal_fee": "3.0"
232
+ # }
233
+ # ]
234
+ # }
235
+ #
236
+ result = {}
237
+ currencies = self.safe_value(response, 'currencies', [])
238
+ for i in range(0, len(currencies)):
239
+ entry = currencies[i]
240
+ id = self.safe_string(entry, 'symbol')
241
+ name = self.safe_string(entry, 'name')
242
+ code = self.safe_currency_code(id)
243
+ withdrawStatus = self.safe_string(entry, 'withdraw_status', '')
244
+ depositStatus = self.safe_string(entry, 'deposit_status', '')
245
+ isWithdrawEnabled = withdrawStatus == 'normal'
246
+ isDepositEnabled = depositStatus == 'normal'
247
+ result[code] = {
248
+ 'id': id,
249
+ 'code': code,
250
+ 'info': entry,
251
+ 'name': name,
252
+ 'active': isWithdrawEnabled and isDepositEnabled,
253
+ 'deposit': isDepositEnabled,
254
+ 'withdraw': isWithdrawEnabled,
255
+ 'fee': self.safe_number(entry, 'withdrawal_fee'),
256
+ 'precision': self.parse_number(self.parse_precision(self.safe_string(entry, 'max_precision'))),
257
+ 'limits': {
258
+ 'amount': {
259
+ 'min': None,
260
+ 'max': None,
261
+ },
262
+ 'withdraw': {
263
+ 'min': self.safe_number(entry, 'withdrawal_min_amount'),
264
+ 'max': None,
265
+ },
266
+ },
267
+ 'networks': {},
268
+ }
269
+ return result
270
+
150
271
  async def fetch_markets(self, params={}):
151
272
  """
152
273
  retrieves data on all markets for coinone
274
+ :see: https://docs.coinone.co.kr/v1.0/reference/tickers
153
275
  :param dict [params]: extra parameters specific to the exchange API endpoint
154
276
  :returns dict[]: an array of objects representing market data
155
277
  """
156
278
  request = {
157
- 'currency': 'all',
279
+ 'quote_currency': 'KRW',
158
280
  }
159
- response = await self.publicGetTicker(request)
160
- #
161
- # {
162
- # "result": "success",
163
- # "errorCode": "0",
164
- # "timestamp": "1643676668",
165
- # "xec": {
166
- # "currency": "xec",
167
- # "first": "0.0914",
168
- # "low": "0.0894",
169
- # "high": "0.096",
170
- # "last": "0.0937",
171
- # "volume": "1673283662.9797",
172
- # "yesterday_first": "0.0929",
173
- # "yesterday_low": "0.0913",
174
- # "yesterday_high": "0.0978",
175
- # "yesterday_last": "0.0913",
176
- # "yesterday_volume": "1167285865.4571"
177
- # },
178
- # ...
179
- # }
281
+ response = await self.v2PublicGetTickerNewQuoteCurrency(request)
180
282
  #
283
+ # {
284
+ # "result": "success",
285
+ # "error_code": "0",
286
+ # "server_time": 1701067923060,
287
+ # "tickers": [
288
+ # {
289
+ # "quote_currency": "krw",
290
+ # "target_currency": "stg",
291
+ # "timestamp": 1701067920001,
292
+ # "high": "667.5",
293
+ # "low": "667.5",
294
+ # "first": "667.5",
295
+ # "last": "667.5",
296
+ # "quote_volume": "0.0",
297
+ # "target_volume": "0.0",
298
+ # "best_asks": [
299
+ # {
300
+ # "price": "777.0",
301
+ # "qty": "73.9098"
302
+ # }
303
+ # ],
304
+ # "best_bids": [
305
+ # {
306
+ # "price": "690.8",
307
+ # "qty": "40.7768"
308
+ # }
309
+ # ],
310
+ # "id": "1701067920001001"
311
+ # }
312
+ # ]
313
+ # }
314
+ #
315
+ tickers = self.safe_value(response, 'tickers', [])
181
316
  result = []
182
- quoteId = 'krw'
183
- quote = self.safe_currency_code(quoteId)
184
- baseIds = list(response.keys())
185
- for i in range(0, len(baseIds)):
186
- baseId = baseIds[i]
187
- ticker = self.safe_value(response, baseId, {})
188
- currency = self.safe_value(ticker, 'currency')
189
- if currency is None:
190
- continue
317
+ for i in range(0, len(tickers)):
318
+ entry = self.safe_value(tickers, i)
319
+ id = self.safe_string(entry, 'id')
320
+ baseId = self.safe_string_upper(entry, 'target_currency')
321
+ quoteId = self.safe_string_upper(entry, 'quote_currency')
191
322
  base = self.safe_currency_code(baseId)
323
+ quote = self.safe_currency_code(quoteId)
192
324
  result.append({
193
- 'id': baseId,
325
+ 'id': id,
194
326
  'symbol': base + '/' + quote,
195
327
  'base': base,
196
328
  'quote': quote,
@@ -237,7 +369,7 @@ class coinone(Exchange, ImplicitAPI):
237
369
  },
238
370
  },
239
371
  'created': None,
240
- 'info': ticker,
372
+ 'info': entry,
241
373
  })
242
374
  return result
243
375
 
@@ -262,16 +394,18 @@ class coinone(Exchange, ImplicitAPI):
262
394
  async def fetch_balance(self, params={}) -> Balances:
263
395
  """
264
396
  query for balance and get the amount of funds available for trading or funds locked in orders
397
+ :see: https://docs.coinone.co.kr/v1.0/reference/v21
265
398
  :param dict [params]: extra parameters specific to the exchange API endpoint
266
399
  :returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
267
400
  """
268
401
  await self.load_markets()
269
- response = await self.privatePostAccountBalance(params)
402
+ response = await self.v2PrivatePostAccountBalance(params)
270
403
  return self.parse_balance(response)
271
404
 
272
405
  async def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
273
406
  """
274
407
  fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
408
+ :see: https://docs.coinone.co.kr/v1.0/reference/orderbook
275
409
  :param str symbol: unified symbol of the market to fetch the order book for
276
410
  :param int [limit]: the maximum amount of order book entries to return
277
411
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -280,16 +414,43 @@ class coinone(Exchange, ImplicitAPI):
280
414
  await self.load_markets()
281
415
  market = self.market(symbol)
282
416
  request = {
283
- 'currency': market['id'],
284
- 'format': 'json',
417
+ 'quote_currency': market['quote'],
418
+ 'target_currency': market['base'],
285
419
  }
286
- response = await self.publicGetOrderbook(self.extend(request, params))
287
- timestamp = self.safe_timestamp(response, 'timestamp')
288
- return self.parse_order_book(response, market['symbol'], timestamp, 'bid', 'ask', 'price', 'qty')
420
+ if limit is not None:
421
+ request['size'] = limit # only support 5, 10, 15, 16
422
+ response = await self.v2PublicGetOrderbookQuoteCurrencyTargetCurrency(self.extend(request, params))
423
+ #
424
+ # {
425
+ # "result": "success",
426
+ # "error_code": "0",
427
+ # "timestamp": 1701071108673,
428
+ # "id": "1701071108673001",
429
+ # "quote_currency": "KRW",
430
+ # "target_currency": "BTC",
431
+ # "order_book_unit": "0.0",
432
+ # "bids": [
433
+ # {
434
+ # "price": "50048000",
435
+ # "qty": "0.01080229"
436
+ # }
437
+ # ],
438
+ # "asks": [
439
+ # {
440
+ # "price": "50058000",
441
+ # "qty": "0.00272592"
442
+ # }
443
+ # ]
444
+ # }
445
+ #
446
+ timestamp = self.safe_integer(response, 'timestamp')
447
+ return self.parse_order_book(response, market['symbol'], timestamp, 'bids', 'asks', 'price', 'qty')
289
448
 
290
449
  async def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
291
450
  """
292
451
  fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
452
+ :see: https://docs.coinone.co.kr/v1.0/reference/tickers
453
+ :see: https://docs.coinone.co.kr/v1.0/reference/ticker
293
454
  :param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
294
455
  :param dict [params]: extra parameters specific to the exchange API endpoint
295
456
  :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
@@ -297,25 +458,58 @@ class coinone(Exchange, ImplicitAPI):
297
458
  await self.load_markets()
298
459
  symbols = self.market_symbols(symbols)
299
460
  request = {
300
- 'currency': 'all',
301
- 'format': 'json',
461
+ 'quote_currency': 'KRW',
302
462
  }
303
- response = await self.publicGetTicker(self.extend(request, params))
304
- result = {}
305
- ids = list(response.keys())
306
- timestamp = self.safe_timestamp(response, 'timestamp')
307
- for i in range(0, len(ids)):
308
- id = ids[i]
309
- market = self.safe_market(id)
310
- symbol = market['symbol']
311
- ticker = response[id]
312
- result[symbol] = self.parse_ticker(ticker, market)
313
- result[symbol]['timestamp'] = timestamp
314
- return self.filter_by_array_tickers(result, 'symbol', symbols)
463
+ market = None
464
+ response = None
465
+ if symbols is not None:
466
+ first = self.safe_string(symbols, 0)
467
+ market = self.market(first)
468
+ request['quote_currency'] = market['quote']
469
+ request['target_currency'] = market['base']
470
+ response = await self.v2PublicGetTickerNewQuoteCurrencyTargetCurrency(self.extend(request, params))
471
+ else:
472
+ response = await self.v2PublicGetTickerNewQuoteCurrency(self.extend(request, params))
473
+ #
474
+ # {
475
+ # "result": "success",
476
+ # "error_code": "0",
477
+ # "server_time": 1701073358487,
478
+ # "tickers": [
479
+ # {
480
+ # "quote_currency": "krw",
481
+ # "target_currency": "btc",
482
+ # "timestamp": 1701073357818,
483
+ # "high": "50543000.0",
484
+ # "low": "49945000.0",
485
+ # "first": "50487000.0",
486
+ # "last": "50062000.0",
487
+ # "quote_volume": "11349804285.3859",
488
+ # "target_volume": "226.07268994",
489
+ # "best_asks": [
490
+ # {
491
+ # "price": "50081000.0",
492
+ # "qty": "0.18471358"
493
+ # }
494
+ # ],
495
+ # "best_bids": [
496
+ # {
497
+ # "price": "50062000.0",
498
+ # "qty": "0.04213455"
499
+ # }
500
+ # ],
501
+ # "id": "1701073357818001"
502
+ # }
503
+ # ]
504
+ # }
505
+ #
506
+ data = self.safe_value(response, 'tickers', [])
507
+ return self.parse_tickers(data, symbols)
315
508
 
316
509
  async def fetch_ticker(self, symbol: str, params={}) -> Ticker:
317
510
  """
318
511
  fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
512
+ :see: https://docs.coinone.co.kr/v1.0/reference/ticker
319
513
  :param str symbol: unified symbol of the market to fetch the ticker for
320
514
  :param dict [params]: extra parameters specific to the exchange API endpoint
321
515
  :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
@@ -323,53 +517,102 @@ class coinone(Exchange, ImplicitAPI):
323
517
  await self.load_markets()
324
518
  market = self.market(symbol)
325
519
  request = {
326
- 'currency': market['id'],
327
- 'format': 'json',
520
+ 'quote_currency': market['quote'],
521
+ 'target_currency': market['base'],
328
522
  }
329
- response = await self.publicGetTicker(self.extend(request, params))
330
- return self.parse_ticker(response, market)
523
+ response = await self.v2PublicGetTickerNewQuoteCurrencyTargetCurrency(self.extend(request, params))
524
+ #
525
+ # {
526
+ # "result": "success",
527
+ # "error_code": "0",
528
+ # "server_time": 1701073358487,
529
+ # "tickers": [
530
+ # {
531
+ # "quote_currency": "krw",
532
+ # "target_currency": "btc",
533
+ # "timestamp": 1701073357818,
534
+ # "high": "50543000.0",
535
+ # "low": "49945000.0",
536
+ # "first": "50487000.0",
537
+ # "last": "50062000.0",
538
+ # "quote_volume": "11349804285.3859",
539
+ # "target_volume": "226.07268994",
540
+ # "best_asks": [
541
+ # {
542
+ # "price": "50081000.0",
543
+ # "qty": "0.18471358"
544
+ # }
545
+ # ],
546
+ # "best_bids": [
547
+ # {
548
+ # "price": "50062000.0",
549
+ # "qty": "0.04213455"
550
+ # }
551
+ # ],
552
+ # "id": "1701073357818001"
553
+ # }
554
+ # ]
555
+ # }
556
+ #
557
+ data = self.safe_value(response, 'tickers', [])
558
+ ticker = self.safe_value(data, 0, {})
559
+ return self.parse_ticker(ticker, market)
331
560
 
332
561
  def parse_ticker(self, ticker, market: Market = None) -> Ticker:
333
562
  #
334
563
  # {
335
- # "currency":"xec",
336
- # "first":"0.1069",
337
- # "low":"0.09",
338
- # "high":"0.1069",
339
- # "last":"0.0911",
340
- # "volume":"4591217267.4974",
341
- # "yesterday_first":"0.1128",
342
- # "yesterday_low":"0.1035",
343
- # "yesterday_high":"0.1167",
344
- # "yesterday_last":"0.1069",
345
- # "yesterday_volume":"4014832231.5102"
564
+ # "quote_currency": "krw",
565
+ # "target_currency": "btc",
566
+ # "timestamp": 1701073357818,
567
+ # "high": "50543000.0",
568
+ # "low": "49945000.0",
569
+ # "first": "50487000.0",
570
+ # "last": "50062000.0",
571
+ # "quote_volume": "11349804285.3859",
572
+ # "target_volume": "226.07268994",
573
+ # "best_asks": [
574
+ # {
575
+ # "price": "50081000.0",
576
+ # "qty": "0.18471358"
577
+ # }
578
+ # ],
579
+ # "best_bids": [
580
+ # {
581
+ # "price": "50062000.0",
582
+ # "qty": "0.04213455"
583
+ # }
584
+ # ],
585
+ # "id": "1701073357818001"
346
586
  # }
347
587
  #
348
- timestamp = self.safe_timestamp(ticker, 'timestamp')
349
- open = self.safe_string(ticker, 'first')
588
+ timestamp = self.safe_integer(ticker, 'timestamp')
350
589
  last = self.safe_string(ticker, 'last')
351
- previousClose = self.safe_string(ticker, 'yesterday_last')
352
- symbol = self.safe_symbol(None, market)
590
+ asks = self.safe_value(ticker, 'best_asks')
591
+ bids = self.safe_value(ticker, 'best_bids')
592
+ baseId = self.safe_string(ticker, 'target_currency')
593
+ quoteId = self.safe_string(ticker, 'quote_currency')
594
+ base = self.safe_currency_code(baseId)
595
+ quote = self.safe_currency_code(quoteId)
353
596
  return self.safe_ticker({
354
- 'symbol': symbol,
597
+ 'symbol': base + '/' + quote,
355
598
  'timestamp': timestamp,
356
599
  'datetime': self.iso8601(timestamp),
357
600
  'high': self.safe_string(ticker, 'high'),
358
601
  'low': self.safe_string(ticker, 'low'),
359
- 'bid': None,
360
- 'bidVolume': None,
361
- 'ask': None,
362
- 'askVolume': None,
602
+ 'bid': self.safe_string(bids, 'price'),
603
+ 'bidVolume': self.safe_string(bids, 'qty'),
604
+ 'ask': self.safe_string(asks, 'price'),
605
+ 'askVolume': self.safe_string(asks, 'qty'),
363
606
  'vwap': None,
364
- 'open': open,
607
+ 'open': self.safe_string(ticker, 'first'),
365
608
  'close': last,
366
609
  'last': last,
367
- 'previousClose': previousClose,
610
+ 'previousClose': None,
368
611
  'change': None,
369
612
  'percentage': None,
370
613
  'average': None,
371
- 'baseVolume': self.safe_string(ticker, 'volume'),
372
- 'quoteVolume': None,
614
+ 'baseVolume': self.safe_string(ticker, 'target_volume'),
615
+ 'quoteVolume': self.safe_string(ticker, 'quote_volume'),
373
616
  'info': ticker,
374
617
  }, market)
375
618
 
@@ -378,10 +621,11 @@ class coinone(Exchange, ImplicitAPI):
378
621
  # fetchTrades(public)
379
622
  #
380
623
  # {
381
- # "timestamp": "1416893212",
382
- # "price": "420000.0",
383
- # "qty": "0.1",
384
- # "is_ask": "1"
624
+ # "id": "1701075265708001",
625
+ # "timestamp": 1701075265708,
626
+ # "price": "50020000",
627
+ # "qty": "0.00155177",
628
+ # "is_seller_maker": False
385
629
  # }
386
630
  #
387
631
  # fetchMyTrades(private)
@@ -396,20 +640,12 @@ class coinone(Exchange, ImplicitAPI):
396
640
  # "orderId": "E84A1AC2-8088-4FA0-B093-A3BCDB9B3C85"
397
641
  # }
398
642
  #
399
- timestamp = self.safe_timestamp(trade, 'timestamp')
643
+ timestamp = self.safe_integer(trade, 'timestamp')
400
644
  market = self.safe_market(None, market)
401
- is_ask = self.safe_string(trade, 'is_ask')
402
- side = self.safe_string(trade, 'type')
403
- if is_ask is not None:
404
- if is_ask == '1':
405
- side = 'sell'
406
- elif is_ask == '0':
407
- side = 'buy'
408
- else:
409
- if side == 'ask':
410
- side = 'sell'
411
- elif side == 'bid':
412
- side = 'buy'
645
+ isSellerMaker = self.safe_value(trade, 'is_seller_maker')
646
+ side = None
647
+ if isSellerMaker is not None:
648
+ side = 'sell' if isSellerMaker else 'buy'
413
649
  priceString = self.safe_string(trade, 'price')
414
650
  amountString = self.safe_string(trade, 'qty')
415
651
  orderId = self.safe_string(trade, 'orderId')
@@ -444,6 +680,7 @@ class coinone(Exchange, ImplicitAPI):
444
680
  async def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
445
681
  """
446
682
  get the list of most recent trades for a particular symbol
683
+ :see: https://docs.coinone.co.kr/v1.0/reference/recent-completed-orders
447
684
  :param str symbol: unified symbol of the market to fetch trades for
448
685
  :param int [since]: timestamp in ms of the earliest trade to fetch
449
686
  :param int [limit]: the maximum amount of trades to fetch
@@ -453,28 +690,32 @@ class coinone(Exchange, ImplicitAPI):
453
690
  await self.load_markets()
454
691
  market = self.market(symbol)
455
692
  request = {
456
- 'currency': market['id'],
457
- 'format': 'json',
693
+ 'quote_currency': market['quote'],
694
+ 'target_currency': market['base'],
458
695
  }
459
- response = await self.publicGetTrades(self.extend(request, params))
696
+ if limit is not None:
697
+ request['size'] = limit # only support 10, 50, 100, 150, 200
698
+ response = await self.v2PublicGetTradesQuoteCurrencyTargetCurrency(self.extend(request, params))
460
699
  #
461
700
  # {
462
701
  # "result": "success",
463
- # "errorCode": "0",
464
- # "timestamp": "1416895635",
465
- # "currency": "btc",
466
- # "completeOrders": [
702
+ # "error_code": "0",
703
+ # "server_time": 1701075315771,
704
+ # "quote_currency": "KRW",
705
+ # "target_currency": "BTC",
706
+ # "transactions": [
467
707
  # {
468
- # "timestamp": "1416893212",
469
- # "price": "420000.0",
470
- # "qty": "0.1",
471
- # "is_ask": "1"
708
+ # "id": "1701075265708001",
709
+ # "timestamp": 1701075265708,
710
+ # "price": "50020000",
711
+ # "qty": "0.00155177",
712
+ # "is_seller_maker": False
472
713
  # }
473
714
  # ]
474
715
  # }
475
716
  #
476
- completeOrders = self.safe_value(response, 'completeOrders', [])
477
- return self.parse_trades(completeOrders, market, since, limit)
717
+ data = self.safe_value(response, 'transactions', [])
718
+ return self.parse_trades(data, market, since, limit)
478
719
 
479
720
  async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount, price=None, params={}):
480
721
  """
@@ -524,7 +765,7 @@ class coinone(Exchange, ImplicitAPI):
524
765
  'order_id': id,
525
766
  'currency': market['id'],
526
767
  }
527
- response = await self.privatePostOrderQueryOrder(self.extend(request, params))
768
+ response = await self.v2PrivatePostOrderQueryOrder(self.extend(request, params))
528
769
  #
529
770
  # {
530
771
  # "result": "success",
@@ -720,7 +961,7 @@ class coinone(Exchange, ImplicitAPI):
720
961
  request = {
721
962
  'currency': market['id'],
722
963
  }
723
- response = await self.privatePostOrderCompleteOrders(self.extend(request, params))
964
+ response = await self.v2PrivatePostOrderCompleteOrders(self.extend(request, params))
724
965
  #
725
966
  # despite the name of the endpoint it returns trades which may have a duplicate orderId
726
967
  # https://github.com/ccxt/ccxt/pull/7067
@@ -769,7 +1010,7 @@ class coinone(Exchange, ImplicitAPI):
769
1010
  'is_ask': isAsk,
770
1011
  'currency': self.market_id(symbol),
771
1012
  }
772
- response = await self.privatePostOrderCancel(self.extend(request, params))
1013
+ response = await self.v2PrivatePostOrderCancel(self.extend(request, params))
773
1014
  #
774
1015
  # {
775
1016
  # "result": "success",
@@ -786,7 +1027,7 @@ class coinone(Exchange, ImplicitAPI):
786
1027
  :returns dict: a list of `address structures <https://docs.ccxt.com/#/?id=address-structure>`
787
1028
  """
788
1029
  await self.load_markets()
789
- response = await self.privatePostAccountDepositAddress(params)
1030
+ response = await self.v2PrivatePostAccountDepositAddress(params)
790
1031
  #
791
1032
  # {
792
1033
  # "result": "success",
@@ -835,13 +1076,20 @@ class coinone(Exchange, ImplicitAPI):
835
1076
  request = self.implode_params(path, params)
836
1077
  query = self.omit(params, self.extract_params(path))
837
1078
  url = self.urls['api']['rest'] + '/'
1079
+ if api == 'v2Public':
1080
+ url = self.urls['api']['v2Public'] + '/'
1081
+ api = 'public'
1082
+ elif api == 'v2Private':
1083
+ url = self.urls['api']['v2Private'] + '/'
1084
+ elif api == 'v2_1Private':
1085
+ url = self.urls['api']['v2_1Private'] + '/'
838
1086
  if api == 'public':
839
1087
  url += request
840
1088
  if query:
841
1089
  url += '?' + self.urlencode(query)
842
1090
  else:
843
1091
  self.check_required_credentials()
844
- url += self.version + '/' + request
1092
+ url += request
845
1093
  nonce = str(self.nonce())
846
1094
  json = self.json(self.extend({
847
1095
  'access_token': self.apiKey,