ccxt 4.2.87__py2.py3-none-any.whl → 4.2.89__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.
- ccxt/__init__.py +1 -1
- ccxt/ascendex.py +5 -3
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/ascendex.py +5 -3
- ccxt/async_support/base/exchange.py +3 -2
- ccxt/async_support/bigone.py +2 -2
- ccxt/async_support/binance.py +17 -11
- ccxt/async_support/bingx.py +2 -2
- ccxt/async_support/bit2c.py +2 -2
- ccxt/async_support/bitbank.py +2 -2
- ccxt/async_support/bitfinex.py +2 -2
- ccxt/async_support/bitfinex2.py +3 -3
- ccxt/async_support/bitflyer.py +4 -2
- ccxt/async_support/bitget.py +27 -21
- ccxt/async_support/bitmart.py +6 -4
- ccxt/async_support/bitmex.py +2 -2
- ccxt/async_support/bitopro.py +3 -3
- ccxt/async_support/bitrue.py +2 -2
- ccxt/async_support/bitso.py +2 -2
- ccxt/async_support/bitstamp.py +89 -97
- ccxt/async_support/bitteam.py +2 -2
- ccxt/async_support/bitvavo.py +3 -3
- ccxt/async_support/bl3p.py +2 -2
- ccxt/async_support/blockchaincom.py +2 -2
- ccxt/async_support/blofin.py +4 -2
- ccxt/async_support/bybit.py +7 -5
- ccxt/async_support/cex.py +3 -3
- ccxt/async_support/coinbase.py +2 -2
- ccxt/async_support/coinbaseinternational.py +2 -2
- ccxt/async_support/coinbasepro.py +3 -3
- ccxt/async_support/coincheck.py +2 -2
- ccxt/async_support/coinex.py +5 -5
- ccxt/async_support/coinlist.py +3 -3
- ccxt/async_support/coinmate.py +2 -2
- ccxt/async_support/coinmetro.py +2 -2
- ccxt/async_support/coinone.py +2 -2
- ccxt/async_support/coinsph.py +6 -4
- ccxt/async_support/cryptocom.py +1 -1
- ccxt/async_support/currencycom.py +3 -3
- ccxt/async_support/delta.py +2 -2
- ccxt/async_support/deribit.py +3 -3
- ccxt/async_support/digifinex.py +6 -4
- ccxt/async_support/exmo.py +3 -3
- ccxt/async_support/gate.py +20 -18
- ccxt/async_support/gemini.py +3 -3
- ccxt/async_support/hitbtc.py +7 -5
- ccxt/async_support/hollaex.py +3 -3
- ccxt/async_support/htx.py +6 -4
- ccxt/async_support/huobijp.py +2 -2
- ccxt/async_support/hyperliquid.py +2 -2
- ccxt/async_support/idex.py +3 -3
- ccxt/async_support/independentreserve.py +2 -2
- ccxt/async_support/kraken.py +3 -3
- ccxt/async_support/krakenfutures.py +2 -1
- ccxt/async_support/kucoin.py +49 -22
- ccxt/async_support/kuna.py +2 -2
- ccxt/async_support/latoken.py +7 -3
- ccxt/async_support/lbank.py +7 -5
- ccxt/async_support/luno.py +4 -2
- ccxt/async_support/lykke.py +2 -2
- ccxt/async_support/mexc.py +57 -10
- ccxt/async_support/ndax.py +2 -2
- ccxt/async_support/oceanex.py +2 -2
- ccxt/async_support/okcoin.py +2 -2
- ccxt/async_support/okx.py +6 -4
- ccxt/async_support/onetrading.py +3 -3
- ccxt/async_support/phemex.py +2 -2
- ccxt/async_support/poloniex.py +3 -3
- ccxt/async_support/probit.py +2 -2
- ccxt/async_support/timex.py +6 -4
- ccxt/async_support/upbit.py +2 -2
- ccxt/async_support/wazirx.py +2 -2
- ccxt/async_support/whitebit.py +3 -3
- ccxt/async_support/woo.py +3 -3
- ccxt/async_support/yobit.py +2 -2
- ccxt/base/exchange.py +35 -9
- ccxt/base/types.py +32 -0
- ccxt/bigone.py +2 -2
- ccxt/binance.py +17 -11
- ccxt/bingx.py +2 -2
- ccxt/bit2c.py +2 -2
- ccxt/bitbank.py +2 -2
- ccxt/bitfinex.py +2 -2
- ccxt/bitfinex2.py +3 -3
- ccxt/bitflyer.py +4 -2
- ccxt/bitget.py +27 -21
- ccxt/bitmart.py +6 -4
- ccxt/bitmex.py +2 -2
- ccxt/bitopro.py +3 -3
- ccxt/bitrue.py +2 -2
- ccxt/bitso.py +2 -2
- ccxt/bitstamp.py +89 -97
- ccxt/bitteam.py +2 -2
- ccxt/bitvavo.py +3 -3
- ccxt/bl3p.py +2 -2
- ccxt/blockchaincom.py +2 -2
- ccxt/blofin.py +4 -2
- ccxt/bybit.py +7 -5
- ccxt/cex.py +3 -3
- ccxt/coinbase.py +2 -2
- ccxt/coinbaseinternational.py +2 -2
- ccxt/coinbasepro.py +3 -3
- ccxt/coincheck.py +2 -2
- ccxt/coinex.py +5 -5
- ccxt/coinlist.py +3 -3
- ccxt/coinmate.py +2 -2
- ccxt/coinmetro.py +2 -2
- ccxt/coinone.py +2 -2
- ccxt/coinsph.py +6 -4
- ccxt/cryptocom.py +1 -1
- ccxt/currencycom.py +3 -3
- ccxt/delta.py +2 -2
- ccxt/deribit.py +3 -3
- ccxt/digifinex.py +6 -4
- ccxt/exmo.py +3 -3
- ccxt/gate.py +20 -18
- ccxt/gemini.py +3 -3
- ccxt/hitbtc.py +7 -5
- ccxt/hollaex.py +3 -3
- ccxt/htx.py +6 -4
- ccxt/huobijp.py +2 -2
- ccxt/hyperliquid.py +2 -2
- ccxt/idex.py +3 -3
- ccxt/independentreserve.py +2 -2
- ccxt/kraken.py +3 -3
- ccxt/krakenfutures.py +2 -1
- ccxt/kucoin.py +49 -22
- ccxt/kuna.py +2 -2
- ccxt/latoken.py +7 -3
- ccxt/lbank.py +7 -5
- ccxt/luno.py +4 -2
- ccxt/lykke.py +2 -2
- ccxt/mexc.py +57 -10
- ccxt/ndax.py +2 -2
- ccxt/oceanex.py +2 -2
- ccxt/okcoin.py +2 -2
- ccxt/okx.py +6 -4
- ccxt/onetrading.py +3 -3
- ccxt/phemex.py +2 -2
- ccxt/poloniex.py +3 -3
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/bitget.py +2 -0
- ccxt/pro/bitvavo.py +2 -2
- ccxt/probit.py +2 -2
- ccxt/timex.py +6 -4
- ccxt/upbit.py +2 -2
- ccxt/wazirx.py +2 -2
- ccxt/whitebit.py +3 -3
- ccxt/woo.py +3 -3
- ccxt/yobit.py +2 -2
- {ccxt-4.2.87.dist-info → ccxt-4.2.89.dist-info}/METADATA +5 -6
- {ccxt-4.2.87.dist-info → ccxt-4.2.89.dist-info}/RECORD +154 -154
- {ccxt-4.2.87.dist-info → ccxt-4.2.89.dist-info}/WHEEL +0 -0
- {ccxt-4.2.87.dist-info → ccxt-4.2.89.dist-info}/top_level.txt +0 -0
ccxt/async_support/probit.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.probit import ImplicitAPI
|
8
8
|
import math
|
9
|
-
from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
|
9
|
+
from ccxt.base.types import Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import ArgumentsRequired
|
@@ -355,7 +355,7 @@ class probit(Exchange, ImplicitAPI):
|
|
355
355
|
'info': market,
|
356
356
|
}
|
357
357
|
|
358
|
-
async def fetch_currencies(self, params={}):
|
358
|
+
async def fetch_currencies(self, params={}) -> Currencies:
|
359
359
|
"""
|
360
360
|
:see: https://docs-en.probit.com/reference/currency
|
361
361
|
fetches all available currencies on an exchange
|
ccxt/async_support/timex.py
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.timex import ImplicitAPI
|
8
|
-
from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
|
8
|
+
from ccxt.base.types import Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction
|
9
9
|
from typing import List
|
10
10
|
from ccxt.base.errors import ExchangeError
|
11
11
|
from ccxt.base.errors import PermissionDenied
|
@@ -323,7 +323,7 @@ class timex(Exchange, ImplicitAPI):
|
|
323
323
|
#
|
324
324
|
return self.parse_markets(response)
|
325
325
|
|
326
|
-
async def fetch_currencies(self, params={}):
|
326
|
+
async def fetch_currencies(self, params={}) -> Currencies:
|
327
327
|
"""
|
328
328
|
fetches all available currencies on an exchange
|
329
329
|
:see: https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Public/listCurrencies
|
@@ -1096,7 +1096,7 @@ class timex(Exchange, ImplicitAPI):
|
|
1096
1096
|
trades = self.safe_list(response, 'trades', [])
|
1097
1097
|
return self.parse_trades(trades, market, since, limit)
|
1098
1098
|
|
1099
|
-
def parse_trading_fee(self, fee, market: Market = None):
|
1099
|
+
def parse_trading_fee(self, fee, market: Market = None) -> TradingFeeInterface:
|
1100
1100
|
#
|
1101
1101
|
# {
|
1102
1102
|
# "fee": 0.0075,
|
@@ -1110,9 +1110,11 @@ class timex(Exchange, ImplicitAPI):
|
|
1110
1110
|
'symbol': self.safe_symbol(marketId, market),
|
1111
1111
|
'maker': rate,
|
1112
1112
|
'taker': rate,
|
1113
|
+
'percentage': None,
|
1114
|
+
'tierBased': None,
|
1113
1115
|
}
|
1114
1116
|
|
1115
|
-
async def fetch_trading_fee(self, symbol: str, params={}):
|
1117
|
+
async def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
|
1116
1118
|
"""
|
1117
1119
|
fetch the trading fees for a market
|
1118
1120
|
:see: https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Trading/getFees
|
ccxt/async_support/upbit.py
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.upbit import ImplicitAPI
|
8
|
-
from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
|
8
|
+
from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction
|
9
9
|
from typing import List
|
10
10
|
from ccxt.base.errors import ExchangeError
|
11
11
|
from ccxt.base.errors import PermissionDenied
|
@@ -836,7 +836,7 @@ class upbit(Exchange, ImplicitAPI):
|
|
836
836
|
#
|
837
837
|
return self.parse_trades(response, market, since, limit)
|
838
838
|
|
839
|
-
async def fetch_trading_fee(self, symbol: str, params={}):
|
839
|
+
async def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
|
840
840
|
"""
|
841
841
|
:see: https://docs.upbit.com/reference/%EC%A3%BC%EB%AC%B8-%EA%B0%80%EB%8A%A5-%EC%A0%95%EB%B3%B4
|
842
842
|
fetch the trading fees for a market
|
ccxt/async_support/wazirx.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.wazirx import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
|
9
|
+
from ccxt.base.types import Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import PermissionDenied
|
@@ -882,7 +882,7 @@ class wazirx(Exchange, ImplicitAPI):
|
|
882
882
|
}
|
883
883
|
return self.safe_string(statuses, status, status)
|
884
884
|
|
885
|
-
async def fetch_currencies(self, params={}):
|
885
|
+
async def fetch_currencies(self, params={}) -> Currencies:
|
886
886
|
"""
|
887
887
|
fetches all available currencies on an exchange
|
888
888
|
:see: https://docs.wazirx.com/#all-coins-39-information-user_data
|
ccxt/async_support/whitebit.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.whitebit import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Bool, Currency, Int, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
9
|
+
from ccxt.base.types import Balances, Bool, Currencies, Currency, Int, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import PermissionDenied
|
@@ -401,7 +401,7 @@ class whitebit(Exchange, ImplicitAPI):
|
|
401
401
|
'info': market,
|
402
402
|
}
|
403
403
|
|
404
|
-
async def fetch_currencies(self, params={}):
|
404
|
+
async def fetch_currencies(self, params={}) -> Currencies:
|
405
405
|
"""
|
406
406
|
fetches all available currencies on an exchange
|
407
407
|
:see: https://docs.whitebit.com/public/http-v4/#asset-status-list
|
@@ -652,7 +652,7 @@ class whitebit(Exchange, ImplicitAPI):
|
|
652
652
|
depositWithdrawFees[code] = self.assign_default_deposit_withdraw_fees(depositWithdrawFees[code], currency)
|
653
653
|
return depositWithdrawFees
|
654
654
|
|
655
|
-
async def fetch_trading_fees(self, params={}):
|
655
|
+
async def fetch_trading_fees(self, params={}) -> TradingFees:
|
656
656
|
"""
|
657
657
|
fetch the trading fees for multiple markets
|
658
658
|
:see: https://docs.whitebit.com/public/http-v4/#asset-status-list
|
ccxt/async_support/woo.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.woo import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Account, Balances, Bool, Currency, Int, Leverage, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Trade, Transaction, TransferEntry
|
9
|
+
from ccxt.base.types import Account, Balances, Bool, Currencies, Currency, Int, Leverage, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Trade, TradingFees, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import ArgumentsRequired
|
@@ -620,7 +620,7 @@ class woo(Exchange, ImplicitAPI):
|
|
620
620
|
}
|
621
621
|
return fee
|
622
622
|
|
623
|
-
async def fetch_trading_fees(self, params={}):
|
623
|
+
async def fetch_trading_fees(self, params={}) -> TradingFees:
|
624
624
|
"""
|
625
625
|
fetch the trading fees for multiple markets
|
626
626
|
:see: https://docs.woo.org/#get-account-information-new
|
@@ -673,7 +673,7 @@ class woo(Exchange, ImplicitAPI):
|
|
673
673
|
}
|
674
674
|
return result
|
675
675
|
|
676
|
-
async def fetch_currencies(self, params={}):
|
676
|
+
async def fetch_currencies(self, params={}) -> Currencies:
|
677
677
|
"""
|
678
678
|
fetches all available currencies on an exchange
|
679
679
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
ccxt/async_support/yobit.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.yobit import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade
|
9
|
+
from ccxt.base.types import Balances, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import ArgumentsRequired
|
@@ -700,7 +700,7 @@ class yobit(Exchange, ImplicitAPI):
|
|
700
700
|
result = self.safe_list(response, market['id'], [])
|
701
701
|
return self.parse_trades(result, market, since, limit)
|
702
702
|
|
703
|
-
async def fetch_trading_fees(self, params={}):
|
703
|
+
async def fetch_trading_fees(self, params={}) -> TradingFees:
|
704
704
|
"""
|
705
705
|
:see: https://yobit.net/en/api
|
706
706
|
fetch the trading fees for multiple markets
|
ccxt/base/exchange.py
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
# -----------------------------------------------------------------------------
|
6
6
|
|
7
|
-
__version__ = '4.2.
|
7
|
+
__version__ = '4.2.89'
|
8
8
|
|
9
9
|
# -----------------------------------------------------------------------------
|
10
10
|
|
@@ -3732,11 +3732,11 @@ class Exchange(object):
|
|
3732
3732
|
code = currencyId
|
3733
3733
|
if currencyId is not None:
|
3734
3734
|
code = self.common_currency_code(currencyId.upper())
|
3735
|
-
return {
|
3735
|
+
return self.safe_currency_structure({
|
3736
3736
|
'id': currencyId,
|
3737
3737
|
'code': code,
|
3738
3738
|
'precision': None,
|
3739
|
-
}
|
3739
|
+
})
|
3740
3740
|
|
3741
3741
|
def safe_market(self, marketId: Str, market: Market = None, delimiter: Str = None, marketType: Str = None):
|
3742
3742
|
result = self.safe_market_structure({
|
@@ -4390,10 +4390,16 @@ class Exchange(object):
|
|
4390
4390
|
'total': None,
|
4391
4391
|
}
|
4392
4392
|
|
4393
|
-
def common_currency_code(self,
|
4393
|
+
def common_currency_code(self, code: str):
|
4394
4394
|
if not self.substituteCommonCurrencyCodes:
|
4395
|
-
return
|
4396
|
-
|
4395
|
+
return code
|
4396
|
+
# if the provided code already exists value in commonCurrencies dict, then we should not again transform it
|
4397
|
+
# more details at: https://github.com/ccxt/ccxt/issues/21112#issuecomment-2031293691
|
4398
|
+
commonCurrencies = list(self.commonCurrencies.values())
|
4399
|
+
exists = self.in_array(code, commonCurrencies)
|
4400
|
+
if exists:
|
4401
|
+
return code
|
4402
|
+
return self.safe_string(self.commonCurrencies, code, code)
|
4397
4403
|
|
4398
4404
|
def currency(self, code: str):
|
4399
4405
|
if self.currencies is None:
|
@@ -4525,6 +4531,25 @@ class Exchange(object):
|
|
4525
4531
|
parsedPrecision = parsedPrecision + '0'
|
4526
4532
|
return parsedPrecision + '1'
|
4527
4533
|
|
4534
|
+
def integer_precision_to_amount(self, precision: Str):
|
4535
|
+
"""
|
4536
|
+
* @ignore
|
4537
|
+
handles positive & negative numbers too. parsePrecision() does not handle negative numbers, but self method handles
|
4538
|
+
:param str precision: The number of digits to the right of the decimal
|
4539
|
+
:returns str: a string number equal to 1e-precision
|
4540
|
+
"""
|
4541
|
+
if precision is None:
|
4542
|
+
return None
|
4543
|
+
if Precise.string_ge(precision, '0'):
|
4544
|
+
return self.parse_precision(precision)
|
4545
|
+
else:
|
4546
|
+
positivePrecisionString = Precise.string_abs(precision)
|
4547
|
+
positivePrecision = int(positivePrecisionString)
|
4548
|
+
parsedPrecision = '1'
|
4549
|
+
for i in range(0, positivePrecision - 1):
|
4550
|
+
parsedPrecision = parsedPrecision + '0'
|
4551
|
+
return parsedPrecision + '0'
|
4552
|
+
|
4528
4553
|
def load_time_difference(self, params={}):
|
4529
4554
|
serverTime = self.fetch_time(params)
|
4530
4555
|
after = self.milliseconds()
|
@@ -4772,7 +4797,8 @@ class Exchange(object):
|
|
4772
4797
|
def fetch_trading_fee(self, symbol: str, params={}):
|
4773
4798
|
if not self.has['fetchTradingFees']:
|
4774
4799
|
raise NotSupported(self.id + ' fetchTradingFee() is not supported yet')
|
4775
|
-
|
4800
|
+
fees = self.fetch_trading_fees(params)
|
4801
|
+
return self.safe_dict(fees, symbol)
|
4776
4802
|
|
4777
4803
|
def parse_open_interest(self, interest, market: Market = None):
|
4778
4804
|
raise NotSupported(self.id + ' parseOpenInterest() is not supported yet')
|
@@ -4935,8 +4961,8 @@ class Exchange(object):
|
|
4935
4961
|
entry = responseKeys[i]
|
4936
4962
|
dictionary = entry if isArray else response[entry]
|
4937
4963
|
currencyId = self.safe_string(dictionary, currencyIdKey) if isArray else entry
|
4938
|
-
currency = self.
|
4939
|
-
code = self.safe_string(currency, 'code'
|
4964
|
+
currency = self.safe_currency(currencyId)
|
4965
|
+
code = self.safe_string(currency, 'code')
|
4940
4966
|
if (codes is None) or (self.in_array(code, codes)):
|
4941
4967
|
depositWithdrawFees[code] = self.parseDepositWithdrawFee(dictionary, currency)
|
4942
4968
|
return depositWithdrawFees
|
ccxt/base/types.py
CHANGED
@@ -65,6 +65,15 @@ class FeeInterface(TypedDict):
|
|
65
65
|
Fee = Optional[FeeInterface]
|
66
66
|
|
67
67
|
|
68
|
+
class TradingFeeInterface(TypedDict):
|
69
|
+
info: Dict[str, Any]
|
70
|
+
symbol: Str
|
71
|
+
maker: Num
|
72
|
+
taker: Num
|
73
|
+
percentage: Bool
|
74
|
+
tierBased: Bool
|
75
|
+
|
76
|
+
|
68
77
|
class Balance(TypedDict):
|
69
78
|
free: Num
|
70
79
|
used: Num
|
@@ -361,10 +370,31 @@ class MarketInterface(TypedDict):
|
|
361
370
|
created: Int
|
362
371
|
|
363
372
|
|
373
|
+
class Limit(TypedDict):
|
374
|
+
min: Num
|
375
|
+
max: Num
|
376
|
+
|
377
|
+
|
378
|
+
class CurrencyLimits(TypedDict):
|
379
|
+
amount: Limit
|
380
|
+
withdraw: Limit
|
381
|
+
|
382
|
+
|
364
383
|
class CurrencyInterface(TypedDict):
|
365
384
|
id: Str
|
366
385
|
code: Str
|
386
|
+
numericId: Int
|
367
387
|
precision: Num
|
388
|
+
type: Str
|
389
|
+
margin: Bool
|
390
|
+
name: Str
|
391
|
+
active: Bool
|
392
|
+
deposit: Bool
|
393
|
+
withdraw: Bool
|
394
|
+
fee: Num
|
395
|
+
limits: CurrencyLimits
|
396
|
+
networks: Dict[str, any]
|
397
|
+
info: any
|
368
398
|
|
369
399
|
|
370
400
|
class LastPrice(TypedDict):
|
@@ -388,6 +418,8 @@ class MarginModification(TypedDict):
|
|
388
418
|
|
389
419
|
|
390
420
|
LastPrices = Dict[Str, LastPrice]
|
421
|
+
Currencies = Dict[Str, CurrencyInterface]
|
422
|
+
TradingFees = Dict[Str, TradingFeeInterface]
|
391
423
|
|
392
424
|
Market = Optional[MarketInterface]
|
393
425
|
Currency = Optional[CurrencyInterface]
|
ccxt/bigone.py
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.bigone import ImplicitAPI
|
8
|
-
from ccxt.base.types import Balances, Bool, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
8
|
+
from ccxt.base.types import Balances, Bool, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
9
9
|
from typing import List
|
10
10
|
from ccxt.base.errors import ExchangeError
|
11
11
|
from ccxt.base.errors import PermissionDenied
|
@@ -339,7 +339,7 @@ class bigone(Exchange, ImplicitAPI):
|
|
339
339
|
},
|
340
340
|
})
|
341
341
|
|
342
|
-
def fetch_currencies(self, params={}):
|
342
|
+
def fetch_currencies(self, params={}) -> Currencies:
|
343
343
|
"""
|
344
344
|
fetches all available currencies on an exchange
|
345
345
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
ccxt/binance.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.binance import ImplicitAPI
|
8
8
|
import hashlib
|
9
9
|
import json
|
10
|
-
from ccxt.base.types import Balances, Currency, Greeks, Int, Leverage, Leverages, MarginMode, MarginModes, MarginModification, Market, MarketInterface, Num, Option, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
10
|
+
from ccxt.base.types import Balances, Currencies, Currency, Greeks, Int, Leverage, Leverages, MarginMode, MarginModes, MarginModification, Market, MarketInterface, Num, Option, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
|
11
11
|
from typing import List
|
12
12
|
from ccxt.base.errors import ExchangeError
|
13
13
|
from ccxt.base.errors import PermissionDenied
|
@@ -1882,7 +1882,7 @@ class binance(Exchange, ImplicitAPI):
|
|
1882
1882
|
'-4140': BadRequest, # Invalid symbol status for opening position
|
1883
1883
|
'-4141': OperationRejected, # Symbol is closed
|
1884
1884
|
'-4144': BadSymbol, # Invalid pair
|
1885
|
-
'-4164':
|
1885
|
+
'-4164': InvalidOrder, # {"code":-4164,"msg":"Order's notional must be no smaller than 20(unless you choose reduce only)."}
|
1886
1886
|
'-4165': BadRequest, # Invalid time interval
|
1887
1887
|
'-4167': BadRequest, # Unable to adjust to Multi-Assets mode with symbols of USDⓈ-M Futures under isolated-margin mode.
|
1888
1888
|
'-4168': BadRequest, # Unable to adjust to isolated-margin mode under the Multi-Assets mode.
|
@@ -2592,7 +2592,7 @@ class binance(Exchange, ImplicitAPI):
|
|
2592
2592
|
response = self.publicGetTime(query)
|
2593
2593
|
return self.safe_integer(response, 'serverTime')
|
2594
2594
|
|
2595
|
-
def fetch_currencies(self, params={}):
|
2595
|
+
def fetch_currencies(self, params={}) -> Currencies:
|
2596
2596
|
"""
|
2597
2597
|
fetches all available currencies on an exchange
|
2598
2598
|
:see: https://binance-docs.github.io/apidocs/spot/en/#all-coins-39-information-user_data
|
@@ -8036,7 +8036,7 @@ class binance(Exchange, ImplicitAPI):
|
|
8036
8036
|
# {id: '9a67628b16ba4988ae20d329333f16bc'}
|
8037
8037
|
return self.parse_transaction(response, currency)
|
8038
8038
|
|
8039
|
-
def parse_trading_fee(self, fee, market: Market = None):
|
8039
|
+
def parse_trading_fee(self, fee, market: Market = None) -> TradingFeeInterface:
|
8040
8040
|
#
|
8041
8041
|
# spot
|
8042
8042
|
# [
|
@@ -8061,9 +8061,11 @@ class binance(Exchange, ImplicitAPI):
|
|
8061
8061
|
'symbol': symbol,
|
8062
8062
|
'maker': self.safe_number_2(fee, 'makerCommission', 'makerCommissionRate'),
|
8063
8063
|
'taker': self.safe_number_2(fee, 'takerCommission', 'takerCommissionRate'),
|
8064
|
+
'percentage': None,
|
8065
|
+
'tierBased': None,
|
8064
8066
|
}
|
8065
8067
|
|
8066
|
-
def fetch_trading_fee(self, symbol: str, params={}):
|
8068
|
+
def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
|
8067
8069
|
"""
|
8068
8070
|
fetch the trading fees for a market
|
8069
8071
|
:see: https://binance-docs.github.io/apidocs/spot/en/#trade-fee-user_data
|
@@ -8126,7 +8128,7 @@ class binance(Exchange, ImplicitAPI):
|
|
8126
8128
|
data = self.safe_dict(data, 0, {})
|
8127
8129
|
return self.parse_trading_fee(data, market)
|
8128
8130
|
|
8129
|
-
def fetch_trading_fees(self, params={}):
|
8131
|
+
def fetch_trading_fees(self, params={}) -> TradingFees:
|
8130
8132
|
"""
|
8131
8133
|
fetch the trading fees for multiple markets
|
8132
8134
|
:see: https://binance-docs.github.io/apidocs/spot/en/#trade-fee-user_data
|
@@ -8499,7 +8501,7 @@ class binance(Exchange, ImplicitAPI):
|
|
8499
8501
|
'previousFundingDatetime': None,
|
8500
8502
|
}
|
8501
8503
|
|
8502
|
-
def parse_account_positions(self, account):
|
8504
|
+
def parse_account_positions(self, account, filterClosed=False):
|
8503
8505
|
positions = self.safe_list(account, 'positions')
|
8504
8506
|
assets = self.safe_list(account, 'assets', [])
|
8505
8507
|
balances = {}
|
@@ -8521,7 +8523,8 @@ class binance(Exchange, ImplicitAPI):
|
|
8521
8523
|
code = market['quote'] if market['linear'] else market['base']
|
8522
8524
|
maintenanceMargin = self.safe_string(position, 'maintMargin')
|
8523
8525
|
# check for maintenance margin so empty positions are not returned
|
8524
|
-
|
8526
|
+
isPositionOpen = (maintenanceMargin != '0') and (maintenanceMargin != '0.00000000')
|
8527
|
+
if not filterClosed or isPositionOpen:
|
8525
8528
|
# sometimes not all the codes are correctly returned...
|
8526
8529
|
if code in balances:
|
8527
8530
|
parsed = self.parse_account_position(self.extend(position, {
|
@@ -9287,10 +9290,11 @@ class binance(Exchange, ImplicitAPI):
|
|
9287
9290
|
:see: https://binance-docs.github.io/apidocs/delivery/en/#account-information-user_data
|
9288
9291
|
:see: https://binance-docs.github.io/apidocs/pm/en/#get-um-account-detail-user_data
|
9289
9292
|
:see: https://binance-docs.github.io/apidocs/pm/en/#get-cm-account-detail-user_data
|
9290
|
-
:param str[]
|
9293
|
+
:param str[] [symbols]: list of unified market symbols
|
9291
9294
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
9292
9295
|
:param boolean [params.portfolioMargin]: set to True if you would like to fetch positions in a portfolio margin account
|
9293
9296
|
:param str [params.subType]: "linear" or "inverse"
|
9297
|
+
:param boolean [params.filterClosed]: set to True if you would like to filter out closed positions, default is False
|
9294
9298
|
:returns dict: data on account positions
|
9295
9299
|
"""
|
9296
9300
|
if symbols is not None:
|
@@ -9318,7 +9322,9 @@ class binance(Exchange, ImplicitAPI):
|
|
9318
9322
|
response = self.dapiPrivateGetAccount(params)
|
9319
9323
|
else:
|
9320
9324
|
raise NotSupported(self.id + ' fetchPositions() supports linear and inverse contracts only')
|
9321
|
-
|
9325
|
+
filterClosed = None
|
9326
|
+
filterClosed, params = self.handle_option_and_params(params, 'fetchAccountPositions', 'filterClosed', False)
|
9327
|
+
result = self.parse_account_positions(response, filterClosed)
|
9322
9328
|
symbols = self.market_symbols(symbols)
|
9323
9329
|
return self.filter_by_array_positions(result, 'symbol', symbols, False)
|
9324
9330
|
|
@@ -10286,7 +10292,7 @@ class binance(Exchange, ImplicitAPI):
|
|
10286
10292
|
raise NotSupported(self.id + ' add / reduce margin only supported with type future or delivery')
|
10287
10293
|
self.load_markets()
|
10288
10294
|
market = self.market(symbol)
|
10289
|
-
amount = self.
|
10295
|
+
amount = self.amount_to_precision(symbol, amount)
|
10290
10296
|
request = {
|
10291
10297
|
'type': addOrReduce,
|
10292
10298
|
'symbol': market['id'],
|
ccxt/bingx.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.bingx import ImplicitAPI
|
8
8
|
import hashlib
|
9
9
|
import numbers
|
10
|
-
from ccxt.base.types import Balances, Currency, Int, Leverage, MarginMode, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
10
|
+
from ccxt.base.types import Balances, Currencies, Currency, Int, Leverage, MarginMode, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
11
11
|
from typing import List
|
12
12
|
from ccxt.base.errors import ExchangeError
|
13
13
|
from ccxt.base.errors import PermissionDenied
|
@@ -454,7 +454,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
454
454
|
data = self.safe_dict(response, 'data')
|
455
455
|
return self.safe_integer(data, 'serverTime')
|
456
456
|
|
457
|
-
def fetch_currencies(self, params={}):
|
457
|
+
def fetch_currencies(self, params={}) -> Currencies:
|
458
458
|
"""
|
459
459
|
fetches all available currencies on an exchange
|
460
460
|
:see: https://bingx-api.github.io/docs/#/common/account-api.html#All%20Coins
|
ccxt/bit2c.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.bit2c import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Ticker, Trade
|
9
|
+
from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Ticker, Trade, TradingFees
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import PermissionDenied
|
@@ -360,7 +360,7 @@ class bit2c(Exchange, ImplicitAPI):
|
|
360
360
|
raise ExchangeError(response)
|
361
361
|
return self.parse_trades(response, market, since, limit)
|
362
362
|
|
363
|
-
def fetch_trading_fees(self, params={}):
|
363
|
+
def fetch_trading_fees(self, params={}) -> TradingFees:
|
364
364
|
"""
|
365
365
|
fetch the trading fees for multiple markets
|
366
366
|
:see: https://bit2c.co.il/home/api#balance
|
ccxt/bitbank.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.bitbank import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Ticker, Trade, Transaction
|
9
|
+
from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Ticker, Trade, TradingFees, Transaction
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import PermissionDenied
|
@@ -390,7 +390,7 @@ class bitbank(Exchange, ImplicitAPI):
|
|
390
390
|
trades = self.safe_list(data, 'transactions', [])
|
391
391
|
return self.parse_trades(trades, market, since, limit)
|
392
392
|
|
393
|
-
def fetch_trading_fees(self, params={}):
|
393
|
+
def fetch_trading_fees(self, params={}) -> TradingFees:
|
394
394
|
"""
|
395
395
|
fetch the trading fees for multiple markets
|
396
396
|
:see: https://github.com/bitbankinc/bitbank-api-docs/blob/38d6d7c6f486c793872fd4b4087a0d090a04cd0a/rest-api.md#get-all-pairs-info
|
ccxt/bitfinex.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.bitfinex import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
9
|
+
from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import PermissionDenied
|
@@ -480,7 +480,7 @@ class bitfinex(Exchange, ImplicitAPI):
|
|
480
480
|
'info': fee,
|
481
481
|
}
|
482
482
|
|
483
|
-
def fetch_trading_fees(self, params={}):
|
483
|
+
def fetch_trading_fees(self, params={}) -> TradingFees:
|
484
484
|
"""
|
485
485
|
fetch the trading fees for multiple markets
|
486
486
|
:see: https://docs.bitfinex.com/v1/reference/rest-auth-summary
|
ccxt/bitfinex2.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.bitfinex2 import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currency, Int, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
9
|
+
from ccxt.base.types import Balances, Currencies, Currency, Int, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import PermissionDenied
|
@@ -630,7 +630,7 @@ class bitfinex2(Exchange, ImplicitAPI):
|
|
630
630
|
})
|
631
631
|
return result
|
632
632
|
|
633
|
-
def fetch_currencies(self, params={}):
|
633
|
+
def fetch_currencies(self, params={}) -> Currencies:
|
634
634
|
"""
|
635
635
|
fetches all available currencies on an exchange
|
636
636
|
:see: https://docs.bitfinex.com/reference/rest-public-conf
|
@@ -2261,7 +2261,7 @@ class bitfinex2(Exchange, ImplicitAPI):
|
|
2261
2261
|
},
|
2262
2262
|
}
|
2263
2263
|
|
2264
|
-
def fetch_trading_fees(self, params={}):
|
2264
|
+
def fetch_trading_fees(self, params={}) -> TradingFees:
|
2265
2265
|
"""
|
2266
2266
|
fetch the trading fees for multiple markets
|
2267
2267
|
:see: https://docs.bitfinex.com/reference/rest-auth-summary
|
ccxt/bitflyer.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.bitflyer import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currency, Int, Market, MarketInterface, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Trade, Transaction
|
9
|
+
from ccxt.base.types import Balances, Currency, Int, Market, MarketInterface, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Trade, TradingFeeInterface, Transaction
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import ArgumentsRequired
|
@@ -493,7 +493,7 @@ class bitflyer(Exchange, ImplicitAPI):
|
|
493
493
|
#
|
494
494
|
return self.parse_trades(response, market, since, limit)
|
495
495
|
|
496
|
-
def fetch_trading_fee(self, symbol: str, params={}):
|
496
|
+
def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
|
497
497
|
"""
|
498
498
|
fetch the trading fees for a market
|
499
499
|
:see: https://lightning.bitflyer.com/docs?lang=en#get-trading-commission
|
@@ -518,6 +518,8 @@ class bitflyer(Exchange, ImplicitAPI):
|
|
518
518
|
'symbol': market['symbol'],
|
519
519
|
'maker': fee,
|
520
520
|
'taker': fee,
|
521
|
+
'percentage': None,
|
522
|
+
'tierBased': None,
|
521
523
|
}
|
522
524
|
|
523
525
|
def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|