ccxt 4.4.95__py2.py3-none-any.whl → 4.4.96__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 +3 -1
- ccxt/abstract/foxbit.py +26 -0
- ccxt/abstract/hyperliquid.py +1 -1
- ccxt/apex.py +3 -3
- ccxt/ascendex.py +2 -2
- ccxt/async_support/__init__.py +3 -1
- ccxt/async_support/apex.py +3 -3
- ccxt/async_support/ascendex.py +2 -2
- ccxt/async_support/base/exchange.py +5 -3
- ccxt/async_support/base/ws/future.py +5 -3
- ccxt/async_support/bitget.py +30 -143
- ccxt/async_support/bitmart.py +2 -2
- ccxt/async_support/bitrue.py +13 -8
- ccxt/async_support/bybit.py +14 -5
- ccxt/async_support/coinbaseexchange.py +4 -2
- ccxt/async_support/coinbaseinternational.py +2 -2
- ccxt/async_support/coinspot.py +36 -1
- ccxt/async_support/cryptocom.py +2 -1
- ccxt/async_support/cryptomus.py +41 -1
- ccxt/async_support/defx.py +1 -1
- ccxt/async_support/derive.py +1 -1
- ccxt/async_support/ellipx.py +40 -0
- ccxt/async_support/foxbit.py +1935 -0
- ccxt/async_support/hyperliquid.py +2 -2
- ccxt/async_support/kucoin.py +1 -1
- ccxt/async_support/kucoinfutures.py +3 -2
- ccxt/async_support/mexc.py +28 -13
- ccxt/async_support/modetrade.py +3 -3
- ccxt/async_support/okcoin.py +1 -1
- ccxt/async_support/okx.py +10 -3
- ccxt/async_support/onetrading.py +1 -1
- ccxt/async_support/oxfun.py +2 -1
- ccxt/async_support/paradex.py +2 -2
- ccxt/async_support/vertex.py +3 -2
- ccxt/async_support/woo.py +6 -2
- ccxt/async_support/woofipro.py +2 -2
- ccxt/base/errors.py +6 -0
- ccxt/base/exchange.py +6 -3
- ccxt/bitget.py +30 -143
- ccxt/bitmart.py +2 -2
- ccxt/bitrue.py +13 -8
- ccxt/bybit.py +14 -5
- ccxt/coinbaseexchange.py +4 -2
- ccxt/coinbaseinternational.py +2 -2
- ccxt/coinspot.py +36 -1
- ccxt/cryptocom.py +2 -1
- ccxt/cryptomus.py +41 -1
- ccxt/defx.py +1 -1
- ccxt/derive.py +1 -1
- ccxt/ellipx.py +40 -0
- ccxt/foxbit.py +1935 -0
- ccxt/hyperliquid.py +2 -2
- ccxt/kucoin.py +1 -1
- ccxt/kucoinfutures.py +3 -2
- ccxt/mexc.py +28 -13
- ccxt/modetrade.py +3 -3
- ccxt/okcoin.py +1 -1
- ccxt/okx.py +10 -3
- ccxt/onetrading.py +1 -1
- ccxt/oxfun.py +2 -1
- ccxt/paradex.py +2 -2
- ccxt/pro/__init__.py +1 -1
- ccxt/test/tests_async.py +15 -0
- ccxt/test/tests_sync.py +15 -0
- ccxt/vertex.py +3 -2
- ccxt/woo.py +6 -2
- ccxt/woofipro.py +2 -2
- {ccxt-4.4.95.dist-info → ccxt-4.4.96.dist-info}/METADATA +8 -8
- {ccxt-4.4.95.dist-info → ccxt-4.4.96.dist-info}/RECORD +72 -69
- {ccxt-4.4.95.dist-info → ccxt-4.4.96.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.95.dist-info → ccxt-4.4.96.dist-info}/WHEEL +0 -0
- {ccxt-4.4.95.dist-info → ccxt-4.4.96.dist-info}/top_level.txt +0 -0
ccxt/__init__.py
CHANGED
@@ -22,7 +22,7 @@
|
|
22
22
|
|
23
23
|
# ----------------------------------------------------------------------------
|
24
24
|
|
25
|
-
__version__ = '4.4.
|
25
|
+
__version__ = '4.4.96'
|
26
26
|
|
27
27
|
# ----------------------------------------------------------------------------
|
28
28
|
|
@@ -139,6 +139,7 @@ from ccxt.digifinex import digifinex # noqa: F4
|
|
139
139
|
from ccxt.ellipx import ellipx # noqa: F401
|
140
140
|
from ccxt.exmo import exmo # noqa: F401
|
141
141
|
from ccxt.fmfwio import fmfwio # noqa: F401
|
142
|
+
from ccxt.foxbit import foxbit # noqa: F401
|
142
143
|
from ccxt.gate import gate # noqa: F401
|
143
144
|
from ccxt.gateio import gateio # noqa: F401
|
144
145
|
from ccxt.gemini import gemini # noqa: F401
|
@@ -246,6 +247,7 @@ exchanges = [
|
|
246
247
|
'ellipx',
|
247
248
|
'exmo',
|
248
249
|
'fmfwio',
|
250
|
+
'foxbit',
|
249
251
|
'gate',
|
250
252
|
'gateio',
|
251
253
|
'gemini',
|
ccxt/abstract/foxbit.py
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
from ccxt.base.types import Entry
|
2
|
+
|
3
|
+
|
4
|
+
class ImplicitAPI:
|
5
|
+
v3_public_get_currencies = v3PublicGetCurrencies = Entry('currencies', ['v3', 'public'], 'GET', {'cost': 5})
|
6
|
+
v3_public_get_markets = v3PublicGetMarkets = Entry('markets', ['v3', 'public'], 'GET', {'cost': 5})
|
7
|
+
v3_public_get_markets_ticker_24hr = v3PublicGetMarketsTicker24hr = Entry('markets/ticker/24hr', ['v3', 'public'], 'GET', {'cost': 60})
|
8
|
+
v3_public_get_markets_market_orderbook = v3PublicGetMarketsMarketOrderbook = Entry('markets/{market}/orderbook', ['v3', 'public'], 'GET', {'cost': 6})
|
9
|
+
v3_public_get_markets_market_candlesticks = v3PublicGetMarketsMarketCandlesticks = Entry('markets/{market}/candlesticks', ['v3', 'public'], 'GET', {'cost': 12})
|
10
|
+
v3_public_get_markets_market_trades_history = v3PublicGetMarketsMarketTradesHistory = Entry('markets/{market}/trades/history', ['v3', 'public'], 'GET', {'cost': 12})
|
11
|
+
v3_public_get_markets_market_ticker_24hr = v3PublicGetMarketsMarketTicker24hr = Entry('markets/{market}/ticker/24hr', ['v3', 'public'], 'GET', {'cost': 15})
|
12
|
+
v3_private_get_accounts = v3PrivateGetAccounts = Entry('accounts', ['v3', 'private'], 'GET', {'cost': 2})
|
13
|
+
v3_private_get_accounts_symbol_transactions = v3PrivateGetAccountsSymbolTransactions = Entry('accounts/{symbol}/transactions', ['v3', 'private'], 'GET', {'cost': 60})
|
14
|
+
v3_private_get_orders = v3PrivateGetOrders = Entry('orders', ['v3', 'private'], 'GET', {'cost': 2})
|
15
|
+
v3_private_get_orders_by_order_id_id = v3PrivateGetOrdersByOrderIdId = Entry('orders/by-order-id/{id}', ['v3', 'private'], 'GET', {'cost': 2})
|
16
|
+
v3_private_get_trades = v3PrivateGetTrades = Entry('trades', ['v3', 'private'], 'GET', {'cost': 6})
|
17
|
+
v3_private_get_deposits_address = v3PrivateGetDepositsAddress = Entry('deposits/address', ['v3', 'private'], 'GET', {'cost': 10})
|
18
|
+
v3_private_get_deposits = v3PrivateGetDeposits = Entry('deposits', ['v3', 'private'], 'GET', {'cost': 10})
|
19
|
+
v3_private_get_withdrawals = v3PrivateGetWithdrawals = Entry('withdrawals', ['v3', 'private'], 'GET', {'cost': 10})
|
20
|
+
v3_private_get_me_fees_trading = v3PrivateGetMeFeesTrading = Entry('me/fees/trading', ['v3', 'private'], 'GET', {'cost': 60})
|
21
|
+
v3_private_post_orders = v3PrivatePostOrders = Entry('orders', ['v3', 'private'], 'POST', {'cost': 2})
|
22
|
+
v3_private_post_orders_batch = v3PrivatePostOrdersBatch = Entry('orders/batch', ['v3', 'private'], 'POST', {'cost': 7.5})
|
23
|
+
v3_private_post_orders_cancel_replace = v3PrivatePostOrdersCancelReplace = Entry('orders/cancel-replace', ['v3', 'private'], 'POST', {'cost': 3})
|
24
|
+
v3_private_post_withdrawals = v3PrivatePostWithdrawals = Entry('withdrawals', ['v3', 'private'], 'POST', {'cost': 10})
|
25
|
+
v3_private_put_orders_cancel = v3PrivatePutOrdersCancel = Entry('orders/cancel', ['v3', 'private'], 'PUT', {'cost': 2})
|
26
|
+
status_public_get_status = statusPublicGetStatus = Entry('status', ['status', 'public'], 'GET', {'cost': 30})
|
ccxt/abstract/hyperliquid.py
CHANGED
@@ -2,5 +2,5 @@ from ccxt.base.types import Entry
|
|
2
2
|
|
3
3
|
|
4
4
|
class ImplicitAPI:
|
5
|
-
public_post_info = publicPostInfo = Entry('info', 'public', 'POST', {'cost': 20, 'byType': {'l2Book': 2, 'allMids': 2, 'clearinghouseState': 2, 'orderStatus': 2, 'spotClearinghouseState': 2, 'exchangeStatus': 2, 'candleSnapshot':
|
5
|
+
public_post_info = publicPostInfo = Entry('info', 'public', 'POST', {'cost': 20, 'byType': {'l2Book': 2, 'allMids': 2, 'clearinghouseState': 2, 'orderStatus': 2, 'spotClearinghouseState': 2, 'exchangeStatus': 2, 'candleSnapshot': 4}})
|
6
6
|
private_post_exchange = privatePostExchange = Entry('exchange', 'private', 'POST', {'cost': 1})
|
ccxt/apex.py
CHANGED
@@ -1485,7 +1485,7 @@ class apex(Exchange, ImplicitAPI):
|
|
1485
1485
|
'status': self.safe_string(transfer, 'status'),
|
1486
1486
|
}
|
1487
1487
|
|
1488
|
-
def cancel_all_orders(self, symbol: Str = None, params={}):
|
1488
|
+
def cancel_all_orders(self, symbol: Str = None, params={}) -> List[Order]:
|
1489
1489
|
"""
|
1490
1490
|
cancel all open orders in a market
|
1491
1491
|
|
@@ -1503,7 +1503,7 @@ class apex(Exchange, ImplicitAPI):
|
|
1503
1503
|
request['symbol'] = market['id']
|
1504
1504
|
response = self.privatePostV3DeleteOpenOrders(self.extend(request, params))
|
1505
1505
|
data = self.safe_dict(response, 'data', {})
|
1506
|
-
return data
|
1506
|
+
return [self.parse_order(data, market)]
|
1507
1507
|
|
1508
1508
|
def cancel_order(self, id: str, symbol: Str = None, params={}):
|
1509
1509
|
"""
|
@@ -1527,7 +1527,7 @@ class apex(Exchange, ImplicitAPI):
|
|
1527
1527
|
request['id'] = id
|
1528
1528
|
response = self.privatePostV3DeleteOrder(self.extend(request, params))
|
1529
1529
|
data = self.safe_dict(response, 'data', {})
|
1530
|
-
return data
|
1530
|
+
return self.safe_order(data)
|
1531
1531
|
|
1532
1532
|
def fetch_order(self, id: str, symbol: Str = None, params={}):
|
1533
1533
|
"""
|
ccxt/ascendex.py
CHANGED
@@ -2432,9 +2432,9 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2432
2432
|
# }
|
2433
2433
|
# }
|
2434
2434
|
#
|
2435
|
-
return self.safe_order({
|
2435
|
+
return [self.safe_order({
|
2436
2436
|
'info': response,
|
2437
|
-
})
|
2437
|
+
})]
|
2438
2438
|
|
2439
2439
|
def parse_deposit_address(self, depositAddress, currency: Currency = None) -> DepositAddress:
|
2440
2440
|
#
|
ccxt/async_support/__init__.py
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
# -----------------------------------------------------------------------------
|
6
6
|
|
7
|
-
__version__ = '4.4.
|
7
|
+
__version__ = '4.4.96'
|
8
8
|
|
9
9
|
# -----------------------------------------------------------------------------
|
10
10
|
|
@@ -119,6 +119,7 @@ from ccxt.async_support.digifinex import digifinex
|
|
119
119
|
from ccxt.async_support.ellipx import ellipx # noqa: F401
|
120
120
|
from ccxt.async_support.exmo import exmo # noqa: F401
|
121
121
|
from ccxt.async_support.fmfwio import fmfwio # noqa: F401
|
122
|
+
from ccxt.async_support.foxbit import foxbit # noqa: F401
|
122
123
|
from ccxt.async_support.gate import gate # noqa: F401
|
123
124
|
from ccxt.async_support.gateio import gateio # noqa: F401
|
124
125
|
from ccxt.async_support.gemini import gemini # noqa: F401
|
@@ -226,6 +227,7 @@ exchanges = [
|
|
226
227
|
'ellipx',
|
227
228
|
'exmo',
|
228
229
|
'fmfwio',
|
230
|
+
'foxbit',
|
229
231
|
'gate',
|
230
232
|
'gateio',
|
231
233
|
'gemini',
|
ccxt/async_support/apex.py
CHANGED
@@ -1485,7 +1485,7 @@ class apex(Exchange, ImplicitAPI):
|
|
1485
1485
|
'status': self.safe_string(transfer, 'status'),
|
1486
1486
|
}
|
1487
1487
|
|
1488
|
-
async def cancel_all_orders(self, symbol: Str = None, params={}):
|
1488
|
+
async def cancel_all_orders(self, symbol: Str = None, params={}) -> List[Order]:
|
1489
1489
|
"""
|
1490
1490
|
cancel all open orders in a market
|
1491
1491
|
|
@@ -1503,7 +1503,7 @@ class apex(Exchange, ImplicitAPI):
|
|
1503
1503
|
request['symbol'] = market['id']
|
1504
1504
|
response = await self.privatePostV3DeleteOpenOrders(self.extend(request, params))
|
1505
1505
|
data = self.safe_dict(response, 'data', {})
|
1506
|
-
return data
|
1506
|
+
return [self.parse_order(data, market)]
|
1507
1507
|
|
1508
1508
|
async def cancel_order(self, id: str, symbol: Str = None, params={}):
|
1509
1509
|
"""
|
@@ -1527,7 +1527,7 @@ class apex(Exchange, ImplicitAPI):
|
|
1527
1527
|
request['id'] = id
|
1528
1528
|
response = await self.privatePostV3DeleteOrder(self.extend(request, params))
|
1529
1529
|
data = self.safe_dict(response, 'data', {})
|
1530
|
-
return data
|
1530
|
+
return self.safe_order(data)
|
1531
1531
|
|
1532
1532
|
async def fetch_order(self, id: str, symbol: Str = None, params={}):
|
1533
1533
|
"""
|
ccxt/async_support/ascendex.py
CHANGED
@@ -2433,9 +2433,9 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2433
2433
|
# }
|
2434
2434
|
# }
|
2435
2435
|
#
|
2436
|
-
return self.safe_order({
|
2436
|
+
return [self.safe_order({
|
2437
2437
|
'info': response,
|
2438
|
-
})
|
2438
|
+
})]
|
2439
2439
|
|
2440
2440
|
def parse_deposit_address(self, depositAddress, currency: Currency = None) -> DepositAddress:
|
2441
2441
|
#
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# -----------------------------------------------------------------------------
|
4
4
|
|
5
|
-
__version__ = '4.4.
|
5
|
+
__version__ = '4.4.96'
|
6
6
|
|
7
7
|
# -----------------------------------------------------------------------------
|
8
8
|
|
@@ -231,6 +231,8 @@ class Exchange(BaseExchange):
|
|
231
231
|
self.last_json_response = json_response
|
232
232
|
if self.verbose:
|
233
233
|
self.log("\nfetch Response:", self.id, method, url, http_status_code, "ResponseHeaders:", headers, "ResponseBody:", http_response)
|
234
|
+
if json_response and not isinstance(json_response, list) and self.returnResponseHeaders:
|
235
|
+
json_response['responseHeaders'] = headers
|
234
236
|
self.logger.debug("%s %s, Response: %s %s %s", method, url, http_status_code, headers, http_response)
|
235
237
|
|
236
238
|
except socket.gaierror as e:
|
@@ -1596,10 +1598,10 @@ class Exchange(BaseExchange):
|
|
1596
1598
|
"""
|
1597
1599
|
raise NotSupported(self.id + ' fetchDepositsWithdrawals() is not supported yet')
|
1598
1600
|
|
1599
|
-
async def fetch_deposits(self,
|
1601
|
+
async def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
1600
1602
|
raise NotSupported(self.id + ' fetchDeposits() is not supported yet')
|
1601
1603
|
|
1602
|
-
async def fetch_withdrawals(self,
|
1604
|
+
async def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
1603
1605
|
raise NotSupported(self.id + ' fetchWithdrawals() is not supported yet')
|
1604
1606
|
|
1605
1607
|
async def fetch_deposits_ws(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import asyncio
|
2
2
|
|
3
|
-
|
3
|
+
# Test by running:
|
4
|
+
# - python python/ccxt/pro/test/base/test_close.py
|
5
|
+
# - python python/ccxt/pro/test/base/test_future.py
|
4
6
|
class Future(asyncio.Future):
|
5
7
|
|
6
8
|
def resolve(self, result=None):
|
@@ -30,14 +32,14 @@ class Future(asyncio.Future):
|
|
30
32
|
if err:
|
31
33
|
exceptions.append(err)
|
32
34
|
# if any exceptions return with first exception
|
35
|
+
if future.cancelled():
|
36
|
+
return
|
33
37
|
if len(exceptions) > 0:
|
34
38
|
future.set_exception(exceptions[0])
|
35
39
|
# else return first result
|
36
40
|
elif cancelled:
|
37
41
|
future.cancel()
|
38
42
|
else:
|
39
|
-
if future.cancelled():
|
40
|
-
return
|
41
43
|
first_result = list(complete)[0].result()
|
42
44
|
future.set_result(first_result)
|
43
45
|
task.add_done_callback(callback)
|
ccxt/async_support/bitget.py
CHANGED
@@ -4112,82 +4112,35 @@ class bitget(Exchange, ImplicitAPI):
|
|
4112
4112
|
# "result": "success"
|
4113
4113
|
# }
|
4114
4114
|
#
|
4115
|
-
# spot: fetchOrder
|
4116
|
-
#
|
4117
|
-
# {
|
4118
|
-
# "userId": "7264631750",
|
4119
|
-
# "symbol": "BTCUSDT",
|
4120
|
-
# "orderId": "1111461743123927040",
|
4121
|
-
# "clientOid": "63f95110-93b5-4309-8f77-46339f1bcf3c",
|
4122
|
-
# "price": "25000.0000000000000000",
|
4123
|
-
# "size": "0.0002000000000000",
|
4124
|
-
# "orderType": "limit",
|
4125
|
-
# "side": "buy",
|
4126
|
-
# "status": "live",
|
4127
|
-
# "priceAvg": "0",
|
4128
|
-
# "baseVolume": "0.0000000000000000",
|
4129
|
-
# "quoteVolume": "0.0000000000000000",
|
4130
|
-
# "enterPointSource": "API",
|
4131
|
-
# "feeDetail": "",
|
4132
|
-
# "orderSource": "normal",
|
4133
|
-
# "cTime": "1700719050198",
|
4134
|
-
# "uTime": "1700719050198"
|
4135
|
-
# }
|
4136
|
-
#
|
4137
|
-
# swap and future: fetchOrder
|
4138
|
-
#
|
4139
|
-
# {
|
4140
|
-
# "symbol": "BTCUSDT",
|
4141
|
-
# "size": "0.001",
|
4142
|
-
# "orderId": "1111465253393825792",
|
4143
|
-
# "clientOid": "1111465253431574529",
|
4144
|
-
# "baseVolume": "0",
|
4145
|
-
# "fee": "0",
|
4146
|
-
# "price": "27000",
|
4147
|
-
# "priceAvg": "",
|
4148
|
-
# "state": "live",
|
4149
|
-
# "side": "buy",
|
4150
|
-
# "force": "gtc",
|
4151
|
-
# "totalProfits": "0",
|
4152
|
-
# "posSide": "long",
|
4153
|
-
# "marginCoin": "USDT",
|
4154
|
-
# "presetStopSurplusPrice": "",
|
4155
|
-
# "presetStopLossPrice": "",
|
4156
|
-
# "quoteVolume": "0",
|
4157
|
-
# "orderType": "limit",
|
4158
|
-
# "leverage": "20",
|
4159
|
-
# "marginMode": "crossed",
|
4160
|
-
# "reduceOnly": "NO",
|
4161
|
-
# "enterPointSource": "API",
|
4162
|
-
# "tradeSide": "open",
|
4163
|
-
# "posMode": "hedge_mode",
|
4164
|
-
# "orderSource": "normal",
|
4165
|
-
# "cTime": "1700719887120",
|
4166
|
-
# "uTime": "1700719887120"
|
4167
|
-
# }
|
4168
|
-
#
|
4169
|
-
# spot: fetchOpenOrders
|
4115
|
+
# spot: fetchOrder, fetchOpenOrders, fetchCanceledAndClosedOrders
|
4170
4116
|
#
|
4171
4117
|
# {
|
4172
4118
|
# "userId": "7264631750",
|
4173
4119
|
# "symbol": "BTCUSDT",
|
4174
4120
|
# "orderId": "1111499608327360513",
|
4175
4121
|
# "clientOid": "d0d4dad5-18d0-4869-a074-ec40bb47cba6",
|
4176
|
-
# "
|
4177
|
-
# "
|
4122
|
+
# "size": "0.0002000000000000", # COST for 'buy market' order! AMOUNT in all other cases
|
4123
|
+
# "price": "0", # in fetchOrder: 0 for market order, otherwise limit price(field not present in fetchOpenOrders
|
4178
4124
|
# "orderType": "limit",
|
4179
4125
|
# "side": "buy",
|
4180
4126
|
# "status": "live",
|
4181
4127
|
# "basePrice": "0",
|
4182
|
-
# "
|
4183
|
-
# "
|
4128
|
+
# "priceAvg": "25000.0000000000000000", # 0 if nothing filled
|
4129
|
+
# "baseVolume": "0.0000000000000000", # 0 if nothing filled
|
4130
|
+
# "quoteVolume": "0.0000000000000000", # 0 if nothing filled
|
4184
4131
|
# "enterPointSource": "WEB",
|
4185
4132
|
# "orderSource": "normal",
|
4186
4133
|
# "cTime": "1700728077966",
|
4187
4134
|
# "uTime": "1700728077966"
|
4135
|
+
# "feeDetail": "{\\"newFees\\":{\\"c\\":0,\\"d\\":0,\\"deduction\\":false,\\"r\\":-0.0064699886,\\"t\\":-0.0064699886,\\"totalDeductionFee\\":0},\\"USDT\\":{\\"deduction\\":false,\\"feeCoinCode\\":\\"USDT\\",\\"totalDeductionFee\\":0,\\"totalFee\\":-0.0064699886000000}}", # might not be present in fetchOpenOrders
|
4136
|
+
# "triggerPrice": null,
|
4137
|
+
# "tpslType": "normal",
|
4138
|
+
# "quoteCoin": "USDT", # not present in fetchOpenOrders
|
4139
|
+
# "baseCoin": "DOT", # not present in fetchOpenOrders
|
4140
|
+
# "cancelReason": "", # not present in fetchOpenOrders
|
4188
4141
|
# }
|
4189
4142
|
#
|
4190
|
-
# spot
|
4143
|
+
# spot trigger: fetchOpenOrders, fetchCanceledAndClosedOrders
|
4191
4144
|
#
|
4192
4145
|
# {
|
4193
4146
|
# "orderId": "1111503385931620352",
|
@@ -4228,18 +4181,19 @@ class bitget(Exchange, ImplicitAPI):
|
|
4228
4181
|
# "uTime": "1700729691866"
|
4229
4182
|
# }
|
4230
4183
|
#
|
4231
|
-
# swap: fetchOpenOrders, fetchCanceledAndClosedOrders
|
4184
|
+
# swap and future: fetchOrder, fetchOpenOrders, fetchCanceledAndClosedOrders
|
4232
4185
|
#
|
4233
4186
|
# {
|
4234
4187
|
# "symbol": "BTCUSDT",
|
4235
|
-
# "size": "0.
|
4236
|
-
# "orderId": "
|
4237
|
-
# "clientOid": "
|
4188
|
+
# "size": "0.001",
|
4189
|
+
# "orderId": "1111465253393825792",
|
4190
|
+
# "clientOid": "1111465253431574529",
|
4238
4191
|
# "baseVolume": "0",
|
4239
4192
|
# "fee": "0",
|
4240
|
-
# "price": "
|
4193
|
+
# "price": "27000",
|
4241
4194
|
# "priceAvg": "",
|
4242
|
-
# "
|
4195
|
+
# "state": "live",
|
4196
|
+
# # "status": "live", # key for fetchOpenOrders, fetchClosedOrders
|
4243
4197
|
# "side": "buy",
|
4244
4198
|
# "force": "gtc",
|
4245
4199
|
# "totalProfits": "0",
|
@@ -4248,7 +4202,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
4248
4202
|
# "quoteVolume": "0",
|
4249
4203
|
# "leverage": "20",
|
4250
4204
|
# "marginMode": "crossed",
|
4251
|
-
# "enterPointSource": "
|
4205
|
+
# "enterPointSource": "API",
|
4252
4206
|
# "tradeSide": "open",
|
4253
4207
|
# "posMode": "hedge_mode",
|
4254
4208
|
# "orderType": "limit",
|
@@ -4256,94 +4210,22 @@ class bitget(Exchange, ImplicitAPI):
|
|
4256
4210
|
# "presetStopSurplusPrice": "",
|
4257
4211
|
# "presetStopLossPrice": "",
|
4258
4212
|
# "reduceOnly": "NO",
|
4259
|
-
# "cTime": "
|
4260
|
-
# "uTime": "
|
4261
|
-
# }
|
4213
|
+
# "cTime": "1700719887120",
|
4214
|
+
# "uTime": "1700719887120"
|
4262
4215
|
#
|
4263
|
-
# swap
|
4216
|
+
# for swap trigger order, the additional below fields are present:
|
4264
4217
|
#
|
4265
|
-
# {
|
4266
4218
|
# "planType": "normal_plan",
|
4267
|
-
# "symbol": "BTCUSDT",
|
4268
|
-
# "size": "0.001",
|
4269
|
-
# "orderId": "1111491399869075457",
|
4270
|
-
# "clientOid": "1111491399869075456",
|
4271
|
-
# "price": "27000",
|
4272
4219
|
# "callbackRatio": "",
|
4273
4220
|
# "triggerPrice": "24000",
|
4274
4221
|
# "triggerType": "mark_price",
|
4275
4222
|
# "planStatus": "live",
|
4276
|
-
# "side": "buy",
|
4277
|
-
# "posSide": "long",
|
4278
|
-
# "marginCoin": "USDT",
|
4279
|
-
# "marginMode": "crossed",
|
4280
|
-
# "enterPointSource": "API",
|
4281
|
-
# "tradeSide": "open",
|
4282
|
-
# "posMode": "hedge_mode",
|
4283
|
-
# "orderType": "limit",
|
4284
|
-
# "stopSurplusTriggerPrice": "",
|
4285
|
-
# "stopSurplusExecutePrice": "",
|
4286
|
-
# "stopSurplusTriggerType": "fill_price",
|
4287
|
-
# "stopLossTriggerPrice": "",
|
4288
|
-
# "stopLossExecutePrice": "",
|
4289
|
-
# "stopLossTriggerType": "fill_price",
|
4290
|
-
# "cTime": "1700726120917",
|
4291
|
-
# "uTime": "1700726120917"
|
4292
|
-
# }
|
4293
|
-
#
|
4294
|
-
# spot: fetchCanceledAndClosedOrders
|
4295
|
-
#
|
4296
|
-
# {
|
4297
|
-
# "userId": "7264631750",
|
4298
|
-
# "symbol": "BTCUSDT",
|
4299
|
-
# "orderId": "1111499608327360513",
|
4300
|
-
# "clientOid": "d0d4dad5-18d0-4869-a074-ec40bb47cba6",
|
4301
|
-
# "price": "25000.0000000000000000",
|
4302
|
-
# "size": "0.0002000000000000",
|
4303
|
-
# "orderType": "limit",
|
4304
|
-
# "side": "buy",
|
4305
|
-
# "status": "cancelled",
|
4306
|
-
# "priceAvg": "0",
|
4307
|
-
# "baseVolume": "0.0000000000000000",
|
4308
|
-
# "quoteVolume": "0.0000000000000000",
|
4309
|
-
# "enterPointSource": "WEB",
|
4310
|
-
# "feeDetail": "",
|
4311
|
-
# "orderSource": "normal",
|
4312
|
-
# "cTime": "1700728077966",
|
4313
|
-
# "uTime": "1700728911471"
|
4314
|
-
# }
|
4315
|
-
#
|
4316
|
-
# swap stop: fetchCanceledAndClosedOrders
|
4317
|
-
#
|
4318
|
-
# {
|
4319
|
-
# "planType": "normal_plan",
|
4320
|
-
# "symbol": "BTCUSDT",
|
4321
|
-
# "size": "0.001",
|
4322
|
-
# "orderId": "1111491399869075457",
|
4323
|
-
# "clientOid": "1111491399869075456",
|
4324
|
-
# "planStatus": "cancelled",
|
4325
|
-
# "price": "27000",
|
4326
|
-
# "feeDetail": null,
|
4327
|
-
# "baseVolume": "0",
|
4328
|
-
# "callbackRatio": "",
|
4329
|
-
# "triggerPrice": "24000",
|
4330
|
-
# "triggerType": "mark_price",
|
4331
|
-
# "side": "buy",
|
4332
|
-
# "posSide": "long",
|
4333
|
-
# "marginCoin": "USDT",
|
4334
|
-
# "marginMode": "crossed",
|
4335
|
-
# "enterPointSource": "API",
|
4336
|
-
# "tradeSide": "open",
|
4337
|
-
# "posMode": "hedge_mode",
|
4338
|
-
# "orderType": "limit",
|
4339
4223
|
# "stopSurplusTriggerPrice": "",
|
4340
4224
|
# "stopSurplusExecutePrice": "",
|
4341
4225
|
# "stopSurplusTriggerType": "fill_price",
|
4342
4226
|
# "stopLossTriggerPrice": "",
|
4343
4227
|
# "stopLossExecutePrice": "",
|
4344
4228
|
# "stopLossTriggerType": "fill_price",
|
4345
|
-
# "cTime": "1700726120917",
|
4346
|
-
# "uTime": "1700727879652"
|
4347
4229
|
# }
|
4348
4230
|
#
|
4349
4231
|
errorMessage = self.safe_string(order, 'errorMsg')
|
@@ -4421,6 +4303,11 @@ class bitget(Exchange, ImplicitAPI):
|
|
4421
4303
|
side = 'sell' if (side == 'buy') else 'buy'
|
4422
4304
|
# on bitget hedge mode if the position is long the side is always buy, and if the position is short the side is always sell
|
4423
4305
|
# so the side of the reduceOnly order is inversed
|
4306
|
+
orderType = self.safe_string(order, 'orderType')
|
4307
|
+
isBuyMarket = (side == 'buy') and (orderType == 'market')
|
4308
|
+
if market['spot'] and isBuyMarket:
|
4309
|
+
# in top comment, for 'buy market' the 'size' field is COST, not AMOUNT
|
4310
|
+
size = self.safe_string(order, 'baseVolume')
|
4424
4311
|
return self.safe_order({
|
4425
4312
|
'info': order,
|
4426
4313
|
'id': self.safe_string_2(order, 'orderId', 'data'),
|
@@ -4430,7 +4317,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
4430
4317
|
'lastTradeTimestamp': updateTimestamp,
|
4431
4318
|
'lastUpdateTimestamp': updateTimestamp,
|
4432
4319
|
'symbol': market['symbol'],
|
4433
|
-
'type':
|
4320
|
+
'type': orderType,
|
4434
4321
|
'side': side,
|
4435
4322
|
'price': price,
|
4436
4323
|
'amount': size,
|
ccxt/async_support/bitmart.py
CHANGED
@@ -3083,7 +3083,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3083
3083
|
# }
|
3084
3084
|
#
|
3085
3085
|
if market['swap']:
|
3086
|
-
return response
|
3086
|
+
return self.safe_order({'info': response})
|
3087
3087
|
data = self.safe_value(response, 'data')
|
3088
3088
|
if data is True:
|
3089
3089
|
return self.safe_order({'id': id}, market)
|
@@ -3200,7 +3200,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3200
3200
|
# "trace": "7f9c94e10f9d4513bc08a7bfc2a5559a.70.16954131323145323"
|
3201
3201
|
# }
|
3202
3202
|
#
|
3203
|
-
return response
|
3203
|
+
return [self.safe_order({'info': response})]
|
3204
3204
|
|
3205
3205
|
async def fetch_orders_by_status(self, status, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
3206
3206
|
if symbol is None:
|
ccxt/async_support/bitrue.py
CHANGED
@@ -395,11 +395,9 @@ class bitrue(Exchange, ImplicitAPI):
|
|
395
395
|
# exchange-specific options
|
396
396
|
'options': {
|
397
397
|
'createMarketBuyOrderRequiresPrice': True,
|
398
|
-
'fetchMarkets':
|
399
|
-
'spot',
|
400
|
-
|
401
|
-
'inverse',
|
402
|
-
],
|
398
|
+
'fetchMarkets': {
|
399
|
+
'types': ['spot', 'linear', 'inverse'],
|
400
|
+
},
|
403
401
|
# 'fetchTradesMethod': 'publicGetAggTrades', # publicGetTrades, publicGetHistoricalTrades
|
404
402
|
'fetchMyTradesMethod': 'v2PrivateGetMyTrades', # spotV1PrivateGetMyTrades
|
405
403
|
'hasAlreadyAuthenticatedSuccessfully': False,
|
@@ -845,9 +843,16 @@ class bitrue(Exchange, ImplicitAPI):
|
|
845
843
|
:returns dict[]: an array of objects representing market data
|
846
844
|
"""
|
847
845
|
promisesRaw = []
|
848
|
-
|
849
|
-
|
850
|
-
|
846
|
+
types = None
|
847
|
+
defaultTypes = ['spot', 'linear', 'inverse']
|
848
|
+
fetchMarketsOptions = self.safe_dict(self.options, 'fetchMarkets')
|
849
|
+
if fetchMarketsOptions is not None:
|
850
|
+
types = self.safe_list(fetchMarketsOptions, 'types', defaultTypes)
|
851
|
+
else:
|
852
|
+
# for backward-compatibility
|
853
|
+
types = self.safe_list(self.options, 'fetchMarkets', defaultTypes)
|
854
|
+
for i in range(0, len(types)):
|
855
|
+
marketType = types[i]
|
851
856
|
if marketType == 'spot':
|
852
857
|
promisesRaw.append(self.spotV1PublicGetExchangeInfo(params))
|
853
858
|
elif marketType == 'linear':
|
ccxt/async_support/bybit.py
CHANGED
@@ -1041,7 +1041,9 @@ class bybit(Exchange, ImplicitAPI):
|
|
1041
1041
|
'options': {
|
1042
1042
|
'usePrivateInstrumentsInfo': False,
|
1043
1043
|
'enableDemoTrading': False,
|
1044
|
-
'fetchMarkets':
|
1044
|
+
'fetchMarkets': {
|
1045
|
+
'types': ['spot', 'linear', 'inverse', 'option'],
|
1046
|
+
},
|
1045
1047
|
'enableUnifiedMargin': None,
|
1046
1048
|
'enableUnifiedAccount': None,
|
1047
1049
|
'unifiedMarginStatus': None,
|
@@ -1702,9 +1704,16 @@ class bybit(Exchange, ImplicitAPI):
|
|
1702
1704
|
if self.options['adjustForTimeDifference']:
|
1703
1705
|
await self.load_time_difference()
|
1704
1706
|
promisesUnresolved = []
|
1705
|
-
|
1706
|
-
|
1707
|
-
|
1707
|
+
types = None
|
1708
|
+
defaultTypes = ['spot', 'linear', 'inverse', 'option']
|
1709
|
+
fetchMarketsOptions = self.safe_dict(self.options, 'fetchMarkets')
|
1710
|
+
if fetchMarketsOptions is not None:
|
1711
|
+
types = self.safe_list(fetchMarketsOptions, 'types', defaultTypes)
|
1712
|
+
else:
|
1713
|
+
# for backward-compatibility
|
1714
|
+
types = self.safe_list(self.options, 'fetchMarkets', defaultTypes)
|
1715
|
+
for i in range(0, len(types)):
|
1716
|
+
marketType = types[i]
|
1708
1717
|
if marketType == 'spot':
|
1709
1718
|
promisesUnresolved.append(self.fetch_spot_markets(params))
|
1710
1719
|
elif marketType == 'linear':
|
@@ -4577,7 +4586,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
4577
4586
|
result = self.safe_dict(response, 'result', {})
|
4578
4587
|
orders = self.safe_list(result, 'list')
|
4579
4588
|
if not isinstance(orders, list):
|
4580
|
-
return response
|
4589
|
+
return [self.safe_order({'info': response})]
|
4581
4590
|
return self.parse_orders(orders, market)
|
4582
4591
|
|
4583
4592
|
async def fetch_order_classic(self, id: str, symbol: Str = None, params={}) -> Order:
|
@@ -1541,7 +1541,8 @@ class coinbaseexchange(Exchange, ImplicitAPI):
|
|
1541
1541
|
if symbol is not None:
|
1542
1542
|
market = self.market(symbol)
|
1543
1543
|
request['product_id'] = market['symbol'] # the request will be more performant if you include it
|
1544
|
-
|
1544
|
+
response = await getattr(self, method)(self.extend(request, params))
|
1545
|
+
return self.safe_order({'info': response})
|
1545
1546
|
|
1546
1547
|
async def cancel_all_orders(self, symbol: Str = None, params={}):
|
1547
1548
|
"""
|
@@ -1559,7 +1560,8 @@ class coinbaseexchange(Exchange, ImplicitAPI):
|
|
1559
1560
|
if symbol is not None:
|
1560
1561
|
market = self.market(symbol)
|
1561
1562
|
request['product_id'] = market['symbol'] # the request will be more performant if you include it
|
1562
|
-
|
1563
|
+
response = await self.privateDeleteOrders(self.extend(request, params))
|
1564
|
+
return [self.safe_order({'info': response})]
|
1563
1565
|
|
1564
1566
|
async def fetch_payment_methods(self, params={}):
|
1565
1567
|
return await self.privateGetPaymentMethods(params)
|
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.coinbaseinternational import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Any, Balances, Currencies, Currency, DepositAddress, Int, Market, Order, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
9
|
+
from ccxt.base.types import Any, Balances, Currencies, Currency, DepositAddress, Int, MarginModification, Market, Order, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import AuthenticationError
|
@@ -875,7 +875,7 @@ class coinbaseinternational(Exchange, ImplicitAPI):
|
|
875
875
|
},
|
876
876
|
})
|
877
877
|
|
878
|
-
async def set_margin(self, symbol: str, amount: float, params={}) ->
|
878
|
+
async def set_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
|
879
879
|
"""
|
880
880
|
Either adds or reduces margin in order to set the margin to a specific value
|
881
881
|
|