ccxt 4.4.31__py2.py3-none-any.whl → 4.4.33__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/coinbaseexchange.py +1 -0
- ccxt/abstract/kraken.py +1 -0
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/base/ws/aiohttp_client.py +25 -3
- ccxt/async_support/binance.py +153 -0
- ccxt/async_support/bitvavo.py +0 -3
- ccxt/async_support/bybit.py +134 -6
- ccxt/async_support/cex.py +4 -2
- ccxt/async_support/coinbase.py +2 -22
- ccxt/async_support/coinbaseexchange.py +2 -1
- ccxt/async_support/coinex.py +2 -1
- ccxt/async_support/deribit.py +2 -2
- ccxt/async_support/gate.py +15 -2
- ccxt/async_support/hitbtc.py +3 -3
- ccxt/async_support/htx.py +1 -1
- ccxt/async_support/hyperliquid.py +11 -2
- ccxt/async_support/indodax.py +1 -1
- ccxt/async_support/kraken.py +3 -2
- ccxt/async_support/kucoin.py +5 -3
- ccxt/async_support/kucoinfutures.py +94 -26
- ccxt/async_support/lbank.py +1 -0
- ccxt/async_support/okx.py +94 -3
- ccxt/async_support/phemex.py +34 -21
- ccxt/async_support/wavesexchange.py +3 -0
- ccxt/async_support/woofipro.py +2 -2
- ccxt/base/exchange.py +92 -2
- ccxt/binance.py +153 -0
- ccxt/bitvavo.py +0 -3
- ccxt/bybit.py +134 -6
- ccxt/cex.py +4 -2
- ccxt/coinbase.py +2 -22
- ccxt/coinbaseexchange.py +2 -1
- ccxt/coinex.py +2 -1
- ccxt/deribit.py +2 -2
- ccxt/gate.py +15 -2
- ccxt/hitbtc.py +3 -3
- ccxt/htx.py +1 -1
- ccxt/hyperliquid.py +11 -2
- ccxt/indodax.py +1 -1
- ccxt/kraken.py +3 -2
- ccxt/kucoin.py +5 -3
- ccxt/kucoinfutures.py +94 -26
- ccxt/lbank.py +1 -0
- ccxt/okx.py +94 -3
- ccxt/phemex.py +34 -21
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/binance.py +8 -8
- ccxt/pro/bitget.py +4 -4
- ccxt/pro/bitmart.py +2 -2
- ccxt/pro/bitmex.py +2 -2
- ccxt/pro/bitvavo.py +46 -45
- ccxt/pro/blofin.py +2 -2
- ccxt/pro/bybit.py +2 -2
- ccxt/pro/cryptocom.py +4 -4
- ccxt/pro/gate.py +4 -4
- ccxt/pro/hashkey.py +3 -3
- ccxt/pro/mexc.py +1 -2
- ccxt/pro/okx.py +8 -0
- ccxt/test/tests_async.py +3 -1
- ccxt/test/tests_helpers.py +1 -1
- ccxt/test/tests_sync.py +3 -1
- ccxt/wavesexchange.py +3 -0
- ccxt/woofipro.py +2 -2
- {ccxt-4.4.31.dist-info → ccxt-4.4.33.dist-info}/METADATA +10 -4
- {ccxt-4.4.31.dist-info → ccxt-4.4.33.dist-info}/RECORD +70 -70
- {ccxt-4.4.31.dist-info → ccxt-4.4.33.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.31.dist-info → ccxt-4.4.33.dist-info}/WHEEL +0 -0
- {ccxt-4.4.31.dist-info → ccxt-4.4.33.dist-info}/top_level.txt +0 -0
ccxt/__init__.py
CHANGED
@@ -12,6 +12,7 @@ class ImplicitAPI:
|
|
12
12
|
public_get_products_id_trades = publicGetProductsIdTrades = Entry('products/{id}/trades', 'public', 'GET', {})
|
13
13
|
public_get_time = publicGetTime = Entry('time', 'public', 'GET', {})
|
14
14
|
public_get_products_spark_lines = publicGetProductsSparkLines = Entry('products/spark-lines', 'public', 'GET', {})
|
15
|
+
public_get_products_volume_summary = publicGetProductsVolumeSummary = Entry('products/volume-summary', 'public', 'GET', {})
|
15
16
|
private_get_address_book = privateGetAddressBook = Entry('address-book', 'private', 'GET', {})
|
16
17
|
private_get_accounts = privateGetAccounts = Entry('accounts', 'private', 'GET', {})
|
17
18
|
private_get_accounts_id = privateGetAccountsId = Entry('accounts/{id}', 'private', 'GET', {})
|
ccxt/abstract/kraken.py
CHANGED
@@ -16,6 +16,7 @@ class ImplicitAPI:
|
|
16
16
|
private_post_addorder = privatePostAddOrder = Entry('AddOrder', 'private', 'POST', {'cost': 0})
|
17
17
|
private_post_addorderbatch = privatePostAddOrderBatch = Entry('AddOrderBatch', 'private', 'POST', {'cost': 0})
|
18
18
|
private_post_addexport = privatePostAddExport = Entry('AddExport', 'private', 'POST', {'cost': 3})
|
19
|
+
private_post_amendorder = privatePostAmendOrder = Entry('AmendOrder', 'private', 'POST', {'cost': 0})
|
19
20
|
private_post_balance = privatePostBalance = Entry('Balance', 'private', 'POST', {'cost': 3})
|
20
21
|
private_post_cancelall = privatePostCancelAll = Entry('CancelAll', 'private', 'POST', {'cost': 3})
|
21
22
|
private_post_cancelallordersafter = privatePostCancelAllOrdersAfter = Entry('CancelAllOrdersAfter', 'private', 'POST', {'cost': 3})
|
ccxt/async_support/__init__.py
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
|
3
|
+
orjson = None
|
4
|
+
try:
|
5
|
+
import orjson as orjson
|
6
|
+
except ImportError:
|
7
|
+
pass
|
8
|
+
|
3
9
|
import json
|
4
10
|
from asyncio import sleep, ensure_future
|
5
11
|
from aiohttp import WSMsgType
|
@@ -25,8 +31,16 @@ class AiohttpClient(Client):
|
|
25
31
|
self.log(iso8601(milliseconds()), 'message', data)
|
26
32
|
if isinstance(data, bytes):
|
27
33
|
data = data.decode()
|
28
|
-
decoded = json.loads(data) if is_json_encoded_object(data) else data
|
29
|
-
|
34
|
+
# decoded = json.loads(data) if is_json_encoded_object(data) else data
|
35
|
+
decode = None
|
36
|
+
if is_json_encoded_object(data):
|
37
|
+
if orjson is None:
|
38
|
+
decode = json.loads(data)
|
39
|
+
else:
|
40
|
+
decode = orjson.loads(data)
|
41
|
+
else:
|
42
|
+
decode = data
|
43
|
+
self.on_message_callback(self, decode)
|
30
44
|
|
31
45
|
def handle_message(self, message):
|
32
46
|
# self.log(iso8601(milliseconds()), message)
|
@@ -80,7 +94,15 @@ class AiohttpClient(Client):
|
|
80
94
|
async def send(self, message):
|
81
95
|
if self.verbose:
|
82
96
|
self.log(iso8601(milliseconds()), 'sending', message)
|
83
|
-
|
97
|
+
send_msg = None
|
98
|
+
if isinstance(message, str):
|
99
|
+
send_msg = message
|
100
|
+
else:
|
101
|
+
if orjson is None:
|
102
|
+
send_msg = json.dumps(message, separators=(',', ':'))
|
103
|
+
else:
|
104
|
+
send_msg = orjson.dumps(message).decode('utf-8')
|
105
|
+
return await self.connection.send_str(send_msg)
|
84
106
|
|
85
107
|
async def close(self, code=1000):
|
86
108
|
if self.verbose:
|
ccxt/async_support/binance.py
CHANGED
@@ -1579,6 +1579,157 @@ class binance(Exchange, ImplicitAPI):
|
|
1579
1579
|
'BUSD': 'USD',
|
1580
1580
|
},
|
1581
1581
|
},
|
1582
|
+
'features': {
|
1583
|
+
# https://developers.binance.com/docs/binance-spot-api-docs/rest-api#:~:text=quoteOrderQty
|
1584
|
+
'spot': {
|
1585
|
+
'sandbox': True,
|
1586
|
+
'createOrder': {
|
1587
|
+
'triggerPrice': True,
|
1588
|
+
'triggerPriceType': None,
|
1589
|
+
'triggerDirection': False,
|
1590
|
+
'stopLossPrice': True,
|
1591
|
+
'takeProfitPrice': True,
|
1592
|
+
'attachedStopLossTakeProfit': None, # not supported
|
1593
|
+
'marginMode': True,
|
1594
|
+
'timeInForce': {
|
1595
|
+
'GTC': True,
|
1596
|
+
'IOC': True,
|
1597
|
+
'FOK': True,
|
1598
|
+
'PO': True,
|
1599
|
+
'GTD': False,
|
1600
|
+
},
|
1601
|
+
'hedged': True,
|
1602
|
+
# exchange-supported features
|
1603
|
+
'selfTradePrevention': True,
|
1604
|
+
'trailing': True,
|
1605
|
+
'twap': False,
|
1606
|
+
'iceberg': True,
|
1607
|
+
'oco': False,
|
1608
|
+
},
|
1609
|
+
'createOrders': None,
|
1610
|
+
'fetchMyTrades': {
|
1611
|
+
'limit': 1000,
|
1612
|
+
'daysBack': None,
|
1613
|
+
'untilDays': 1, # days between start-end
|
1614
|
+
},
|
1615
|
+
'fetchOrder': {
|
1616
|
+
'marginMode': True,
|
1617
|
+
'trigger': False,
|
1618
|
+
'trailing': False,
|
1619
|
+
},
|
1620
|
+
'fetchOpenOrders': {
|
1621
|
+
'limit': None,
|
1622
|
+
'marginMode': True,
|
1623
|
+
'trigger': False,
|
1624
|
+
'trailing': False,
|
1625
|
+
},
|
1626
|
+
'fetchOrders': {
|
1627
|
+
'limit': 1000,
|
1628
|
+
'daysBack': None,
|
1629
|
+
'untilDays': 10000,
|
1630
|
+
'marginMode': True,
|
1631
|
+
'trigger': False,
|
1632
|
+
'trailing': False,
|
1633
|
+
},
|
1634
|
+
'fetchClosedOrders': {
|
1635
|
+
'limit': 1000,
|
1636
|
+
'daysBackClosed': None,
|
1637
|
+
'daysBackCanceled': None,
|
1638
|
+
'untilDays': 10000,
|
1639
|
+
'marginMode': True,
|
1640
|
+
'trigger': False,
|
1641
|
+
'trailing': False,
|
1642
|
+
},
|
1643
|
+
'fetchOHLCV': {
|
1644
|
+
'limit': 1000,
|
1645
|
+
},
|
1646
|
+
},
|
1647
|
+
'default': {
|
1648
|
+
'sandbox': True,
|
1649
|
+
'createOrder': {
|
1650
|
+
'triggerPrice': True,
|
1651
|
+
'triggerPriceType': {
|
1652
|
+
'mark': True,
|
1653
|
+
'last': True,
|
1654
|
+
'index': False,
|
1655
|
+
},
|
1656
|
+
'stopLossPrice': True,
|
1657
|
+
'takeProfitPrice': True,
|
1658
|
+
'attachedStopLossTakeProfit': None, # not supported
|
1659
|
+
'marginMode': False,
|
1660
|
+
'timeInForce': {
|
1661
|
+
'GTC': True,
|
1662
|
+
'IOC': True,
|
1663
|
+
'FOK': True,
|
1664
|
+
'PO': True,
|
1665
|
+
'GTD': True,
|
1666
|
+
# 'GTX': True,
|
1667
|
+
},
|
1668
|
+
'hedged': True,
|
1669
|
+
# exchange-supported features
|
1670
|
+
'selfTradePrevention': True,
|
1671
|
+
'trailing': True,
|
1672
|
+
'twap': False,
|
1673
|
+
'iceberg': False,
|
1674
|
+
'oco': False,
|
1675
|
+
},
|
1676
|
+
'createOrders': {
|
1677
|
+
'max': 5,
|
1678
|
+
},
|
1679
|
+
'fetchMyTrades': {
|
1680
|
+
'daysBack': None,
|
1681
|
+
'limit': 1000,
|
1682
|
+
'untilDays': 7,
|
1683
|
+
},
|
1684
|
+
'fetchOrder': {
|
1685
|
+
'marginMode': False,
|
1686
|
+
'trigger': False,
|
1687
|
+
'trailing': False,
|
1688
|
+
},
|
1689
|
+
'fetchOpenOrders': {
|
1690
|
+
'limit': 500,
|
1691
|
+
'marginMode': True,
|
1692
|
+
'trigger': False,
|
1693
|
+
'trailing': False,
|
1694
|
+
},
|
1695
|
+
'fetchOrders': {
|
1696
|
+
'limit': 1000,
|
1697
|
+
'daysBack': 90,
|
1698
|
+
'untilDays': 7,
|
1699
|
+
'marginMode': True,
|
1700
|
+
'trigger': False,
|
1701
|
+
'trailing': False,
|
1702
|
+
},
|
1703
|
+
'fetchClosedOrders': {
|
1704
|
+
'limit': 1000,
|
1705
|
+
'daysBackClosed': 90,
|
1706
|
+
'daysBackCanceled': 3,
|
1707
|
+
'untilDays': 7,
|
1708
|
+
'marginMode': True,
|
1709
|
+
'trigger': False,
|
1710
|
+
'trailing': False,
|
1711
|
+
},
|
1712
|
+
'fetchOHLCV': {
|
1713
|
+
'limit': 1500,
|
1714
|
+
},
|
1715
|
+
},
|
1716
|
+
'swap': {
|
1717
|
+
'linear': {
|
1718
|
+
'extends': 'default',
|
1719
|
+
},
|
1720
|
+
'inverse': {
|
1721
|
+
'extends': 'default',
|
1722
|
+
},
|
1723
|
+
},
|
1724
|
+
'future': {
|
1725
|
+
'linear': {
|
1726
|
+
'extends': 'default',
|
1727
|
+
},
|
1728
|
+
'inverse': {
|
1729
|
+
'extends': 'default',
|
1730
|
+
},
|
1731
|
+
},
|
1732
|
+
},
|
1582
1733
|
'exceptions': {
|
1583
1734
|
'spot': {
|
1584
1735
|
'exact': {
|
@@ -1974,6 +2125,8 @@ class binance(Exchange, ImplicitAPI):
|
|
1974
2125
|
'-4088': PermissionDenied, # User can not place order currently
|
1975
2126
|
'-4114': BadRequest, # INVALID_CLIENT_TRAN_ID_LEN
|
1976
2127
|
'-4115': BadRequest, # DUPLICATED_CLIENT_TRAN_ID
|
2128
|
+
'-4116': InvalidOrder, # DUPLICATED_CLIENT_ORDER_ID
|
2129
|
+
'-4117': OperationRejected, # STOP_ORDER_TRIGGERING
|
1977
2130
|
'-4118': OperationRejected, # REDUCE_ONLY_MARGIN_CHECK_FAILED
|
1978
2131
|
'-4131': OperationRejected, # The counterparty's best price does not meet the PERCENT_PRICE filter limit
|
1979
2132
|
'-4140': BadRequest, # Invalid symbol status for opening position
|
ccxt/async_support/bitvavo.py
CHANGED
@@ -1097,9 +1097,6 @@ class bitvavo(Exchange, ImplicitAPI):
|
|
1097
1097
|
request['timeInForce'] = timeInForce
|
1098
1098
|
if postOnly:
|
1099
1099
|
request['postOnly'] = True
|
1100
|
-
clientOrderId = self.safe_string(params, 'clientOrderId')
|
1101
|
-
if clientOrderId is None:
|
1102
|
-
request['clientOrderId'] = self.uuid22()
|
1103
1100
|
return self.extend(request, params)
|
1104
1101
|
|
1105
1102
|
async def create_order(self, symbol: Str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
ccxt/async_support/bybit.py
CHANGED
@@ -12,6 +12,7 @@ from typing import List
|
|
12
12
|
from ccxt.base.errors import ExchangeError
|
13
13
|
from ccxt.base.errors import AuthenticationError
|
14
14
|
from ccxt.base.errors import PermissionDenied
|
15
|
+
from ccxt.base.errors import AccountSuspended
|
15
16
|
from ccxt.base.errors import ArgumentsRequired
|
16
17
|
from ccxt.base.errors import BadRequest
|
17
18
|
from ccxt.base.errors import BadSymbol
|
@@ -568,7 +569,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
568
569
|
'10005': PermissionDenied, # permission denied for current apikey
|
569
570
|
'10006': RateLimitExceeded, # too many requests
|
570
571
|
'10007': AuthenticationError, # api_key not found in your request parameters
|
571
|
-
'10008':
|
572
|
+
'10008': AccountSuspended, # User had been banned
|
572
573
|
'10009': AuthenticationError, # IP had been banned
|
573
574
|
'10010': PermissionDenied, # request ip mismatch
|
574
575
|
'10014': BadRequest, # Request is duplicate
|
@@ -1012,7 +1013,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
1012
1013
|
'enableUnifiedMargin': None,
|
1013
1014
|
'enableUnifiedAccount': None,
|
1014
1015
|
'unifiedMarginStatus': None,
|
1015
|
-
'createMarketBuyOrderRequiresPrice':
|
1016
|
+
'createMarketBuyOrderRequiresPrice': False, # only True for classic accounts
|
1016
1017
|
'createUnifiedMarginAccount': False,
|
1017
1018
|
'defaultType': 'swap', # 'swap', 'future', 'option', 'spot'
|
1018
1019
|
'defaultSubType': 'linear', # 'linear', 'inverse'
|
@@ -1072,6 +1073,122 @@ class bybit(Exchange, ImplicitAPI):
|
|
1072
1073
|
'1d': '1d',
|
1073
1074
|
},
|
1074
1075
|
},
|
1076
|
+
'features': {
|
1077
|
+
'default': {
|
1078
|
+
'sandbox': True,
|
1079
|
+
'createOrder': {
|
1080
|
+
'triggerPrice': True,
|
1081
|
+
'triggerPriceType': {
|
1082
|
+
'last': True,
|
1083
|
+
'mark': True,
|
1084
|
+
'index': True,
|
1085
|
+
},
|
1086
|
+
'triggerDirection': True,
|
1087
|
+
'stopLossPrice': True,
|
1088
|
+
'takeProfitPrice': True,
|
1089
|
+
'attachedStopLossTakeProfit': {
|
1090
|
+
'triggerPriceType': {
|
1091
|
+
'last': True,
|
1092
|
+
'mark': True,
|
1093
|
+
'index': True,
|
1094
|
+
},
|
1095
|
+
'limitPrice': True,
|
1096
|
+
},
|
1097
|
+
'marginMode': False,
|
1098
|
+
'timeInForce': {
|
1099
|
+
'GTC': True,
|
1100
|
+
'IOC': True,
|
1101
|
+
'FOK': True,
|
1102
|
+
'PO': True,
|
1103
|
+
'GTD': False,
|
1104
|
+
},
|
1105
|
+
'hedged': True,
|
1106
|
+
# exchange-supported features
|
1107
|
+
'selfTradePrevention': True,
|
1108
|
+
'trailing': True,
|
1109
|
+
'twap': False,
|
1110
|
+
'iceberg': False,
|
1111
|
+
'oco': False,
|
1112
|
+
},
|
1113
|
+
'createOrders': {
|
1114
|
+
'max': 10,
|
1115
|
+
},
|
1116
|
+
'fetchMyTrades': {
|
1117
|
+
'limit': 100,
|
1118
|
+
'daysBack': 365 * 2, # 2 years
|
1119
|
+
'untilDays': 7, # days between start-end
|
1120
|
+
},
|
1121
|
+
'fetchOrder': {
|
1122
|
+
'marginMode': False,
|
1123
|
+
'trigger': True,
|
1124
|
+
'trailing': False,
|
1125
|
+
},
|
1126
|
+
'fetchOpenOrders': {
|
1127
|
+
'limit': 50,
|
1128
|
+
'marginMode': False,
|
1129
|
+
'trigger': True,
|
1130
|
+
'trailing': False,
|
1131
|
+
},
|
1132
|
+
'fetchOrders': None,
|
1133
|
+
'fetchClosedOrders': {
|
1134
|
+
'limit': 50,
|
1135
|
+
'daysBackClosed': 365 * 2, # 2 years
|
1136
|
+
'daysBackCanceled': 1,
|
1137
|
+
'untilDays': 7,
|
1138
|
+
'marginMode': False,
|
1139
|
+
'trigger': True,
|
1140
|
+
'trailing': False,
|
1141
|
+
},
|
1142
|
+
'fetchOHLCV': {
|
1143
|
+
'limit': 1000,
|
1144
|
+
},
|
1145
|
+
},
|
1146
|
+
'spot': {
|
1147
|
+
'extends': 'default',
|
1148
|
+
'createOrder': {
|
1149
|
+
'triggerPrice': True,
|
1150
|
+
'triggerPriceType': None,
|
1151
|
+
'triggerDirection': False,
|
1152
|
+
'stopLossPrice': True,
|
1153
|
+
'takeProfitPrice': True,
|
1154
|
+
'attachedStopLossTakeProfit': {
|
1155
|
+
'triggerPriceType': None,
|
1156
|
+
'limitPrice': True,
|
1157
|
+
},
|
1158
|
+
'marginMode': False,
|
1159
|
+
'timeInForce': {
|
1160
|
+
'GTC': True,
|
1161
|
+
'IOC': True,
|
1162
|
+
'FOK': True,
|
1163
|
+
'PO': True,
|
1164
|
+
'GTD': False,
|
1165
|
+
},
|
1166
|
+
'hedged': True,
|
1167
|
+
# exchange-supported features
|
1168
|
+
'selfTradePrevention': True,
|
1169
|
+
'trailing': True,
|
1170
|
+
'twap': False,
|
1171
|
+
'iceberg': False,
|
1172
|
+
'oco': False,
|
1173
|
+
},
|
1174
|
+
},
|
1175
|
+
'swap': {
|
1176
|
+
'linear': {
|
1177
|
+
'extends': 'default',
|
1178
|
+
},
|
1179
|
+
'inverse': {
|
1180
|
+
'extends': 'default',
|
1181
|
+
},
|
1182
|
+
},
|
1183
|
+
'future': {
|
1184
|
+
'linear': {
|
1185
|
+
'extends': 'default',
|
1186
|
+
},
|
1187
|
+
'inverse': {
|
1188
|
+
'extends': 'default',
|
1189
|
+
},
|
1190
|
+
},
|
1191
|
+
},
|
1075
1192
|
'fees': {
|
1076
1193
|
'trading': {
|
1077
1194
|
'feeSide': 'get',
|
@@ -3346,11 +3463,17 @@ class bybit(Exchange, ImplicitAPI):
|
|
3346
3463
|
market = self.safe_market(marketId, market, None, marketType)
|
3347
3464
|
symbol = market['symbol']
|
3348
3465
|
timestamp = self.safe_integer_2(order, 'createdTime', 'createdAt')
|
3466
|
+
marketUnit = self.safe_string(order, 'marketUnit', 'baseCoin')
|
3349
3467
|
id = self.safe_string(order, 'orderId')
|
3350
3468
|
type = self.safe_string_lower(order, 'orderType')
|
3351
3469
|
price = self.safe_string(order, 'price')
|
3352
|
-
amount =
|
3353
|
-
cost =
|
3470
|
+
amount: Str = None
|
3471
|
+
cost: Str = None
|
3472
|
+
if marketUnit == 'baseCoin':
|
3473
|
+
amount = self.safe_string(order, 'qty')
|
3474
|
+
cost = self.safe_string(order, 'cumExecValue')
|
3475
|
+
else:
|
3476
|
+
cost = self.safe_string(order, 'cumExecValue')
|
3354
3477
|
filled = self.safe_string(order, 'cumExecQty')
|
3355
3478
|
remaining = self.safe_string(order, 'leavesQty')
|
3356
3479
|
lastTradeTimestamp = self.safe_integer_2(order, 'updatedTime', 'updatedAt')
|
@@ -3666,7 +3789,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
3666
3789
|
# classic accounts
|
3667
3790
|
# for market buy it requires the amount of quote currency to spend
|
3668
3791
|
createMarketBuyOrderRequiresPrice = True
|
3669
|
-
createMarketBuyOrderRequiresPrice, params = self.handle_option_and_params(params, 'createOrder', 'createMarketBuyOrderRequiresPrice'
|
3792
|
+
createMarketBuyOrderRequiresPrice, params = self.handle_option_and_params(params, 'createOrder', 'createMarketBuyOrderRequiresPrice')
|
3670
3793
|
if createMarketBuyOrderRequiresPrice:
|
3671
3794
|
if (price is None) and (cost is None):
|
3672
3795
|
raise InvalidOrder(self.id + ' createOrder() requires the price argument for market buy orders to calculate the total cost to spend(amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to False and pass the cost to spend in the amount argument')
|
@@ -3675,7 +3798,12 @@ class bybit(Exchange, ImplicitAPI):
|
|
3675
3798
|
costRequest = cost if (cost is not None) else quoteAmount
|
3676
3799
|
request['qty'] = self.get_cost(symbol, costRequest)
|
3677
3800
|
else:
|
3678
|
-
|
3801
|
+
if cost is not None:
|
3802
|
+
request['qty'] = self.get_cost(symbol, self.number_to_string(cost))
|
3803
|
+
elif price is not None:
|
3804
|
+
request['qty'] = self.get_cost(symbol, Precise.string_mul(amountString, priceString))
|
3805
|
+
else:
|
3806
|
+
request['qty'] = self.get_cost(symbol, self.number_to_string(amount))
|
3679
3807
|
else:
|
3680
3808
|
if not isTrailingAmountOrder and not isAlternativeEndpoint:
|
3681
3809
|
request['qty'] = amountString
|
ccxt/async_support/cex.py
CHANGED
@@ -10,6 +10,7 @@ import hashlib
|
|
10
10
|
from ccxt.base.types import Account, Balances, Currencies, Currency, DepositAddress, Int, LedgerEntry, Market, Num, Order, OrderBook, 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
|
+
from ccxt.base.errors import AuthenticationError
|
13
14
|
from ccxt.base.errors import PermissionDenied
|
14
15
|
from ccxt.base.errors import ArgumentsRequired
|
15
16
|
from ccxt.base.errors import BadRequest
|
@@ -127,6 +128,7 @@ class cex(Exchange, ImplicitAPI):
|
|
127
128
|
'Insufficient funds': InsufficientFunds,
|
128
129
|
'Get deposit address for main account is not allowed': PermissionDenied,
|
129
130
|
'Market Trigger orders are not allowed': BadRequest, # for some reason, triggerPrice does not work for market orders
|
131
|
+
'key not passed or incorrect': AuthenticationError,
|
130
132
|
},
|
131
133
|
},
|
132
134
|
'timeframes': {
|
@@ -837,7 +839,7 @@ class cex(Exchange, ImplicitAPI):
|
|
837
839
|
code = self.safe_currency_code(key)
|
838
840
|
account: dict = {
|
839
841
|
'used': self.safe_string(balance, 'balanceOnHold'),
|
840
|
-
'
|
842
|
+
'total': self.safe_string(balance, 'balance'),
|
841
843
|
}
|
842
844
|
result[code] = account
|
843
845
|
return self.safe_balance(result)
|
@@ -848,7 +850,7 @@ class cex(Exchange, ImplicitAPI):
|
|
848
850
|
|
849
851
|
https://trade.cex.io/docs/#rest-private-api-calls-orders
|
850
852
|
|
851
|
-
|
853
|
+
:param str status: order status to fetch for
|
852
854
|
:param str symbol: unified market symbol of the market orders were made in
|
853
855
|
:param int [since]: the earliest time in ms to fetch orders for
|
854
856
|
:param int [limit]: the maximum number of order structures to retrieve
|
ccxt/async_support/coinbase.py
CHANGED
@@ -2311,28 +2311,8 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2311
2311
|
pagination = self.safe_dict(response, 'pagination', {})
|
2312
2312
|
cursor = self.safe_string(pagination, 'next_starting_after')
|
2313
2313
|
if (cursor is not None) and (cursor != ''):
|
2314
|
-
|
2315
|
-
|
2316
|
-
ledger[lastIndex] = {
|
2317
|
-
'info': self.safe_dict(last, 'info'),
|
2318
|
-
'id': self.safe_string(last, 'id'),
|
2319
|
-
'timestamp': self.safe_integer(last, 'timestamp'),
|
2320
|
-
'datetime': self.safe_string(last, 'datetime'),
|
2321
|
-
'direction': self.safe_string(last, 'direction'),
|
2322
|
-
'account': self.safe_string(last, 'account'),
|
2323
|
-
'referenceId': None,
|
2324
|
-
'referenceAccount': None,
|
2325
|
-
'type': self.safe_string(last, 'type'),
|
2326
|
-
'currency': self.safe_string(last, 'currency'),
|
2327
|
-
'amount': self.safe_number(last, 'amount'),
|
2328
|
-
'before': None,
|
2329
|
-
'after': None,
|
2330
|
-
'status': self.safe_string(last, 'status'),
|
2331
|
-
'fee': {
|
2332
|
-
'cost': self.safe_number(lastFee, 'cost'),
|
2333
|
-
'currency': self.safe_string(lastFee, 'currency'),
|
2334
|
-
},
|
2335
|
-
}
|
2314
|
+
last['info']['next_starting_after'] = cursor
|
2315
|
+
ledger[lastIndex] = last
|
2336
2316
|
return ledger
|
2337
2317
|
|
2338
2318
|
def parse_ledger_entry_status(self, status):
|
@@ -127,7 +127,8 @@ class coinbaseexchange(Exchange, ImplicitAPI):
|
|
127
127
|
'products/{id}/ticker',
|
128
128
|
'products/{id}/trades',
|
129
129
|
'time',
|
130
|
-
'products/spark-lines', # experimental
|
130
|
+
'products/spark-lines', # experimental,
|
131
|
+
'products/volume-summary',
|
131
132
|
],
|
132
133
|
},
|
133
134
|
'private': {
|
ccxt/async_support/coinex.py
CHANGED
@@ -3253,7 +3253,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
3253
3253
|
https://docs.coinex.com/api/v2/futures/order/http/list-finished-order
|
3254
3254
|
https://docs.coinex.com/api/v2/futures/order/http/list-finished-stop-order
|
3255
3255
|
|
3256
|
-
|
3256
|
+
:param str status: order status to fetch for
|
3257
3257
|
:param str symbol: unified market symbol of the market orders were made in
|
3258
3258
|
:param int [since]: the earliest time in ms to fetch orders for
|
3259
3259
|
:param int [limit]: the maximum number of order structures to retrieve
|
@@ -4575,6 +4575,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
4575
4575
|
'not_pass': 'failed',
|
4576
4576
|
'cancel': 'canceled',
|
4577
4577
|
'finish': 'ok',
|
4578
|
+
'finished': 'ok',
|
4578
4579
|
'fail': 'failed',
|
4579
4580
|
}
|
4580
4581
|
return self.safe_string(statuses, status, status)
|
ccxt/async_support/deribit.py
CHANGED
@@ -2965,8 +2965,8 @@ class deribit(Exchange, ImplicitAPI):
|
|
2965
2965
|
https://docs.deribit.com/#public-get_funding_rate_history
|
2966
2966
|
|
2967
2967
|
:param str symbol: unified market symbol
|
2968
|
-
|
2969
|
-
|
2968
|
+
:param int [since]: the earliest time in ms to fetch funding rate history for
|
2969
|
+
:param int [limit]: the maximum number of entries to retrieve
|
2970
2970
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2971
2971
|
:param int [params.end_timestamp]: fetch funding rate ending at self timestamp
|
2972
2972
|
:param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
ccxt/async_support/gate.py
CHANGED
@@ -3023,18 +3023,31 @@ class gate(Exchange, ImplicitAPI):
|
|
3023
3023
|
:param int [since]: timestamp in ms of the earliest funding rate to fetch
|
3024
3024
|
:param int [limit]: the maximum amount of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-history-structure>` to fetch
|
3025
3025
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3026
|
+
:param int [params.until]: timestamp in ms of the latest funding rate to fetch
|
3027
|
+
:param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
3026
3028
|
:returns dict[]: a list of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-history-structure>`
|
3027
3029
|
"""
|
3028
3030
|
if symbol is None:
|
3029
3031
|
raise ArgumentsRequired(self.id + ' fetchFundingRateHistory() requires a symbol argument')
|
3030
3032
|
await self.load_markets()
|
3033
|
+
paginate = False
|
3034
|
+
paginate, params = self.handle_option_and_params(params, 'fetchFundingRateHistory', 'paginate')
|
3035
|
+
if paginate:
|
3036
|
+
return await self.fetch_paginated_call_deterministic('fetchFundingRateHistory', symbol, since, limit, '8h', params)
|
3031
3037
|
market = self.market(symbol)
|
3032
3038
|
if not market['swap']:
|
3033
3039
|
raise BadSymbol(self.id + ' fetchFundingRateHistory() supports swap contracts only')
|
3034
|
-
request
|
3040
|
+
request: dict = {}
|
3041
|
+
request, params = self.prepare_request(market, None, params)
|
3035
3042
|
if limit is not None:
|
3036
3043
|
request['limit'] = limit
|
3037
|
-
|
3044
|
+
if since is not None:
|
3045
|
+
request['from'] = self.parse_to_int(since / 1000)
|
3046
|
+
until = self.safe_integer(params, 'until')
|
3047
|
+
if until is not None:
|
3048
|
+
params = self.omit(params, 'until')
|
3049
|
+
request['to'] = self.parse_to_int(until / 1000)
|
3050
|
+
response = await self.publicFuturesGetSettleFundingRate(self.extend(request, params))
|
3038
3051
|
#
|
3039
3052
|
# {
|
3040
3053
|
# "r": "0.00063521",
|
ccxt/async_support/hitbtc.py
CHANGED
@@ -1530,7 +1530,7 @@ class hitbtc(Exchange, ImplicitAPI):
|
|
1530
1530
|
|
1531
1531
|
https://api.hitbtc.com/#order-books
|
1532
1532
|
|
1533
|
-
:param str[]
|
1533
|
+
:param str[] [symbols]: list of unified market symbols, all symbols fetched if None, default is None
|
1534
1534
|
:param int [limit]: max number of entries per orderbook to return, default is None
|
1535
1535
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1536
1536
|
:returns dict: a dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbol
|
@@ -3396,8 +3396,8 @@ class hitbtc(Exchange, ImplicitAPI):
|
|
3396
3396
|
|
3397
3397
|
https://api.hitbtc.com/#close-all-futures-margin-positions
|
3398
3398
|
|
3399
|
-
|
3400
|
-
|
3399
|
+
:param str symbol: unified ccxt market symbol
|
3400
|
+
:param str side: 'buy' or 'sell'
|
3401
3401
|
:param dict [params]: extra parameters specific to the okx api endpoint
|
3402
3402
|
:param str [params.symbol]: *required* unified market symbol
|
3403
3403
|
:param str [params.marginMode]: 'cross' or 'isolated', default is 'cross'
|
ccxt/async_support/htx.py
CHANGED
@@ -3071,7 +3071,7 @@ class htx(Exchange, ImplicitAPI):
|
|
3071
3071
|
|
3072
3072
|
:param str type: 'spot', 'swap' or 'future
|
3073
3073
|
:param str [marginMode]: 'cross' or 'isolated'
|
3074
|
-
|
3074
|
+
:param str [symbol]: unified ccxt market symbol
|
3075
3075
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3076
3076
|
:returns dict: a dictionary of `account structures <https://docs.ccxt.com/#/?id=account-structure>` indexed by the account type
|
3077
3077
|
"""
|