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

@@ -1658,6 +1658,26 @@ class phemex(Exchange, ImplicitAPI):
1658
1658
  # "execId": "8718cae",
1659
1659
  # "execStatus": 6
1660
1660
  # }
1661
+ # spot with fees paid using PT token
1662
+ # "createdAt": "1714990724076",
1663
+ # "symbol": "BTCUSDT",
1664
+ # "currency": "USDT",
1665
+ # "action": "1",
1666
+ # "tradeType": "1",
1667
+ # "execQtyRq": "0.003",
1668
+ # "execPriceRp": "64935",
1669
+ # "side": "2",
1670
+ # "orderQtyRq": "0.003",
1671
+ # "priceRp": "51600",
1672
+ # "execValueRv": "194.805",
1673
+ # "feeRateRr": "0.000495",
1674
+ # "execFeeRv": "0",
1675
+ # "ordType": "3",
1676
+ # "execId": "XXXXXX",
1677
+ # "execStatus": "7",
1678
+ # "posSide": "1",
1679
+ # "ptFeeRv": "0.110012249248",
1680
+ # "ptPriceRp": "0.876524893"
1661
1681
  #
1662
1682
  priceString: Str
1663
1683
  amountString: Str
@@ -1706,10 +1726,16 @@ class phemex(Exchange, ImplicitAPI):
1706
1726
  priceString = self.safe_string(trade, 'execPriceRp')
1707
1727
  amountString = self.safe_string(trade, 'execQtyRq')
1708
1728
  costString = self.safe_string(trade, 'execValueRv')
1709
- feeCostString = self.safe_string(trade, 'execFeeRv')
1729
+ feeCostString = self.omit_zero(self.safe_string(trade, 'execFeeRv'))
1710
1730
  feeRateString = self.safe_string(trade, 'feeRateRr')
1711
- currencyId = self.safe_string(trade, 'currency')
1712
- feeCurrencyCode = self.safe_currency_code(currencyId)
1731
+ if feeCostString is not None:
1732
+ currencyId = self.safe_string(trade, 'currency')
1733
+ feeCurrencyCode = self.safe_currency_code(currencyId)
1734
+ else:
1735
+ ptFeeRv = self.omit_zero(self.safe_string(trade, 'ptFeeRv'))
1736
+ if ptFeeRv is not None:
1737
+ feeCostString = ptFeeRv
1738
+ feeCurrencyCode = 'PT'
1713
1739
  else:
1714
1740
  side = self.safe_string_lower(trade, 'side')
1715
1741
  type = self.parse_order_type(self.safe_string(trade, 'ordType'))
@@ -1720,7 +1746,7 @@ class phemex(Exchange, ImplicitAPI):
1720
1746
  amountString = self.from_ev(self.safe_string(trade, 'execBaseQtyEv'), market)
1721
1747
  amountString = self.safe_string(trade, 'execQty', amountString)
1722
1748
  costString = self.from_er(self.safe_string_2(trade, 'execQuoteQtyEv', 'execValueEv'), market)
1723
- feeCostString = self.from_er(self.safe_string(trade, 'execFeeEv'), market)
1749
+ feeCostString = self.from_er(self.omit_zero(self.safe_string(trade, 'execFeeEv')), market)
1724
1750
  if feeCostString is not None:
1725
1751
  feeRateString = self.from_er(self.safe_string(trade, 'feeRateEr'), market)
1726
1752
  if market['spot']:
@@ -1730,6 +1756,10 @@ class phemex(Exchange, ImplicitAPI):
1730
1756
  if info is not None:
1731
1757
  settlementCurrencyId = self.safe_string(info, 'settlementCurrency')
1732
1758
  feeCurrencyCode = self.safe_currency_code(settlementCurrencyId)
