ccxt 4.3.69__py2.py3-none-any.whl → 4.3.70__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.

Potentially problematic release.


This version of ccxt might be problematic. Click here for more details.

@@ -92,7 +92,7 @@ class coinbaseinternational(Exchange, ImplicitAPI):
92
92
  'fetchMyBuys': True,
93
93
  'fetchMySells': True,
94
94
  'fetchMyTrades': True,
95
- 'fetchOHLCV': False,
95
+ 'fetchOHLCV': True,
96
96
  'fetchOpenInterestHistory': False,
97
97
  'fetchOpenOrders': True,
98
98
  'fetchOrder': True,
@@ -111,6 +111,7 @@ class coinbaseinternational(Exchange, ImplicitAPI):
111
111
  'fetchTrades': False,
112
112
  'fetchTradingFee': False,
113
113
  'fetchTradingFees': False,
114
+ 'fetchTransfers': True,
114
115
  'fetchWithdrawals': True,
115
116
  'reduceMargin': False,
116
117
  'sandbox': True,
@@ -153,7 +154,7 @@ class coinbaseinternational(Exchange, ImplicitAPI):
153
154
  'instruments/{instrument}',
154
155
  'instruments/{instrument}/quote',
155
156
  'instruments/{instrument}/funding',
156
- '',
157
+ 'instruments/{instrument}/candles',
157
158
  ],
158
159
  },
159
160
  'private': {
@@ -351,6 +352,75 @@ class coinbaseinternational(Exchange, ImplicitAPI):
351
352
  'info': account,
352
353
  }
353
354
 
355
+ def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = 100, params={}) -> List[list]:
356
+ """
357
+ fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
358
+ :see: https://docs.cdp.coinbase.com/intx/reference/getinstrumentcandles
359
+ :param str symbol: unified symbol of the market to fetch OHLCV data for
360
+ :param str timeframe: the length of time each candle represents
361
+ :param int [since]: timestamp in ms of the earliest candle to fetch
362
+ :param int [limit]: the maximum amount of candles to fetch, default 100 max 10000
363
+ :param dict [params]: extra parameters specific to the exchange API endpoint
364
+ :returns int[][]: A list of candles ordered, open, high, low, close, volume
365
+ :param int [params.until]: timestamp in ms of the latest candle to fetch
366
+ :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
367
+ """
368
+ self.load_markets()
369
+ paginate = False
370
+ paginate, params = self.handle_option_and_params(params, 'fetchOHLCV', 'paginate')
371
+ if paginate:
372
+ return self.fetch_paginated_call_deterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 10000)
373
+ market = self.market(symbol)
374
+ request: dict = {
375
+ 'instrument': market['id'],
376
+ 'granularity': self.safe_string(self.timeframes, timeframe, timeframe),
377
+ }
378
+ if since is not None:
379
+ request['start'] = self.iso8601(since)
380
+ else:
381
+ raise ArgumentsRequired(self.id + ' fetchOHLCV() requires a since argument')
382
+ unitl = self.safe_integer(params, 'until')
383
+ if unitl is not None:
384
+ params = self.omit(params, 'until')
385
+ request['end'] = self.iso8601(unitl)
386
+ response = self.v1PublicGetInstrumentsInstrumentCandles(self.extend(request, params))
387
+ #
388
+ # {
389
+ # "aggregations": [
390
+ # {
391
+ # "start": "2024-04-23T00:00:00Z",
392
+ # "open": "62884.4",
393
+ # "high": "64710.6",
394
+ # "low": "62884.4",
395
+ # "close": "63508.4",
396
+ # "volume": "3253.9983"
397
+ # }
398
+ # ]
399
+ # }
400
+ #
401
+ candles = self.safe_list(response, 'aggregations', [])
402
+ return self.parse_ohlcvs(candles, market, timeframe, since, limit)
403
+
404
+ def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
405
+ #
406
+ # {
407
+ # "start": "2024-04-23T00:00:00Z",
408
+ # "open": "62884.4",
409
+ # "high": "64710.6",
410
+ # "low": "62884.4",
411
+ # "close": "63508.4",
412
+ # "volume": "3253.9983"
413
+ # }
414
+ #
415
+ return [
416
+ self.parse8601(self.safe_string_2(ohlcv, 'start', 'time')),
417
+ self.safe_number(ohlcv, 'open'),
418
+ self.safe_number(ohlcv, 'high'),
419
+ self.safe_number(ohlcv, 'low'),
420
+ self.safe_number(ohlcv, 'close'),
421
+ self.safe_number(ohlcv, 'volume'),
422
+ ]
423
+
354
424
  def fetch_funding_rate_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
