ccxt 4.4.62__py2.py3-none-any.whl → 4.4.63__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.
- ccxt/__init__.py +1 -1
- ccxt/abstract/bitmart.py +5 -1
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/bingx.py +1 -1
- ccxt/async_support/bitmart.py +155 -54
- ccxt/async_support/bybit.py +5 -5
- ccxt/async_support/gate.py +106 -145
- ccxt/async_support/phemex.py +18 -12
- ccxt/async_support/tradeogre.py +3 -3
- ccxt/async_support/whitebit.py +2 -4
- ccxt/base/errors.py +0 -6
- ccxt/base/exchange.py +12 -7
- ccxt/bingx.py +1 -1
- ccxt/bitmart.py +155 -54
- ccxt/bybit.py +5 -5
- ccxt/gate.py +106 -145
- ccxt/phemex.py +17 -12
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/bitmart.py +64 -53
- ccxt/tradeogre.py +3 -3
- ccxt/whitebit.py +2 -4
- {ccxt-4.4.62.dist-info → ccxt-4.4.63.dist-info}/METADATA +4 -4
- {ccxt-4.4.62.dist-info → ccxt-4.4.63.dist-info}/RECORD +27 -27
- {ccxt-4.4.62.dist-info → ccxt-4.4.63.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.62.dist-info → ccxt-4.4.63.dist-info}/WHEEL +0 -0
- {ccxt-4.4.62.dist-info → ccxt-4.4.63.dist-info}/top_level.txt +0 -0
ccxt/async_support/bybit.py
CHANGED
@@ -1346,7 +1346,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
1346
1346
|
# so we're assuming UTA is enabled
|
1347
1347
|
self.options['enableUnifiedMargin'] = False
|
1348
1348
|
self.options['enableUnifiedAccount'] = True
|
1349
|
-
self.options['unifiedMarginStatus'] =
|
1349
|
+
self.options['unifiedMarginStatus'] = 6
|
1350
1350
|
return [self.options['enableUnifiedMargin'], self.options['enableUnifiedAccount']]
|
1351
1351
|
rawPromises = [self.privateGetV5UserQueryApi(params), self.privateGetV5AccountInfo(params)]
|
1352
1352
|
promises = await asyncio.gather(*rawPromises)
|
@@ -1411,7 +1411,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
1411
1411
|
accountResult = self.safe_dict(accountInfo, 'result', {})
|
1412
1412
|
self.options['enableUnifiedMargin'] = self.safe_integer(result, 'unified') == 1
|
1413
1413
|
self.options['enableUnifiedAccount'] = self.safe_integer(result, 'uta') == 1
|
1414
|
-
self.options['unifiedMarginStatus'] = self.safe_integer(accountResult, 'unifiedMarginStatus',
|
1414
|
+
self.options['unifiedMarginStatus'] = self.safe_integer(accountResult, 'unifiedMarginStatus', 6) # default to uta 2.0 pro if not found
|
1415
1415
|
return [self.options['enableUnifiedMargin'], self.options['enableUnifiedAccount']]
|
1416
1416
|
|
1417
1417
|
async def upgrade_unified_trade_account(self, params={}):
|
@@ -3304,7 +3304,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
3304
3304
|
isInverse = (type == 'inverse')
|
3305
3305
|
isFunding = (lowercaseRawType == 'fund') or (lowercaseRawType == 'funding')
|
3306
3306
|
if isUnifiedAccount:
|
3307
|
-
unifiedMarginStatus = self.safe_integer(self.options, 'unifiedMarginStatus',
|
3307
|
+
unifiedMarginStatus = self.safe_integer(self.options, 'unifiedMarginStatus', 6)
|
3308
3308
|
if unifiedMarginStatus < 5:
|
3309
3309
|
# it's not uta.20 where inverse are unified
|
3310
3310
|
if isInverse:
|
@@ -4009,7 +4009,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
4009
4009
|
ordersRequests.append(orderRequest)
|
4010
4010
|
symbols = self.market_symbols(orderSymbols, None, False, True, True)
|
4011
4011
|
market = self.market(symbols[0])
|
4012
|
-
unifiedMarginStatus = self.safe_integer(self.options, 'unifiedMarginStatus',
|
4012
|
+
unifiedMarginStatus = self.safe_integer(self.options, 'unifiedMarginStatus', 6)
|
4013
4013
|
category = None
|
4014
4014
|
category, params = self.get_bybit_type('createOrders', market, params)
|
4015
4015
|
if (category == 'inverse') and (unifiedMarginStatus < 5):
|
@@ -4208,7 +4208,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
4208
4208
|
ordersRequests.append(orderRequest)
|
4209
4209
|
orderSymbols = self.market_symbols(orderSymbols, None, False, True, True)
|
4210
4210
|
market = self.market(orderSymbols[0])
|
4211
|
-
unifiedMarginStatus = self.safe_integer(self.options, 'unifiedMarginStatus',
|
4211
|
+
unifiedMarginStatus = self.safe_integer(self.options, 'unifiedMarginStatus', 6)
|
4212
4212
|
category = None
|
4213
4213
|
category, params = self.get_bybit_type('editOrders', market, params)
|
4214
4214
|
if (category == 'inverse') and (unifiedMarginStatus < 5):
|
ccxt/async_support/gate.py
CHANGED
@@ -24,7 +24,6 @@ from ccxt.base.errors import OrderImmediatelyFillable
|
|
24
24
|
from ccxt.base.errors import NotSupported
|
25
25
|
from ccxt.base.errors import RateLimitExceeded
|
26
26
|
from ccxt.base.errors import ExchangeNotAvailable
|
27
|
-
from ccxt.base.errors import BadResponse
|
28
27
|
from ccxt.base.decimal_to_precision import TICK_SIZE
|
29
28
|
from ccxt.base.precise import Precise
|
30
29
|
|
@@ -1798,100 +1797,80 @@ class gate(Exchange, ImplicitAPI):
|
|
1798
1797
|
await self.load_unified_status()
|
1799
1798
|
response = await self.publicSpotGetCurrencies(params)
|
1800
1799
|
#
|
1801
|
-
#
|
1802
|
-
#
|
1803
|
-
#
|
1804
|
-
#
|
1805
|
-
#
|
1806
|
-
#
|
1807
|
-
#
|
1808
|
-
#
|
1809
|
-
#
|
1810
|
-
#
|
1811
|
-
#
|
1812
|
-
#
|
1813
|
-
#
|
1814
|
-
|
1815
|
-
# "deposit_disabled":false,
|
1816
|
-
# "trade_disabled":false,
|
1817
|
-
# "chain":"ETH"
|
1818
|
-
# }
|
1819
|
-
#
|
1800
|
+
# [
|
1801
|
+
# {
|
1802
|
+
# "currency": "USDT_ETH",
|
1803
|
+
# "name": "Tether",
|
1804
|
+
# "delisted": False,
|
1805
|
+
# "withdraw_disabled": False,
|
1806
|
+
# "withdraw_delayed": False,
|
1807
|
+
# "deposit_disabled": False,
|
1808
|
+
# "trade_disabled": True,
|
1809
|
+
# "chain": "ETH"
|
1810
|
+
# },
|
1811
|
+
# ]
|
1812
|
+
#
|
1813
|
+
indexedCurrencies = self.index_by(response, 'currency')
|
1820
1814
|
result: dict = {}
|
1821
1815
|
for i in range(0, len(response)):
|
1822
1816
|
entry = response[i]
|
1823
1817
|
currencyId = self.safe_string(entry, 'currency')
|
1824
|
-
currencyIdLower = self.safe_string_lower(entry, 'currency')
|
1825
1818
|
parts = currencyId.split('_')
|
1826
|
-
|
1827
|
-
|
1828
|
-
|
1829
|
-
|
1830
|
-
|
1831
|
-
|
1832
|
-
|
1833
|
-
|
1834
|
-
|
1835
|
-
|
1836
|
-
|
1837
|
-
|
1838
|
-
|
1839
|
-
|
1840
|
-
|
1841
|
-
|
1819
|
+
partFirst = self.safe_string(parts, 0)
|
1820
|
+
# if there's an underscore then the second part is always the chain name(except the _OLD suffix)
|
1821
|
+
currencyName = currencyId if currencyId.endswith('_OLD') else partFirst
|
1822
|
+
withdrawEnabled = not self.safe_bool(entry, 'withdraw_disabled')
|
1823
|
+
depositEnabled = not self.safe_bool(entry, 'deposit_disabled')
|
1824
|
+
tradeDisabled = not self.safe_bool(entry, 'trade_disabled')
|
1825
|
+
precision = self.parse_number('0.0001') # temporary safe default, because no value provided from API
|
1826
|
+
code = self.safe_currency_code(currencyName)
|
1827
|
+
# check leveraged tokens(e.g. BTC3S, ETH5L)
|
1828
|
+
isLeveragedToken = False
|
1829
|
+
if currencyId.endswith('3S') or currencyId.endswith('3L') or currencyId.endswith('5S') or currencyId.endswith('5L'):
|
1830
|
+
realCurrencyId = currencyId[0:-2]
|
1831
|
+
if realCurrencyId in indexedCurrencies:
|
1832
|
+
isLeveragedToken = True
|
1833
|
+
type = 'leveraged' if isLeveragedToken else 'crypto'
|
1834
|
+
# some networks are null, they are mostly obsolete & unsupported dead tokens, so we can default their networkId to their tokenname
|
1835
|
+
networkId = self.safe_string(entry, 'chain', currencyId)
|
1836
|
+
networkCode = self.network_id_to_code(networkId, code)
|
1837
|
+
networkEntry = {
|
1838
|
+
'info': entry,
|
1839
|
+
'id': networkId,
|
1840
|
+
'network': networkCode,
|
1841
|
+
'limits': {
|
1842
|
+
'deposit': {
|
1843
|
+
'min': None,
|
1844
|
+
'max': None,
|
1845
|
+
},
|
1846
|
+
'withdraw': {
|
1847
|
+
'min': None,
|
1848
|
+
'max': None,
|
1849
|
+
},
|
1850
|
+
},
|
1851
|
+
'active': not tradeDisabled,
|
1852
|
+
'deposit': depositEnabled,
|
1853
|
+
'withdraw': withdrawEnabled,
|
1854
|
+
'fee': None,
|
1855
|
+
'precision': precision,
|
1856
|
+
}
|
1857
|
+
# check if first entry for the specific currency
|
1858
|
+
if not (code in result):
|
1842
1859
|
result[code] = {
|
1843
|
-
'id':
|
1860
|
+
'id': currencyName,
|
1861
|
+
'lowerCaseId': currencyName.lower(),
|
1844
1862
|
'code': code,
|
1845
|
-
'
|
1846
|
-
'
|
1847
|
-
'active': active,
|
1848
|
-
'deposit': depositEnabled,
|
1849
|
-
'withdraw': withdrawEnabled,
|
1850
|
-
'fee': None,
|
1851
|
-
'fees': [],
|
1852
|
-
'precision': self.parse_number('1e-4'),
|
1863
|
+
'type': type,
|
1864
|
+
'precision': precision,
|
1853
1865
|
'limits': self.limits,
|
1854
1866
|
'networks': {},
|
1867
|
+
'info': [], # will be filled below
|
1855
1868
|
}
|
1856
|
-
|
1857
|
-
|
1858
|
-
withdrawAvailable = self.safe_value(result[code], 'withdraw')
|
1859
|
-
withdrawAvailable = withdrawEnabled if (withdrawEnabled) else withdrawAvailable
|
1860
|
-
networks = self.safe_value(result[code], 'networks', {})
|
1861
|
-
if networkCode is not None:
|
1862
|
-
networks[networkCode] = {
|
1863
|
-
'info': entry,
|
1864
|
-
'id': networkId,
|
1865
|
-
'network': networkCode,
|
1866
|
-
'currencyId': currencyId,
|
1867
|
-
'lowerCaseCurrencyId': currencyIdLower,
|
1868
|
-
'deposit': depositEnabled,
|
1869
|
-
'withdraw': withdrawEnabled,
|
1870
|
-
'active': active,
|
1871
|
-
'fee': None,
|
1872
|
-
'precision': self.parse_number('1e-4'),
|
1873
|
-
'limits': {
|
1874
|
-
'amount': {
|
1875
|
-
'min': None,
|
1876
|
-
'max': None,
|
1877
|
-
},
|
1878
|
-
'withdraw': {
|
1879
|
-
'min': None,
|
1880
|
-
'max': None,
|
1881
|
-
},
|
1882
|
-
'deposit': {
|
1883
|
-
'min': None,
|
1884
|
-
'max': None,
|
1885
|
-
},
|
1886
|
-
},
|
1887
|
-
}
|
1888
|
-
result[code]['networks'] = networks
|
1889
|
-
info = self.safe_value(result[code], 'info', [])
|
1869
|
+
result[code]['networks'][networkCode] = networkEntry
|
1870
|
+
info = self.safe_list(result[code], 'info', [])
|
1890
1871
|
info.append(entry)
|
1891
1872
|
result[code]['info'] = info
|
1892
|
-
result[code][
|
1893
|
-
result[code]['deposit'] = depositAvailable
|
1894
|
-
result[code]['withdraw'] = withdrawAvailable
|
1873
|
+
result[code] = self.safe_currency_structure(result[code]) # self is needed after adding network entry
|
1895
1874
|
return result
|
1896
1875
|
|
1897
1876
|
async def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
|
@@ -2136,6 +2115,27 @@ class gate(Exchange, ImplicitAPI):
|
|
2136
2115
|
}
|
2137
2116
|
return result
|
2138
2117
|
|
2118
|
+
async def fetch_deposit_addresses_by_network(self, code: str, params={}) -> List[DepositAddress]:
|
2119
|
+
"""
|
2120
|
+
fetch a dictionary of addresses for a currency, indexed by network
|
2121
|
+
:param str code: unified currency code of the currency for the deposit address
|
2122
|
+
:param dict [params]: extra parameters specific to the api endpoint
|
2123
|
+
:returns dict: a dictionary of `address structures <https://docs.ccxt.com/#/?id=address-structure>` indexed by the network
|
2124
|
+
"""
|
2125
|
+
await self.load_markets()
|
2126
|
+
currency = self.currency(code)
|
2127
|
+
request = {
|
2128
|
+
'currency': currency['id'],
|
2129
|
+
}
|
2130
|
+
response = await self.privateWalletGetDepositAddress(self.extend(request, params))
|
2131
|
+
chains = self.safe_value(response, 'multichain_addresses', [])
|
2132
|
+
currencyId = self.safe_string(response, 'currency')
|
2133
|
+
currency = self.safe_currency(currencyId, currency)
|
2134
|
+
parsed = self.parse_deposit_addresses(chains, [currency['code']], False, {
|
2135
|
+
'currency': currency['id'],
|
2136
|
+
})
|
2137
|
+
return self.index_by(parsed, 'network')
|
2138
|
+
|
2139
2139
|
async def fetch_deposit_address(self, code: str, params={}) -> DepositAddress:
|
2140
2140
|
"""
|
2141
2141
|
fetch the deposit address for a currency associated with self account
|
@@ -2148,65 +2148,30 @@ class gate(Exchange, ImplicitAPI):
|
|
2148
2148
|
:returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
|
2149
2149
|
"""
|
2150
2150
|
await self.load_markets()
|
2151
|
-
|
2152
|
-
|
2153
|
-
|
2154
|
-
|
2155
|
-
|
2156
|
-
|
2157
|
-
|
2151
|
+
networkCode = None
|
2152
|
+
networkCode, params = self.handle_network_code_and_params(params)
|
2153
|
+
chainsIndexedById = await self.fetch_deposit_addresses_by_network(code, params)
|
2154
|
+
selectedNetworkId = self.select_network_code_from_unified_networks(code, networkCode, chainsIndexedById)
|
2155
|
+
return chainsIndexedById[selectedNetworkId]
|
2156
|
+
|
2157
|
+
def parse_deposit_address(self, depositAddress, currency=None):
|
2158
2158
|
#
|
2159
|
-
#
|
2160
|
-
#
|
2161
|
-
#
|
2162
|
-
#
|
2163
|
-
#
|
2164
|
-
#
|
2165
|
-
#
|
2166
|
-
# "payment_id": "391331007",
|
2167
|
-
# "payment_name": "Tag",
|
2168
|
-
# "obtain_failed": 0
|
2169
|
-
# }
|
2170
|
-
# ]
|
2171
|
-
# }
|
2159
|
+
# {
|
2160
|
+
# chain: "BTC",
|
2161
|
+
# address: "1Nxu.......Ys",
|
2162
|
+
# payment_id: "",
|
2163
|
+
# payment_name: "",
|
2164
|
+
# obtain_failed: "0",
|
2165
|
+
# }
|
2172
2166
|
#
|
2173
|
-
|
2174
|
-
code = self.safe_currency_code(currencyId)
|
2175
|
-
networkId = self.network_code_to_id(rawNetwork, code)
|
2176
|
-
network = None
|
2177
|
-
tag = None
|
2178
|
-
address = None
|
2179
|
-
if networkId is not None:
|
2180
|
-
addresses = self.safe_value(response, 'multichain_addresses')
|
2181
|
-
for i in range(0, len(addresses)):
|
2182
|
-
entry = addresses[i]
|
2183
|
-
entryNetwork = self.safe_string(entry, 'chain')
|
2184
|
-
if networkId == entryNetwork:
|
2185
|
-
obtainFailed = self.safe_integer(entry, 'obtain_failed')
|
2186
|
-
if obtainFailed:
|
2187
|
-
break
|
2188
|
-
address = self.safe_string(entry, 'address')
|
2189
|
-
tag = self.safe_string(entry, 'payment_id')
|
2190
|
-
network = self.network_id_to_code(networkId, code)
|
2191
|
-
break
|
2192
|
-
else:
|
2193
|
-
addressField = self.safe_string(response, 'address')
|
2194
|
-
if addressField is not None:
|
2195
|
-
if addressField.find('New address is being generated for you, please wait') >= 0:
|
2196
|
-
raise BadResponse(self.id + ' ' + 'New address is being generated for you, please wait a few seconds and try again to get the address.')
|
2197
|
-
if addressField.find(' ') >= 0:
|
2198
|
-
splitted = addressField.split(' ')
|
2199
|
-
address = splitted[0]
|
2200
|
-
tag = splitted[1]
|
2201
|
-
else:
|
2202
|
-
address = addressField
|
2167
|
+
address = self.safe_string(depositAddress, 'address')
|
2203
2168
|
self.check_address(address)
|
2204
2169
|
return {
|
2205
|
-
'info':
|
2206
|
-
'currency': code,
|
2207
|
-
'network': network,
|
2170
|
+
'info': depositAddress,
|
2171
|
+
'currency': self.safe_string(currency, 'code'),
|
2208
2172
|
'address': address,
|
2209
|
-
'tag':
|
2173
|
+
'tag': self.safe_string(depositAddress, 'payment_id'),
|
2174
|
+
'network': self.network_id_to_code(self.safe_string(depositAddress, 'chain')),
|
2210
2175
|
}
|
2211
2176
|
|
2212
2177
|
async def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
|
@@ -3819,14 +3784,10 @@ class gate(Exchange, ImplicitAPI):
|
|
3819
3784
|
}
|
3820
3785
|
if tag is not None:
|
3821
3786
|
request['memo'] = tag
|
3822
|
-
|
3823
|
-
|
3824
|
-
|
3825
|
-
|
3826
|
-
request['chain'] = network
|
3827
|
-
params = self.omit(params, 'network')
|
3828
|
-
else:
|
3829
|
-
request['chain'] = currency['id'] # todo: currencies have network-junctions
|
3787
|
+
networkCode = None
|
3788
|
+
networkCode, params = self.handle_network_code_and_params(params)
|
3789
|
+
if networkCode is not None:
|
3790
|
+
request['chain'] = self.network_code_to_id(networkCode)
|
3830
3791
|
response = await self.privateWithdrawalsPostWithdrawals(self.extend(request, params))
|
3831
3792
|
#
|
3832
3793
|
# {
|
ccxt/async_support/phemex.py
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.phemex import ImplicitAPI
|
8
|
+
import asyncio
|
8
9
|
import hashlib
|
9
10
|
import numbers
|
10
11
|
from ccxt.base.types import Any, Balances, Conversion, Currencies, Currency, DepositAddress, Int, LeverageTier, LeverageTiers, MarginModification, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, Trade, Transaction, TransferEntry
|
@@ -685,7 +686,8 @@ class phemex(Exchange, ImplicitAPI):
|
|
685
686
|
# }
|
686
687
|
#
|
687
688
|
id = self.safe_string(market, 'symbol')
|
688
|
-
|
689
|
+
contractUnderlyingAssets = self.safe_string(market, 'contractUnderlyingAssets')
|
690
|
+
baseId = self.safe_string(market, 'baseCurrency', contractUnderlyingAssets)
|
689
691
|
quoteId = self.safe_string(market, 'quoteCurrency')
|
690
692
|
settleId = self.safe_string(market, 'settleCurrency')
|
691
693
|
base = self.safe_currency_code(baseId)
|
@@ -695,6 +697,9 @@ class phemex(Exchange, ImplicitAPI):
|
|
695
697
|
inverse = False
|
696
698
|
if settleId != quoteId:
|
697
699
|
inverse = True
|
700
|
+
# some unhandled cases
|
701
|
+
if not ('baseCurrency' in market) and base == quote:
|
702
|
+
base = settle
|
698
703
|
priceScale = self.safe_integer(market, 'priceScale')
|
699
704
|
ratioScale = self.safe_integer(market, 'ratioScale')
|
700
705
|
valueScale = self.safe_integer(market, 'valueScale')
|
@@ -880,7 +885,7 @@ class phemex(Exchange, ImplicitAPI):
|
|
880
885
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
881
886
|
:returns dict[]: an array of objects representing market data
|
882
887
|
"""
|
883
|
-
|
888
|
+
v2ProductsPromise = self.v2GetPublicProducts(params)
|
884
889
|
#
|
885
890
|
# {
|
886
891
|
# "code":0,
|
@@ -1030,7 +1035,8 @@ class phemex(Exchange, ImplicitAPI):
|
|
1030
1035
|
# }
|
1031
1036
|
# }
|
1032
1037
|
#
|
1033
|
-
|
1038
|
+
v1ProductsPromise = self.v1GetExchangePublicProducts(params)
|
1039
|
+
v2Products, v1Products = await asyncio.gather(*[v2ProductsPromise, v1ProductsPromise])
|
1034
1040
|
v1ProductsData = self.safe_value(v1Products, 'data', [])
|
1035
1041
|
#
|
1036
1042
|
# {
|
@@ -1067,14 +1073,14 @@ class phemex(Exchange, ImplicitAPI):
|
|
1067
1073
|
# ]
|
1068
1074
|
# }
|
1069
1075
|
#
|
1070
|
-
v2ProductsData = self.
|
1071
|
-
products = self.
|
1072
|
-
perpetualProductsV2 = self.
|
1076
|
+
v2ProductsData = self.safe_dict(v2Products, 'data', {})
|
1077
|
+
products = self.safe_list(v2ProductsData, 'products', [])
|
1078
|
+
perpetualProductsV2 = self.safe_list(v2ProductsData, 'perpProductsV2', [])
|
1073
1079
|
products = self.array_concat(products, perpetualProductsV2)
|
1074
|
-
riskLimits = self.
|
1075
|
-
riskLimitsV2 = self.
|
1080
|
+
riskLimits = self.safe_list(v2ProductsData, 'riskLimits', [])
|
1081
|
+
riskLimitsV2 = self.safe_list(v2ProductsData, 'riskLimitsV2', [])
|
1076
1082
|
riskLimits = self.array_concat(riskLimits, riskLimitsV2)
|
1077
|
-
currencies = self.
|
1083
|
+
currencies = self.safe_list(v2ProductsData, 'currencies', [])
|
1078
1084
|
riskLimitsById = self.index_by(riskLimits, 'symbol')
|
1079
1085
|
v1ProductsById = self.index_by(v1ProductsData, 'symbol')
|
1080
1086
|
currenciesByCode = self.index_by(currencies, 'currency')
|
@@ -1084,14 +1090,14 @@ class phemex(Exchange, ImplicitAPI):
|
|
1084
1090
|
type = self.safe_string_lower(market, 'type')
|
1085
1091
|
if (type == 'perpetual') or (type == 'perpetualv2') or (type == 'perpetualpilot'):
|
1086
1092
|
id = self.safe_string(market, 'symbol')
|
1087
|
-
riskLimitValues = self.
|
1093
|
+
riskLimitValues = self.safe_dict(riskLimitsById, id, {})
|
1088
1094
|
market = self.extend(market, riskLimitValues)
|
1089
|
-
v1ProductsValues = self.
|
1095
|
+
v1ProductsValues = self.safe_dict(v1ProductsById, id, {})
|
1090
1096
|
market = self.extend(market, v1ProductsValues)
|
1091
1097
|
market = self.parse_swap_market(market)
|
1092
1098
|
else:
|
1093
1099
|
baseCurrency = self.safe_string(market, 'baseCurrency')
|
1094
|
-
currencyValues = self.
|
1100
|
+
currencyValues = self.safe_dict(currenciesByCode, baseCurrency, {})
|
1095
1101
|
valueScale = self.safe_string(currencyValues, 'valueScale', '8')
|
1096
1102
|
market = self.extend(market, {'valueScale': valueScale})
|
1097
1103
|
market = self.parse_spot_market(market)
|
ccxt/async_support/tradeogre.py
CHANGED
@@ -511,11 +511,11 @@ class tradeogre(Exchange, ImplicitAPI):
|
|
511
511
|
if type == 'market':
|
512
512
|
raise BadRequest(self.id + ' createOrder does not support market orders')
|
513
513
|
if price is None:
|
514
|
-
raise ArgumentsRequired(self.id + ' createOrder requires a
|
514
|
+
raise ArgumentsRequired(self.id + ' createOrder requires a price parameter')
|
515
515
|
request: dict = {
|
516
516
|
'market': market['id'],
|
517
|
-
'quantity': self.
|
518
|
-
'price': self.
|
517
|
+
'quantity': self.amount_to_precision(symbol, amount),
|
518
|
+
'price': self.price_to_precision(symbol, price),
|
519
519
|
}
|
520
520
|
response = None
|
521
521
|
if side == 'buy':
|
ccxt/async_support/whitebit.py
CHANGED
@@ -2603,12 +2603,10 @@ class whitebit(Exchange, ImplicitAPI):
|
|
2603
2603
|
url += '?' + self.urlencode(query)
|
2604
2604
|
if accessibility == 'private':
|
2605
2605
|
self.check_required_credentials()
|
2606
|
-
nonce = self.nonce()
|
2607
|
-
timestamp = self.parse_to_int(nonce / 1000)
|
2608
|
-
timestampString = str(timestamp)
|
2606
|
+
nonce = str(self.nonce())
|
2609
2607
|
secret = self.encode(self.secret)
|
2610
2608
|
request = '/' + 'api' + '/' + version + pathWithParams
|
2611
|
-
body = self.json(self.extend({'request': request, 'nonce':
|
2609
|
+
body = self.json(self.extend({'request': request, 'nonce': nonce}, params))
|
2612
2610
|
payload = self.string_to_base64(body)
|
2613
2611
|
signature = self.hmac(self.encode(payload), secret, hashlib.sha512)
|
2614
2612
|
headers = {
|
ccxt/base/errors.py
CHANGED
@@ -1,9 +1,3 @@
|
|
1
|
-
# ----------------------------------------------------------------------------
|
2
|
-
|
3
|
-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
|
4
|
-
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
|
5
|
-
# EDIT THE CORRESPONDENT .ts FILE INSTEAD
|
6
|
-
|
7
1
|
error_hierarchy = {
|
8
2
|
'BaseError': {
|
9
3
|
'ExchangeError': {
|
ccxt/base/exchange.py
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
# -----------------------------------------------------------------------------
|
6
6
|
|
7
|
-
__version__ = '4.4.
|
7
|
+
__version__ = '4.4.63'
|
8
8
|
|
9
9
|
# -----------------------------------------------------------------------------
|
10
10
|
|
@@ -1450,11 +1450,11 @@ class Exchange(object):
|
|
1450
1450
|
|
1451
1451
|
@staticmethod
|
1452
1452
|
def encode(string):
|
1453
|
-
return string.encode('
|
1453
|
+
return string.encode('utf-8')
|
1454
1454
|
|
1455
1455
|
@staticmethod
|
1456
1456
|
def decode(string):
|
1457
|
-
return string.decode('
|
1457
|
+
return string.decode('utf-8')
|
1458
1458
|
|
1459
1459
|
@staticmethod
|
1460
1460
|
def to_array(value):
|
@@ -2903,6 +2903,9 @@ class Exchange(object):
|
|
2903
2903
|
|
2904
2904
|
def safe_currency_structure(self, currency: object):
|
2905
2905
|
# derive data from networks: deposit, withdraw, active, fee, limits, precision
|
2906
|
+
currencyDeposit = self.safe_bool(currency, 'deposit')
|
2907
|
+
currencyWithdraw = self.safe_bool(currency, 'withdraw')
|
2908
|
+
currencyActive = self.safe_bool(currency, 'active')
|
2906
2909
|
networks = self.safe_dict(currency, 'networks', {})
|
2907
2910
|
keys = list(networks.keys())
|
2908
2911
|
length = len(keys)
|
@@ -2910,13 +2913,13 @@ class Exchange(object):
|
|
2910
2913
|
for i in range(0, length):
|
2911
2914
|
network = networks[keys[i]]
|
2912
2915
|
deposit = self.safe_bool(network, 'deposit')
|
2913
|
-
if
|
2916
|
+
if currencyDeposit is None or deposit:
|
2914
2917
|
currency['deposit'] = deposit
|
2915
2918
|
withdraw = self.safe_bool(network, 'withdraw')
|
2916
|
-
if
|
2919
|
+
if currencyWithdraw is None or withdraw:
|
2917
2920
|
currency['withdraw'] = withdraw
|
2918
2921
|
active = self.safe_bool(network, 'active')
|
2919
|
-
if
|
2922
|
+
if currencyActive is None or active:
|
2920
2923
|
currency['active'] = active
|
2921
2924
|
# find lowest fee(which is more desired)
|
2922
2925
|
fee = self.safe_string(network, 'fee')
|
@@ -4065,7 +4068,9 @@ class Exchange(object):
|
|
4065
4068
|
# if networkCode was not provided by user, then we try to use the default network(if it was defined in "defaultNetworks"), otherwise, we just return the first network entry
|
4066
4069
|
defaultNetworkCode = self.default_network_code(currencyCode)
|
4067
4070
|
defaultNetworkId = defaultNetworkCode if isIndexedByUnifiedNetworkCode else self.network_code_to_id(defaultNetworkCode, currencyCode)
|
4068
|
-
|
4071
|
+
if defaultNetworkId in indexedNetworkEntries:
|
4072
|
+
return defaultNetworkId
|
4073
|
+
raise NotSupported(self.id + ' - can not determine the default network, please pass param["network"] one from : ' + ', '.join(availableNetworkIds))
|
4069
4074
|
return chosenNetworkId
|
4070
4075
|
|
4071
4076
|
def safe_number_2(self, dictionary: object, key1: IndexType, key2: IndexType, d=None):
|
ccxt/bingx.py
CHANGED
@@ -4471,7 +4471,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
4471
4471
|
response = self.contractV1PrivateGetAllOrders(self.extend(request, params))
|
4472
4472
|
elif type == 'spot':
|
4473
4473
|
if limit is not None:
|
4474
|
-
request['
|
4474
|
+
request['pageSize'] = limit
|
4475
4475
|
response = self.spotV1PrivateGetTradeHistoryOrders(self.extend(request, params))
|
4476
4476
|
#
|
4477
4477
|
# {
|