1759
+ else:
1760
+ feeCostString = self.safe_string(trade, 'ptFeeRv')
1761
+ if feeCostString is not None:
1762
+ feeCurrencyCode = 'PT'
1733
1763
  fee = {
1734
1764
  'cost': feeCostString,
1735
1765
  'rate': feeRateString,
@@ -3608,7 +3638,8 @@ class phemex(Exchange, ImplicitAPI):
3608
3638
  raise BadRequest(self.id + ' fetchFundingHistory() limit argument cannot exceed 200')
3609
3639
  request['limit'] = limit
3610
3640
  response = None
3611
- if market['settle'] == 'USDT':
3641
+ isUsdt = market['settle'] == 'USDT'
3642
+ if isUsdt:
3612
3643
  response = await self.privateGetApiDataGFuturesFundingFees(self.extend(request, params))
3613
3644
  else:
3614
3645
  response = await self.privateGetApiDataFuturesFundingFees(self.extend(request, params))
@@ -3621,13 +3652,13 @@ class phemex(Exchange, ImplicitAPI):
3621
3652
  # {
3622
3653
  # "symbol": "BTCUSD",
3623
3654
  # "currency": "BTC",
3624
- # "execQty": 18,
3655
+ # "execQty": 18, # "execQty" regular, but "execQtyRq" in hedge
3625
3656
  # "side": "Buy",
3626
- # "execPriceEp": 360086455,
3627
- # "execValueEv": 49987,
3628
- # "fundingRateEr": 10000,
3629
- # "feeRateEr": 10000,
3630
- # "execFeeEv": 5,
3657
+ # "execPriceEp": 360086455, # "execPriceEp" regular, but "execPriceRp" in hedge
3658
+ # "execValueEv": 49987, # "execValueEv" regular, but "execValueRv" in hedge
3659
+ # "fundingRateEr": 10000, # "fundingRateEr" regular, but "fundingRateRr" in hedge
3660
+ # "feeRateEr": 10000, # "feeRateEr" regular, but "feeRateRr" in hedge
3661
+ # "execFeeEv": 5, # "execFeeEv" regular, but "execFeeRv" in hedge
3631
3662
  # "createTime": 1651881600000
3632
3663
  # }
3633
3664
  # ]
@@ -3640,17 +3671,31 @@ class phemex(Exchange, ImplicitAPI):
3640
3671
  for i in range(0, len(rows)):
3641
3672
  entry = rows[i]
3642
3673
  timestamp = self.safe_integer(entry, 'createTime')
3674
+ execFee = self.safe_string_2(entry, 'execFeeEv', 'execFeeRv')
3675
+ currencyCode = self.safe_currency_code(self.safe_string(entry, 'currency'))
3643
3676
  result.append({
3644
3677
  'info': entry,
3645
3678
  'symbol': self.safe_string(entry, 'symbol'),
3646
- 'code': self.safe_currency_code(self.safe_string(entry, 'currency')),
3679
+ 'code': currencyCode,
3647
3680
  'timestamp': timestamp,
3648
3681
  'datetime': self.iso8601(timestamp),
3649
3682
  'id': None,
3650
- 'amount': self.from_ev(self.safe_string(entry, 'execFeeEv'), market),
3683
+ 'amount': self.parse_funding_fee_to_precision(execFee, market, currencyCode),
3651
3684
  })
3652
3685
  return result
3653
3686
 
3687
+ def parse_funding_fee_to_precision(self, value, market: Market = None, currencyCode: Str = None):
3688
+ if value is None or currencyCode is None:
3689
+ return value
3690
+ # it was confirmed by phemex support, that USDT contracts use direct amounts in funding fees, while USD & INVERSE needs 'valueScale'
3691
+ isUsdt = market['settle'] == 'USDT'
3692
+ if not isUsdt:
3693
+ currency = self.safe_currency(currencyCode)
3694
+ scale = self.safe_string(currency['info'], 'valueScale')
3695
+ tickPrecision = self.parse_precision(scale)
3696
+ value = Precise.string_mul(value, tickPrecision)
3697
+ return value
3698
+
3654
3699
  async def fetch_funding_rate(self, symbol: str, params={}):
3655
3700
  """
3656
3701
  fetch the current funding rate
@@ -220,41 +220,22 @@ class probit(Exchange, ImplicitAPI):
220
220
  },
221
221
  },
222
222
  'commonCurrencies': {
223
- 'AUTO': 'Cube',
224
- 'AZU': 'Azultec',
225
- 'BCC': 'BCC',
226
- 'BDP': 'BidiPass',
227
- 'BIRD': 'Birdchain',
228
- 'BTCBEAR': 'BEAR',
229
- 'BTCBULL': 'BULL',
223
+ 'BB': 'Baby Bali',
230
224
  'CBC': 'CryptoBharatCoin',
231
- 'CHE': 'Chellit',
232
- 'CLR': 'Color Platform',
233
225
  'CTK': 'Cryptyk',
234
226
  'CTT': 'Castweet',
235
- 'DIP': 'Dipper',
236
227
  'DKT': 'DAKOTA',
237
228
  'EGC': 'EcoG9coin',
238
229
  'EPS': 'Epanus', # conflict with EPS Ellipsis https://github.com/ccxt/ccxt/issues/8909
239
230
  'FX': 'Fanzy',
240
- 'GDT': 'Gorilla Diamond',
241
231
  'GM': 'GM Holding',
242
232
  'GOGOL': 'GOL',
243
233
  'GOL': 'Goldofir',
244
- 'GRB': 'Global Reward Bank',
245
- 'HBC': 'Hybrid Bank Cash',
246
234
  'HUSL': 'The Hustle App',
247
235
  'LAND': 'Landbox',
248
- 'LBK': 'Legal Block',
249
- 'ORC': 'Oracle System',
250
- 'PXP': 'PIXSHOP COIN',
251
- 'PYE': 'CreamPYE',
252
- 'ROOK': 'Reckoon',
253
- 'SOC': 'Soda Coin',
254
236
  'SST': 'SocialSwap',
255
237
  'TCT': 'Top Coin Token',
256
238
  'TOR': 'Torex',
257
- 'TPAY': 'Tetra Pay',
258
239
  'UNI': 'UNICORN Token',
259
240
  'UNISWAP': 'UNI',
260
241
  },
@@ -245,6 +245,15 @@ class whitebit(Exchange, ImplicitAPI):
245
245
  'convert/estimate',
246
246
  'convert/confirm',
247
247
  'convert/history',
248
+ 'sub-account/create',
249
+ 'sub-account/delete',
250
+ 'sub-account/edit',
251
+ 'sub-account/list',
252
+ 'sub-account/transfer',
253
+ 'sub-account/block',
254
+ 'sub-account/unblock',
255
+ 'sub-account/balances',
256
+ 'sub-account/transfer/history',
248
257
  ],
249
258
  },
250
259
  },
ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.3.21'
7
+ __version__ = '4.3.23'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
ccxt/binance.py CHANGED
@@ -9003,7 +9003,7 @@ class binance(Exchange, ImplicitAPI):
9003
9003
  self.load_markets()
9004
9004
  # by default cache the leverage bracket
9005
9005
  # it contains useful stuff like the maintenance margin and initial margin for positions
9006
- leverageBrackets = self.safe_dict(self.options, 'leverageBrackets', {})
9006
+ leverageBrackets = self.safe_dict(self.options, 'leverageBrackets')
9007
9007
  if (leverageBrackets is None) or (reload):
9008
9008
  defaultType = self.safe_string(self.options, 'defaultType', 'future')
9009
9009
  type = self.safe_string(params, 'type', defaultType)
ccxt/coinbase.py CHANGED
@@ -1753,6 +1753,10 @@ class coinbase(Exchange, ImplicitAPI):
1753
1753
  request = {}
1754
1754
  if symbols is not None:
1755
1755
  request['product_ids'] = self.market_ids(symbols)
1756
+ marketType = None
1757
+ marketType, params = self.handle_market_type_and_params('fetchTickers', self.get_market_from_symbols(symbols), params, 'default')
1758
+ if marketType is not None and marketType != 'default':
1759
+ request['product_type'] = 'FUTURE' if (marketType == 'swap') else 'SPOT'
1756
1760
  response = self.v3PublicGetBrokerageMarketProducts(self.extend(request, params))
1757
1761
  #
1758
1762
  # {