355
425
  """
356
426
  fetches historical funding rate prices
@@ -504,6 +574,89 @@ class coinbaseinternational(Exchange, ImplicitAPI):
504
574
  'rate': None,
505
575
  }
506
576
 
577
+ def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[TransferEntry]:
578
+ """
579
+ fetch a history of internal transfers made on an account
580
+ :see: https://docs.cdp.coinbase.com/intx/reference/gettransfers
581
+ :param str code: unified currency code of the currency transferred
582
+ :param int [since]: the earliest time in ms to fetch transfers for
583
+ :param int [limit]: the maximum number of transfers structures to retrieve
584
+ :param dict [params]: extra parameters specific to the exchange API endpoint
585
+ :returns dict[]: a list of `transfer structures <https://docs.ccxt.com/#/?id=transfer-structure>`
586
+ """
587
+ self.load_markets()
588
+ request: dict = {
589
+ 'type': 'INTERNAL',
590
+ }
591
+ currency = None
592
+ if code is not None:
593
+ currency = self.currency(code)
594
+ portfolios = None
595
+ portfolios, params = self.handle_option_and_params(params, 'fetchTransfers', 'portfolios')
596
+ if portfolios is not None:
597
+ request['portfolios'] = portfolios
598
+ if since is not None:
599
+ request['time_from'] = self.iso8601(since)
600
+ if limit is not None:
601
+ request['result_limit'] = limit
602
+ else:
603
+ request['result_limit'] = 100
604
+ response = self.v1PrivateGetTransfers(self.extend(request, params))
605
+ transfers = self.safe_list(response, 'results', [])
606
+ return self.parse_transfers(transfers, currency, since, limit)
607
+
608
+ def parse_transfer(self, transfer: dict, currency: Currency = None) -> TransferEntry:
609
+ #
610
+ # {
611
+ # "amount":"0.0008",
612
+ # "asset":"USDC",
613
+ # "created_at":"2024-02-22T16:00:00Z",
614
+ # "from_portfolio":{
615
+ # "id":"13yuk1fs-1-0",
616
+ # "name":"Eng Test Portfolio - 2",
617
+ # "uuid":"018712f2-5ff9-7de3-9010-xxxxxxxxx"
618
+ # },
619
+ # "instrument_id":"149264164756389888",
620
+ # "instrument_symbol":"ETH-PERP",
621
+ # "position_id":"1xy4v51m-1-2",
622
+ # "status":"PROCESSED",
623
+ # "to_portfolio":{
624
+ # "name":"CB_FUND"
625
+ # },
626
+ # "transfer_type":"FUNDING",
627
+ # "transfer_uuid":"a6b708df-2c44-32c5-bb98-xxxxxxxxxx",
628
+ # "updated_at":"2024-02-22T16:00:00Z"
629
+ # }
630
+ #
631
+ datetime = self.safe_integer(transfer, 'created_at')
632
+ timestamp = self.parse8601(datetime)
633
+ currencyId = self.safe_string(transfer, 'asset')
634
+ code = self.safe_currency_code(currencyId)
635
+ fromPorfolio = self.safe_dict(transfer, 'from_portfolio', {})
636
+ fromId = self.safe_string(fromPorfolio, 'id')
637
+ toPorfolio = self.safe_dict(transfer, 'to_portfolio', {})
638
+ toId = self.safe_string(toPorfolio, 'id')
639
+ return {
640
+ 'info': transfer,
641
+ 'id': self.safe_string(transfer, 'transfer_uuid'),
642
+ 'timestamp': timestamp,
643
+ 'datetime': self.iso8601(timestamp),
644
+ 'currency': code,
645
+ 'amount': self.safe_number(transfer, 'amount'),
646
+ 'fromAccount': fromId,
647
+ 'toAccount': toId,
648
+ 'status': self.parse_transfer_status(self.safe_string(transfer, 'status')),
649
+ }
650
+
651
+ def parse_transfer_status(self, status: Str) -> Str:
652
+ statuses: dict = {
653
+ 'FAILED': 'failed',
654
+ 'PROCESSED': 'ok',
655
+ 'NEW': 'pending',
656
+ 'STARTED': 'pending',
657
+ }
658
+ return self.safe_string(statuses, status, status)
659
+
507
660
  def create_deposit_address(self, code: str, params={}):
508
661
  """
