ccxt 4.2.48__py2.py3-none-any.whl → 4.2.49__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/bitstamp.py +8 -0
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/binance.py +6 -3
- ccxt/async_support/bitmart.py +24 -2
- ccxt/async_support/bitstamp.py +8 -0
- ccxt/async_support/btcalpha.py +4 -0
- ccxt/async_support/btcmarkets.py +4 -0
- ccxt/async_support/btcturk.py +4 -0
- ccxt/async_support/bybit.py +132 -6
- ccxt/async_support/independentreserve.py +47 -1
- ccxt/async_support/latoken.py +16 -0
- ccxt/async_support/luno.py +18 -0
- ccxt/async_support/lykke.py +19 -0
- ccxt/async_support/ndax.py +18 -0
- ccxt/async_support/upbit.py +8 -1
- ccxt/base/exchange.py +2 -2
- ccxt/binance.py +6 -3
- ccxt/bitmart.py +24 -2
- ccxt/bitstamp.py +8 -0
- ccxt/btcalpha.py +4 -0
- ccxt/btcmarkets.py +4 -0
- ccxt/btcturk.py +4 -0
- ccxt/bybit.py +132 -6
- ccxt/independentreserve.py +47 -1
- ccxt/latoken.py +16 -0
- ccxt/luno.py +18 -0
- ccxt/lykke.py +19 -0
- ccxt/ndax.py +18 -0
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/ascendex.py +19 -7
- ccxt/pro/bitget.py +24 -7
- ccxt/pro/bitstamp.py +1 -1
- ccxt/pro/mexc.py +2 -1
- ccxt/test/test_async.py +10 -10
- ccxt/test/test_sync.py +10 -10
- ccxt/upbit.py +8 -1
- {ccxt-4.2.48.dist-info → ccxt-4.2.49.dist-info}/METADATA +4 -4
- {ccxt-4.2.48.dist-info → ccxt-4.2.49.dist-info}/RECORD +42 -42
- {ccxt-4.2.48.dist-info → ccxt-4.2.49.dist-info}/WHEEL +0 -0
- {ccxt-4.2.48.dist-info → ccxt-4.2.49.dist-info}/top_level.txt +0 -0
ccxt/ndax.py
CHANGED
@@ -284,6 +284,7 @@ class ndax(Exchange, ImplicitAPI):
|
|
284
284
|
def sign_in(self, params={}):
|
285
285
|
"""
|
286
286
|
sign in, must be called prior to using other authenticated methods
|
287
|
+
:see: https://apidoc.ndax.io/#authenticate2fa
|
287
288
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
288
289
|
:returns: response from exchange
|
289
290
|
"""
|
@@ -331,6 +332,7 @@ class ndax(Exchange, ImplicitAPI):
|
|
331
332
|
def fetch_currencies(self, params={}):
|
332
333
|
"""
|
333
334
|
fetches all available currencies on an exchange
|
335
|
+
:see: https://apidoc.ndax.io/#getproduct
|
334
336
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
335
337
|
:returns dict: an associative dictionary of currencies
|
336
338
|
"""
|
@@ -396,6 +398,7 @@ class ndax(Exchange, ImplicitAPI):
|
|
396
398
|
def fetch_markets(self, params={}):
|
397
399
|
"""
|
398
400
|
retrieves data on all markets for ndax
|
401
|
+
:see: https://apidoc.ndax.io/#getinstruments
|
399
402
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
400
403
|
:returns dict[]: an array of objects representing market data
|
401
404
|
"""
|
@@ -548,6 +551,7 @@ class ndax(Exchange, ImplicitAPI):
|
|
548
551
|
def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
|
549
552
|
"""
|
550
553
|
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
|
554
|
+
:see: https://apidoc.ndax.io/#getl2snapshot
|
551
555
|
:param str symbol: unified symbol of the market to fetch the order book for
|
552
556
|
:param int [limit]: the maximum amount of order book entries to return
|
553
557
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -656,6 +660,7 @@ class ndax(Exchange, ImplicitAPI):
|
|
656
660
|
def fetch_ticker(self, symbol: str, params={}) -> Ticker:
|
657
661
|
"""
|
658
662
|
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
663
|
+
:see: https://apidoc.ndax.io/#getlevel1
|
659
664
|
:param str symbol: unified symbol of the market to fetch the ticker for
|
660
665
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
661
666
|
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
|
@@ -726,6 +731,7 @@ class ndax(Exchange, ImplicitAPI):
|
|
726
731
|
def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
|
727
732
|
"""
|
728
733
|
fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
734
|
+
:see: https://apidoc.ndax.io/#gettickerhistory
|
729
735
|
:param str symbol: unified symbol of the market to fetch OHLCV data for
|
730
736
|
:param str timeframe: the length of time each candle represents
|
731
737
|
:param int [since]: timestamp in ms of the earliest candle to fetch
|
@@ -959,6 +965,7 @@ class ndax(Exchange, ImplicitAPI):
|
|
959
965
|
def fetch_accounts(self, params={}):
|
960
966
|
"""
|
961
967
|
fetch all the accounts associated with a profile
|
968
|
+
:see: https://apidoc.ndax.io/#getuseraccounts
|
962
969
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
963
970
|
:returns dict: a dictionary of `account structures <https://docs.ccxt.com/#/?id=account-structure>` indexed by the account type
|
964
971
|
"""
|
@@ -1006,6 +1013,7 @@ class ndax(Exchange, ImplicitAPI):
|
|
1006
1013
|
def fetch_balance(self, params={}) -> Balances:
|
1007
1014
|
"""
|
1008
1015
|
query for balance and get the amount of funds available for trading or funds locked in orders
|
1016
|
+
:see: https://apidoc.ndax.io/#getaccountpositions
|
1009
1017
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1010
1018
|
:returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
|
1011
1019
|
"""
|
@@ -1127,6 +1135,7 @@ class ndax(Exchange, ImplicitAPI):
|
|
1127
1135
|
def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
1128
1136
|
"""
|
1129
1137
|
fetch the history of changes, actions done by the user or operations that altered balance of the user
|
1138
|
+
:see: https://apidoc.ndax.io/#getaccounttransactions
|
1130
1139
|
:param str code: unified currency code, default is None
|
1131
1140
|
:param int [since]: timestamp in ms of the earliest ledger entry, default is None
|
1132
1141
|
:param int [limit]: max number of ledger entrys to return, default is None
|
@@ -1277,6 +1286,7 @@ class ndax(Exchange, ImplicitAPI):
|
|
1277
1286
|
def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: float = None, params={}):
|
1278
1287
|
"""
|
1279
1288
|
create a trade order
|
1289
|
+
:see: https://apidoc.ndax.io/#sendorder
|
1280
1290
|
:param str symbol: unified symbol of the market to create an order in
|
1281
1291
|
:param str type: 'market' or 'limit'
|
1282
1292
|
:param str side: 'buy' or 'sell'
|
@@ -1385,6 +1395,7 @@ class ndax(Exchange, ImplicitAPI):
|
|
1385
1395
|
def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
1386
1396
|
"""
|
1387
1397
|
fetch all trades made by the user
|
1398
|
+
:see: https://apidoc.ndax.io/#gettradeshistory
|
1388
1399
|
:param str symbol: unified market symbol
|
1389
1400
|
:param int [since]: the earliest time in ms to fetch trades for
|
1390
1401
|
:param int [limit]: the maximum number of trades structures to retrieve
|
@@ -1467,6 +1478,7 @@ class ndax(Exchange, ImplicitAPI):
|
|
1467
1478
|
def cancel_all_orders(self, symbol: Str = None, params={}):
|
1468
1479
|
"""
|
1469
1480
|
cancel all open orders
|
1481
|
+
:see: https://apidoc.ndax.io/#cancelallorders
|
1470
1482
|
:param str symbol: unified market symbol, only orders in the market of self symbol are cancelled when symbol is not None
|
1471
1483
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1472
1484
|
:returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
@@ -1498,6 +1510,7 @@ class ndax(Exchange, ImplicitAPI):
|
|
1498
1510
|
def cancel_order(self, id: str, symbol: Str = None, params={}):
|
1499
1511
|
"""
|
1500
1512
|
cancels an open order
|
1513
|
+
:see: https://apidoc.ndax.io/#cancelorder
|
1501
1514
|
:param str id: order id
|
1502
1515
|
:param str symbol: unified symbol of the market the order was made in
|
1503
1516
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -1532,6 +1545,7 @@ class ndax(Exchange, ImplicitAPI):
|
|
1532
1545
|
def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
1533
1546
|
"""
|
1534
1547
|
fetch all unfilled currently open orders
|
1548
|
+
:see: https://apidoc.ndax.io/#getopenorders
|
1535
1549
|
:param str symbol: unified market symbol
|
1536
1550
|
:param int [since]: the earliest time in ms to fetch open orders for
|
1537
1551
|
:param int [limit]: the maximum number of open orders structures to retrieve
|
@@ -1607,6 +1621,7 @@ class ndax(Exchange, ImplicitAPI):
|
|
1607
1621
|
def fetch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
1608
1622
|
"""
|
1609
1623
|
fetches information on multiple orders made by the user
|
1624
|
+
:see: https://apidoc.ndax.io/#getorderhistory
|
1610
1625
|
:param str symbol: unified market symbol of the market orders were made in
|
1611
1626
|
:param int [since]: the earliest time in ms to fetch orders for
|
1612
1627
|
:param int [limit]: the maximum number of order structures to retrieve
|
@@ -1696,6 +1711,7 @@ class ndax(Exchange, ImplicitAPI):
|
|
1696
1711
|
def fetch_order(self, id: str, symbol: Str = None, params={}):
|
1697
1712
|
"""
|
1698
1713
|
fetches information on an order made by the user
|
1714
|
+
:see: https://apidoc.ndax.io/#getorderstatus
|
1699
1715
|
:param str symbol: unified symbol of the market the order was made in
|
1700
1716
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1701
1717
|
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
@@ -1768,6 +1784,7 @@ class ndax(Exchange, ImplicitAPI):
|
|
1768
1784
|
def fetch_order_trades(self, id: str, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
1769
1785
|
"""
|
1770
1786
|
fetch all the trades made from a single order
|
1787
|
+
:see: https://apidoc.ndax.io/#getorderhistorybyorderid
|
1771
1788
|
:param str id: order id
|
1772
1789
|
:param str symbol: unified market symbol
|
1773
1790
|
:param int [since]: the earliest time in ms to fetch trades for
|
@@ -1984,6 +2001,7 @@ class ndax(Exchange, ImplicitAPI):
|
|
1984
2001
|
def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
|
1985
2002
|
"""
|
1986
2003
|
fetch all withdrawals made from an account
|
2004
|
+
:see: https://apidoc.ndax.io/#getwithdraws
|
1987
2005
|
:param str code: unified currency code
|
1988
2006
|
:param int [since]: the earliest time in ms to fetch withdrawals for
|
1989
2007
|
:param int [limit]: the maximum number of withdrawals structures to retrieve
|
ccxt/pro/__init__.py
CHANGED
ccxt/pro/ascendex.py
CHANGED
@@ -202,7 +202,7 @@ class ascendex(ccxt.async_support.ascendex):
|
|
202
202
|
"""
|
203
203
|
await self.load_markets()
|
204
204
|
market = self.market(symbol)
|
205
|
-
channel = 'depth
|
205
|
+
channel = 'depth' + ':' + market['id']
|
206
206
|
params = self.extend(params, {
|
207
207
|
'ch': channel,
|
208
208
|
})
|
@@ -212,7 +212,7 @@ class ascendex(ccxt.async_support.ascendex):
|
|
212
212
|
async def watch_order_book_snapshot(self, symbol: str, limit: Int = None, params={}):
|
213
213
|
await self.load_markets()
|
214
214
|
market = self.market(symbol)
|
215
|
-
action = 'depth-snapshot
|
215
|
+
action = 'depth-snapshot'
|
216
216
|
channel = action + ':' + market['id']
|
217
217
|
params = self.extend(params, {
|
218
218
|
'action': action,
|
@@ -224,6 +224,14 @@ class ascendex(ccxt.async_support.ascendex):
|
|
224
224
|
orderbook = await self.watch_public(channel, params)
|
225
225
|
return orderbook.limit()
|
226
226
|
|
227
|
+
async def fetch_order_book_snapshot(self, symbol: str, limit: Int = None, params={}):
|
228
|
+
restOrderBook = await self.fetch_rest_order_book_safe(symbol, limit, params)
|
229
|
+
if not (symbol in self.orderbooks):
|
230
|
+
self.orderbooks[symbol] = self.order_book()
|
231
|
+
orderbook = self.orderbooks[symbol]
|
232
|
+
orderbook.reset(restOrderBook)
|
233
|
+
return orderbook
|
234
|
+
|
227
235
|
def handle_order_book_snapshot(self, client: Client, message):
|
228
236
|
#
|
229
237
|
# {
|
@@ -826,8 +834,8 @@ class ascendex(ccxt.async_support.ascendex):
|
|
826
834
|
'ping': self.handle_ping,
|
827
835
|
'auth': self.handle_authenticate,
|
828
836
|
'sub': self.handle_subscription_status,
|
829
|
-
'depth
|
830
|
-
'depth-snapshot
|
837
|
+
'depth': self.handle_order_book,
|
838
|
+
'depth-snapshot': self.handle_order_book_snapshot,
|
831
839
|
'trades': self.handle_trades,
|
832
840
|
'bar': self.handle_ohlcv,
|
833
841
|
'balance': self.handle_balance,
|
@@ -851,7 +859,7 @@ class ascendex(ccxt.async_support.ascendex):
|
|
851
859
|
# {m: 'sub', id: "1647515701", ch: "depth:BTC/USDT", code: 0}
|
852
860
|
#
|
853
861
|
channel = self.safe_string(message, 'ch', '')
|
854
|
-
if channel.find('depth-
|
862
|
+
if channel.find('depth') > -1 and not (channel.find('depth-snapshot') > -1):
|
855
863
|
self.handle_order_book_subscription(client, message)
|
856
864
|
return message
|
857
865
|
|
@@ -859,11 +867,15 @@ class ascendex(ccxt.async_support.ascendex):
|
|
859
867
|
channel = self.safe_string(message, 'ch')
|
860
868
|
parts = channel.split(':')
|
861
869
|
marketId = parts[1]
|
862
|
-
|
870
|
+
market = self.safe_market(marketId)
|
871
|
+
symbol = market['symbol']
|
863
872
|
if symbol in self.orderbooks:
|
864
873
|
del self.orderbooks[symbol]
|
865
874
|
self.orderbooks[symbol] = self.order_book({})
|
866
|
-
self.
|
875
|
+
if self.options['defaultType'] == 'swap' or market['contract']:
|
876
|
+
self.spawn(self.fetch_order_book_snapshot, symbol)
|
877
|
+
else:
|
878
|
+
self.spawn(self.watch_order_book_snapshot, symbol)
|
867
879
|
|
868
880
|
async def pong(self, client, message):
|
869
881
|
#
|
ccxt/pro/bitget.py
CHANGED
@@ -908,6 +908,7 @@ class bitget(ccxt.async_support.bitget):
|
|
908
908
|
# "clientOid": "798d1425-d31d-4ada-a51b-ec701e00a1d9",
|
909
909
|
# "price": "35000.00",
|
910
910
|
# "size": "7.0000",
|
911
|
+
# "newSize": "500.0000",
|
911
912
|
# "notional": "7.000000",
|
912
913
|
# "orderType": "limit",
|
913
914
|
# "force": "gtc",
|
@@ -1069,6 +1070,7 @@ class bitget(ccxt.async_support.bitget):
|
|
1069
1070
|
# "clientOid": "798d1425-d31d-4ada-a51b-ec701e00a1d9",
|
1070
1071
|
# "price": "35000.00",
|
1071
1072
|
# "size": "7.0000",
|
1073
|
+
# "newSize": "500.0000",
|
1072
1074
|
# "notional": "7.000000",
|
1073
1075
|
# "orderType": "limit",
|
1074
1076
|
# "force": "gtc",
|
@@ -1175,6 +1177,21 @@ class bitget(ccxt.async_support.bitget):
|
|
1175
1177
|
'currency': self.safe_currency_code(feeCurrency),
|
1176
1178
|
}
|
1177
1179
|
triggerPrice = self.safe_number(order, 'triggerPrice')
|
1180
|
+
price = self.safe_string(order, 'price')
|
1181
|
+
avgPrice = self.omit_zero(self.safe_string_2(order, 'priceAvg', 'fillPrice'))
|
1182
|
+
cost = self.safe_string_n(order, ['notional', 'notionalUsd', 'quoteSize'])
|
1183
|
+
side = self.safe_string(order, 'side')
|
1184
|
+
type = self.safe_string(order, 'orderType')
|
1185
|
+
if side == 'buy' and market['spot'] and (type == 'market'):
|
1186
|
+
cost = self.safe_string(order, 'newSize', cost)
|
1187
|
+
filled = self.safe_string_2(order, 'accBaseVolume', 'baseVolume')
|
1188
|
+
if market['spot'] and (rawStatus != 'live'):
|
1189
|
+
filled = Precise.string_div(cost, avgPrice)
|
1190
|
+
amount = self.safe_string(order, 'baseVolume')
|
1191
|
+
if not market['spot'] or not (side == 'buy' and type == 'market'):
|
1192
|
+
amount = self.safe_string(order, 'newSize', amount)
|
1193
|
+
if market['swap'] and (amount is None):
|
1194
|
+
amount = self.safe_string(order, 'size')
|
1178
1195
|
return self.safe_order({
|
1179
1196
|
'info': order,
|
1180
1197
|
'symbol': symbol,
|
@@ -1183,17 +1200,17 @@ class bitget(ccxt.async_support.bitget):
|
|
1183
1200
|
'timestamp': timestamp,
|
1184
1201
|
'datetime': self.iso8601(timestamp),
|
1185
1202
|
'lastTradeTimestamp': self.safe_integer(order, 'uTime'),
|
1186
|
-
'type':
|
1203
|
+
'type': type,
|
1187
1204
|
'timeInForce': self.safe_string_upper(order, 'force'),
|
1188
1205
|
'postOnly': None,
|
1189
|
-
'side':
|
1190
|
-
'price':
|
1206
|
+
'side': side,
|
1207
|
+
'price': price,
|
1191
1208
|
'stopPrice': triggerPrice,
|
1192
1209
|
'triggerPrice': triggerPrice,
|
1193
|
-
'amount':
|
1194
|
-
'cost':
|
1195
|
-
'average':
|
1196
|
-
'filled':
|
1210
|
+
'amount': amount,
|
1211
|
+
'cost': cost,
|
1212
|
+
'average': avgPrice,
|
1213
|
+
'filled': filled,
|
1197
1214
|
'remaining': None,
|
1198
1215
|
'status': self.parse_ws_order_status(rawStatus),
|
1199
1216
|
'fee': feeObject,
|
ccxt/pro/bitstamp.py
CHANGED
@@ -111,7 +111,7 @@ class bitstamp(ccxt.async_support.bitstamp):
|
|
111
111
|
# usually it takes at least 4-5 deltas to resolve
|
112
112
|
snapshotDelay = self.handle_option('watchOrderBook', 'snapshotDelay', 6)
|
113
113
|
if cacheLength == snapshotDelay:
|
114
|
-
self.spawn(self.load_order_book, client, messageHash, symbol)
|
114
|
+
self.spawn(self.load_order_book, client, messageHash, symbol, None, {})
|
115
115
|
storedOrderBook.cache.append(delta)
|
116
116
|
return
|
117
117
|
elif nonce >= deltaNonce:
|
ccxt/pro/mexc.py
CHANGED
@@ -439,6 +439,7 @@ class mexc(ccxt.async_support.mexc):
|
|
439
439
|
symbol = self.safe_symbol(marketId)
|
440
440
|
messageHash = 'orderbook:' + symbol
|
441
441
|
subscription = self.safe_value(client.subscriptions, messageHash)
|
442
|
+
limit = self.safe_integer(subscription, 'limit')
|
442
443
|
if subscription is True:
|
443
444
|
# we set client.subscriptions[messageHash] to 1
|
444
445
|
# once we have received the first delta and initialized the orderbook
|
@@ -450,7 +451,7 @@ class mexc(ccxt.async_support.mexc):
|
|
450
451
|
cacheLength = len(storedOrderBook.cache)
|
451
452
|
snapshotDelay = self.handle_option('watchOrderBook', 'snapshotDelay', 25)
|
452
453
|
if cacheLength == snapshotDelay:
|
453
|
-
self.spawn(self.load_order_book, client, messageHash, symbol)
|
454
|
+
self.spawn(self.load_order_book, client, messageHash, symbol, limit, {})
|
454
455
|
storedOrderBook.cache.append(data)
|
455
456
|
return
|
456
457
|
try:
|
ccxt/test/test_async.py
CHANGED
@@ -158,8 +158,9 @@ def json_stringify(elem):
|
|
158
158
|
return json.dumps(elem)
|
159
159
|
|
160
160
|
|
161
|
-
def convert_to_snake_case(
|
162
|
-
|
161
|
+
def convert_to_snake_case(content):
|
162
|
+
res = re.sub(r'(?<!^)(?=[A-Z])', '_', content).lower()
|
163
|
+
return res.replace('o_h_l_c_v', 'ohlcv')
|
163
164
|
|
164
165
|
|
165
166
|
def get_test_name(methodName):
|
@@ -185,8 +186,7 @@ def io_dir_read(path):
|
|
185
186
|
|
186
187
|
|
187
188
|
async def call_method(test_files, methodName, exchange, skippedProperties, args):
|
188
|
-
methodNameToCall = convert_to_snake_case(methodName)
|
189
|
-
methodNameToCall = 'test_' + methodNameToCall.replace('o_h_l_c_v', 'ohlcv')
|
189
|
+
methodNameToCall = 'test_' + convert_to_snake_case(methodName)
|
190
190
|
return await getattr(test_files[methodName], methodNameToCall)(exchange, skippedProperties, *args)
|
191
191
|
|
192
192
|
|
@@ -583,7 +583,7 @@ class testMainClass(baseMainTestClass):
|
|
583
583
|
result = await self.test_safe('loadMarkets', exchange, [], True)
|
584
584
|
if not result:
|
585
585
|
return False
|
586
|
-
symbols = ['BTC/
|
586
|
+
symbols = ['BTC/USDT', 'BTC/USDC', 'BTC/CNY', 'BTC/USD', 'BTC/EUR', 'BTC/ETH', 'ETH/BTC', 'BTC/JPY', 'ETH/EUR', 'ETH/JPY', 'ETH/CNY', 'ETH/USD', 'LTC/CNY', 'DASH/BTC', 'DOGE/BTC', 'BTC/AUD', 'BTC/PLN', 'USD/SLL', 'BTC/RUB', 'BTC/UAH', 'LTC/BTC', 'EUR/USD']
|
587
587
|
result_symbols = []
|
588
588
|
exchange_specific_symbols = exchange.symbols
|
589
589
|
for i in range(0, len(exchange_specific_symbols)):
|
@@ -638,8 +638,8 @@ class testMainClass(baseMainTestClass):
|
|
638
638
|
def get_valid_symbol(self, exchange, spot=True):
|
639
639
|
current_type_markets = self.get_markets_from_exchange(exchange, spot)
|
640
640
|
codes = ['BTC', 'ETH', 'XRP', 'LTC', 'BCH', 'EOS', 'BNB', 'BSV', 'USDT', 'ATOM', 'BAT', 'BTG', 'DASH', 'DOGE', 'ETC', 'IOTA', 'LSK', 'MKR', 'NEO', 'PAX', 'QTUM', 'TRX', 'TUSD', 'USD', 'USDC', 'WAVES', 'XEM', 'XMR', 'ZEC', 'ZRX']
|
641
|
-
spot_symbols = ['BTC/
|
642
|
-
swap_symbols = ['BTC/USDT:USDT', 'BTC/USD:USD', 'ETH/USDT:USDT', 'ETH/USD:USD', 'LTC/USDT:USDT', 'DOGE/USDT:USDT', 'ADA/USDT:USDT', 'BTC/USD:BTC', 'ETH/USD:ETH']
|
641
|
+
spot_symbols = ['BTC/USDT', 'BTC/USDC', 'BTC/USD', 'BTC/CNY', 'BTC/EUR', 'BTC/ETH', 'ETH/BTC', 'ETH/USD', 'ETH/USDT', 'BTC/JPY', 'LTC/BTC', 'ZRX/WETH', 'EUR/USD']
|
642
|
+
swap_symbols = ['BTC/USDT:USDT', 'BTC/USDC:USDC', 'BTC/USD:USD', 'ETH/USDT:USDT', 'ETH/USD:USD', 'LTC/USDT:USDT', 'DOGE/USDT:USDT', 'ADA/USDT:USDT', 'BTC/USD:BTC', 'ETH/USD:ETH']
|
643
643
|
target_symbols = spot_symbols if spot else swap_symbols
|
644
644
|
symbol = self.get_test_symbol(exchange, spot, target_symbols)
|
645
645
|
# if symbols wasn't found from above hardcoded list, then try to locate any symbol which has our target hardcoded 'base' code
|
@@ -688,16 +688,16 @@ class testMainClass(baseMainTestClass):
|
|
688
688
|
if swap_symbol is not None:
|
689
689
|
dump('[INFO:MAIN] Selected SWAP SYMBOL:', swap_symbol)
|
690
690
|
if not self.private_test_only:
|
691
|
-
# note, spot & swap tests should run sequentially, because of conflicting `exchange.options['
|
691
|
+
# note, spot & swap tests should run sequentially, because of conflicting `exchange.options['defaultType']` setting
|
692
692
|
if exchange.has['spot'] and spot_symbol is not None:
|
693
693
|
if self.info:
|
694
694
|
dump('[INFO] ### SPOT TESTS ###')
|
695
|
-
exchange.options['
|
695
|
+
exchange.options['defaultType'] = 'spot'
|
696
696
|
await self.run_public_tests(exchange, spot_symbol)
|
697
697
|
if exchange.has['swap'] and swap_symbol is not None:
|
698
698
|
if self.info:
|
699
699
|
dump('[INFO] ### SWAP TESTS ###')
|
700
|
-
exchange.options['
|
700
|
+
exchange.options['defaultType'] = 'swap'
|
701
701
|
await self.run_public_tests(exchange, swap_symbol)
|
702
702
|
if self.private_test or self.private_test_only:
|
703
703
|
if exchange.has['spot'] and spot_symbol is not None:
|
ccxt/test/test_sync.py
CHANGED
@@ -157,8 +157,9 @@ def json_stringify(elem):
|
|
157
157
|
return json.dumps(elem)
|
158
158
|
|
159
159
|
|
160
|
-
def convert_to_snake_case(
|
161
|
-
|
160
|
+
def convert_to_snake_case(content):
|
161
|
+
res = re.sub(r'(?<!^)(?=[A-Z])', '_', content).lower()
|
162
|
+
return res.replace('o_h_l_c_v', 'ohlcv')
|
162
163
|
|
163
164
|
|
164
165
|
def get_test_name(methodName):
|
@@ -184,8 +185,7 @@ def io_dir_read(path):
|
|
184
185
|
|
185
186
|
|
186
187
|
def call_method(test_files, methodName, exchange, skippedProperties, args):
|
187
|
-
methodNameToCall = convert_to_snake_case(methodName)
|
188
|
-
methodNameToCall = 'test_' + methodNameToCall.replace('o_h_l_c_v', 'ohlcv')
|
188
|
+
methodNameToCall = 'test_' + convert_to_snake_case(methodName)
|
189
189
|
return getattr(test_files[methodName], methodNameToCall)(exchange, skippedProperties, *args)
|
190
190
|
|
191
191
|
|
@@ -582,7 +582,7 @@ class testMainClass(baseMainTestClass):
|
|
582
582
|
result = self.test_safe('loadMarkets', exchange, [], True)
|
583
583
|
if not result:
|
584
584
|
return False
|
585
|
-
symbols = ['BTC/
|
585
|
+
symbols = ['BTC/USDT', 'BTC/USDC', 'BTC/CNY', 'BTC/USD', 'BTC/EUR', 'BTC/ETH', 'ETH/BTC', 'BTC/JPY', 'ETH/EUR', 'ETH/JPY', 'ETH/CNY', 'ETH/USD', 'LTC/CNY', 'DASH/BTC', 'DOGE/BTC', 'BTC/AUD', 'BTC/PLN', 'USD/SLL', 'BTC/RUB', 'BTC/UAH', 'LTC/BTC', 'EUR/USD']
|
586
586
|
result_symbols = []
|
587
587
|
exchange_specific_symbols = exchange.symbols
|
588
588
|
for i in range(0, len(exchange_specific_symbols)):
|
@@ -637,8 +637,8 @@ class testMainClass(baseMainTestClass):
|
|
637
637
|
def get_valid_symbol(self, exchange, spot=True):
|
638
638
|
current_type_markets = self.get_markets_from_exchange(exchange, spot)
|
639
639
|
codes = ['BTC', 'ETH', 'XRP', 'LTC', 'BCH', 'EOS', 'BNB', 'BSV', 'USDT', 'ATOM', 'BAT', 'BTG', 'DASH', 'DOGE', 'ETC', 'IOTA', 'LSK', 'MKR', 'NEO', 'PAX', 'QTUM', 'TRX', 'TUSD', 'USD', 'USDC', 'WAVES', 'XEM', 'XMR', 'ZEC', 'ZRX']
|
640
|
-
spot_symbols = ['BTC/
|
641
|
-
swap_symbols = ['BTC/USDT:USDT', 'BTC/USD:USD', 'ETH/USDT:USDT', 'ETH/USD:USD', 'LTC/USDT:USDT', 'DOGE/USDT:USDT', 'ADA/USDT:USDT', 'BTC/USD:BTC', 'ETH/USD:ETH']
|
640
|
+
spot_symbols = ['BTC/USDT', 'BTC/USDC', 'BTC/USD', 'BTC/CNY', 'BTC/EUR', 'BTC/ETH', 'ETH/BTC', 'ETH/USD', 'ETH/USDT', 'BTC/JPY', 'LTC/BTC', 'ZRX/WETH', 'EUR/USD']
|
641
|
+
swap_symbols = ['BTC/USDT:USDT', 'BTC/USDC:USDC', 'BTC/USD:USD', 'ETH/USDT:USDT', 'ETH/USD:USD', 'LTC/USDT:USDT', 'DOGE/USDT:USDT', 'ADA/USDT:USDT', 'BTC/USD:BTC', 'ETH/USD:ETH']
|
642
642
|
target_symbols = spot_symbols if spot else swap_symbols
|
643
643
|
symbol = self.get_test_symbol(exchange, spot, target_symbols)
|
644
644
|
# if symbols wasn't found from above hardcoded list, then try to locate any symbol which has our target hardcoded 'base' code
|
@@ -687,16 +687,16 @@ class testMainClass(baseMainTestClass):
|
|
687
687
|
if swap_symbol is not None:
|
688
688
|
dump('[INFO:MAIN] Selected SWAP SYMBOL:', swap_symbol)
|
689
689
|
if not self.private_test_only:
|
690
|
-
# note, spot & swap tests should run sequentially, because of conflicting `exchange.options['
|
690
|
+
# note, spot & swap tests should run sequentially, because of conflicting `exchange.options['defaultType']` setting
|
691
691
|
if exchange.has['spot'] and spot_symbol is not None:
|
692
692
|
if self.info:
|
693
693
|
dump('[INFO] ### SPOT TESTS ###')
|
694
|
-
exchange.options['
|
694
|
+
exchange.options['defaultType'] = 'spot'
|
695
695
|
self.run_public_tests(exchange, spot_symbol)
|
696
696
|
if exchange.has['swap'] and swap_symbol is not None:
|
697
697
|
if self.info:
|
698
698
|
dump('[INFO] ### SWAP TESTS ###')
|
699
|
-
exchange.options['
|
699
|
+
exchange.options['defaultType'] = 'swap'
|
700
700
|
self.run_public_tests(exchange, swap_symbol)
|
701
701
|
if self.private_test or self.private_test_only:
|
702
702
|
if exchange.has['spot'] and spot_symbol is not None:
|
ccxt/upbit.py
CHANGED
@@ -990,6 +990,7 @@ class upbit(Exchange, ImplicitAPI):
|
|
990
990
|
"""
|
991
991
|
create a trade order
|
992
992
|
:see: https://docs.upbit.com/reference/%EC%A3%BC%EB%AC%B8%ED%95%98%EA%B8%B0
|
993
|
+
:see: https://global-docs.upbit.com/reference/order
|
993
994
|
:param str symbol: unified symbol of the market to create an order in
|
994
995
|
:param str type: 'market' or 'limit'
|
995
996
|
:param str side: 'buy' or 'sell'
|
@@ -997,6 +998,7 @@ class upbit(Exchange, ImplicitAPI):
|
|
997
998
|
:param float [price]: the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
998
999
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
999
1000
|
:param float [params.cost]: for market buy orders, the quote quantity that can be used alternative for the amount
|
1001
|
+
:param str [params.timeInForce]: 'IOC' or 'FOK'
|
1000
1002
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1001
1003
|
"""
|
1002
1004
|
self.load_markets()
|
@@ -1041,6 +1043,11 @@ class upbit(Exchange, ImplicitAPI):
|
|
1041
1043
|
clientOrderId = self.safe_string_2(params, 'clientOrderId', 'identifier')
|
1042
1044
|
if clientOrderId is not None:
|
1043
1045
|
request['identifier'] = clientOrderId
|
1046
|
+
if type != 'market':
|
1047
|
+
timeInForce = self.safe_string_lower_2(params, 'timeInForce', 'time_in_force')
|
1048
|
+
params = self.omit(params, 'timeInForce')
|
1049
|
+
if timeInForce is not None:
|
1050
|
+
request['time_in_force'] = timeInForce
|
1044
1051
|
params = self.omit(params, ['clientOrderId', 'identifier'])
|
1045
1052
|
response = self.privatePostOrders(self.extend(request, params))
|
1046
1053
|
#
|
@@ -1773,7 +1780,7 @@ class upbit(Exchange, ImplicitAPI):
|
|
1773
1780
|
url += '?' + self.urlencode(query)
|
1774
1781
|
if api == 'private':
|
1775
1782
|
self.check_required_credentials()
|
1776
|
-
nonce = self.
|
1783
|
+
nonce = self.uuid()
|
1777
1784
|
request = {
|
1778
1785
|
'access_key': self.apiKey,
|
1779
1786
|
'nonce': nonce,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ccxt
|
3
|
-
Version: 4.2.
|
3
|
+
Version: 4.2.49
|
4
4
|
Summary: A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges
|
5
5
|
Home-page: https://ccxt.com
|
6
6
|
Author: Igor Kroitor
|
@@ -259,13 +259,13 @@ console.log(version, Object.keys(exchanges));
|
|
259
259
|
|
260
260
|
All-in-one browser bundle (dependencies included), served from a CDN of your choice:
|
261
261
|
|
262
|
-
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.
|
263
|
-
* unpkg: https://unpkg.com/ccxt@4.2.
|
262
|
+
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.49/dist/ccxt.browser.js
|
263
|
+
* unpkg: https://unpkg.com/ccxt@4.2.49/dist/ccxt.browser.js
|
264
264
|
|
265
265
|
CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
|
266
266
|
|
267
267
|
```HTML
|
268
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.
|
268
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.49/dist/ccxt.browser.js"></script>
|
269
269
|
```
|
270
270
|
|
271
271
|
Creates a global `ccxt` object:
|