509
662
  create a currency deposit address
ccxt/cryptocom.py CHANGED
@@ -17,10 +17,13 @@ from ccxt.base.errors import BadRequest
17
17
  from ccxt.base.errors import BadSymbol
18
18
  from ccxt.base.errors import InsufficientFunds
19
19
  from ccxt.base.errors import InvalidOrder
20
+ from ccxt.base.errors import OrderNotFound
20
21
  from ccxt.base.errors import NotSupported
21
22
  from ccxt.base.errors import DDoSProtection
23
+ from ccxt.base.errors import RateLimitExceeded
22
24
  from ccxt.base.errors import OnMaintenance
23
25
  from ccxt.base.errors import InvalidNonce
26
+ from ccxt.base.errors import RequestTimeout
24
27
  from ccxt.base.decimal_to_precision import TICK_SIZE
25
28
  from ccxt.base.precise import Precise
26
29
 
@@ -401,7 +404,15 @@ class cryptocom(Exchange, ImplicitAPI):
401
404
  '40006': BadRequest,
402
405
  '40007': BadRequest,
403
406
  '40101': AuthenticationError,
404
- '50001': BadRequest,
407
+ '40102': InvalidNonce, # Nonce value differs by more than 60 seconds from server
408
+ '40103': AuthenticationError, # IP address not whitelisted
409
+ '40104': AuthenticationError, # Disallowed based on user tier
410
+ '40107': BadRequest, # Session subscription limit has been exceeded
411
+ '40401': OrderNotFound,
412
+ '40801': RequestTimeout,
413
+ '42901': RateLimitExceeded,
414
+ '43005': InvalidOrder, # Rejected POST_ONLY create-order request(normally happened when exec_inst contains POST_ONLY but time_in_force is NOT GOOD_TILL_CANCEL)
415
+ '50001': ExchangeError,
405
416
  '9010001': OnMaintenance, # {"code":9010001,"message":"SYSTEM_MAINTENANCE","details":"Crypto.com Exchange is currently under maintenance. Please refer to https://status.crypto.com for more details."}
406
417
  },
407
418
  'broad': {},
ccxt/poloniex.py CHANGED
@@ -359,6 +359,7 @@ class poloniex(Exchange, ImplicitAPI):
359
359
  '21350': InvalidOrder, # Amount must be greater than 1 USDT
360
360
  '21355': ExchangeError, # Interval between startTime and endTime in trade/order history has exceeded 7 day limit
361
361
  '21356': BadRequest, # Order size would cause too much price movement. Reduce order size.
362
+ '21721': InsufficientFunds,
362
363
  '24101': BadSymbol, # Invalid symbol
363
364
  '24102': InvalidOrder, # Invalid K-line type
364
365
  '24103': InvalidOrder, # Invalid endTime
ccxt/pro/__init__.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # ----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.3.69'
7
+ __version__ = '4.3.70'
8
8
 
9
9
  # ----------------------------------------------------------------------------
10
10
 
@@ -33,6 +33,7 @@ from ccxt.pro.bitrue import bitrue # noqa
33
33
  from ccxt.pro.bitstamp import bitstamp # noqa: F401
34
34
  from ccxt.pro.bitvavo import bitvavo # noqa: F401
35
35
  from ccxt.pro.blockchaincom import blockchaincom # noqa: F401
36
+ from ccxt.pro.blofin import blofin # noqa: F401
36
37
  from ccxt.pro.bybit import bybit # noqa: F401
37
38
  from ccxt.pro.cex import cex # noqa: F401
38
39
  from ccxt.pro.coinbase import coinbase # noqa: F401
@@ -103,6 +104,7 @@ exchanges = [
103
104
  'bitstamp',
104
105
  'bitvavo',
105
106
  'blockchaincom',
107
+ 'blofin',
106
108
  'bybit',
107
109
  'cex',
108
110
  'coinbase',