ccxt 4.3.4__py2.py3-none-any.whl → 4.3.6__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/binance.py +1 -0
- ccxt/abstract/binancecoinm.py +1 -0
- ccxt/abstract/binanceus.py +1 -0
- ccxt/abstract/binanceusdm.py +1 -0
- ccxt/abstract/bingx.py +1 -0
- ccxt/abstract/whitebit.py +22 -1
- ccxt/abstract/woo.py +1 -0
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +227 -36
- ccxt/async_support/binance.py +21 -14
- ccxt/async_support/bingx.py +40 -0
- ccxt/async_support/bitmex.py +22 -0
- ccxt/async_support/bybit.py +81 -1
- ccxt/async_support/coinbase.py +4 -4
- ccxt/async_support/coinex.py +29 -32
- ccxt/async_support/cryptocom.py +30 -1
- ccxt/async_support/htx.py +26 -0
- ccxt/async_support/hyperliquid.py +37 -0
- ccxt/async_support/kraken.py +27 -0
- ccxt/async_support/krakenfutures.py +26 -0
- ccxt/async_support/kucoin.py +52 -4
- ccxt/async_support/kucoinfutures.py +2 -2
- ccxt/async_support/okx.py +104 -1
- ccxt/async_support/whitebit.py +149 -2
- ccxt/async_support/woo.py +27 -0
- ccxt/base/exchange.py +233 -4
- ccxt/binance.py +21 -14
- ccxt/bingx.py +40 -0
- ccxt/bitmex.py +22 -0
- ccxt/bybit.py +81 -1
- ccxt/coinbase.py +4 -4
- ccxt/coinex.py +29 -32
- ccxt/cryptocom.py +30 -1
- ccxt/htx.py +26 -0
- ccxt/hyperliquid.py +37 -0
- ccxt/kraken.py +27 -0
- ccxt/krakenfutures.py +26 -0
- ccxt/kucoin.py +52 -4
- ccxt/kucoinfutures.py +2 -2
- ccxt/okx.py +104 -1
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/binance.py +410 -73
- ccxt/pro/bitget.py +1 -1
- ccxt/pro/cex.py +1 -1
- ccxt/pro/lbank.py +1 -1
- ccxt/pro/woo.py +0 -1
- ccxt/test/test_async.py +17 -17
- ccxt/test/test_sync.py +17 -17
- ccxt/whitebit.py +149 -2
- ccxt/woo.py +27 -0
- {ccxt-4.3.4.dist-info → ccxt-4.3.6.dist-info}/METADATA +4 -4
- {ccxt-4.3.4.dist-info → ccxt-4.3.6.dist-info}/RECORD +55 -55
- {ccxt-4.3.4.dist-info → ccxt-4.3.6.dist-info}/WHEEL +0 -0
- {ccxt-4.3.4.dist-info → ccxt-4.3.6.dist-info}/top_level.txt +0 -0
ccxt/__init__.py
CHANGED
ccxt/abstract/binance.py
CHANGED
@@ -87,6 +87,7 @@ class ImplicitAPI:
|
|
87
87
|
sapi_get_capital_deposit_subaddress = sapiGetCapitalDepositSubAddress = Entry('capital/deposit/subAddress', 'sapi', 'GET', {'cost': 0.1})
|
88
88
|
sapi_get_capital_deposit_subhisrec = sapiGetCapitalDepositSubHisrec = Entry('capital/deposit/subHisrec', 'sapi', 'GET', {'cost': 0.1})
|
89
89
|
sapi_get_capital_withdraw_history = sapiGetCapitalWithdrawHistory = Entry('capital/withdraw/history', 'sapi', 'GET', {'cost': 1800})
|
90
|
+
sapi_get_capital_withdraw_address_list = sapiGetCapitalWithdrawAddressList = Entry('capital/withdraw/address/list', 'sapi', 'GET', {'cost': 10})
|
90
91
|
sapi_get_capital_contract_convertible_coins = sapiGetCapitalContractConvertibleCoins = Entry('capital/contract/convertible-coins', 'sapi', 'GET', {'cost': 4.0002})
|
91
92
|
sapi_get_convert_tradeflow = sapiGetConvertTradeFlow = Entry('convert/tradeFlow', 'sapi', 'GET', {'cost': 20.001})
|
92
93
|
sapi_get_convert_exchangeinfo = sapiGetConvertExchangeInfo = Entry('convert/exchangeInfo', 'sapi', 'GET', {'cost': 50})
|
ccxt/abstract/binancecoinm.py
CHANGED
@@ -87,6 +87,7 @@ class ImplicitAPI:
|
|
87
87
|
sapi_get_capital_deposit_subaddress = sapiGetCapitalDepositSubAddress = Entry('capital/deposit/subAddress', 'sapi', 'GET', {'cost': 0.1})
|
88
88
|
sapi_get_capital_deposit_subhisrec = sapiGetCapitalDepositSubHisrec = Entry('capital/deposit/subHisrec', 'sapi', 'GET', {'cost': 0.1})
|
89
89
|
sapi_get_capital_withdraw_history = sapiGetCapitalWithdrawHistory = Entry('capital/withdraw/history', 'sapi', 'GET', {'cost': 1800})
|
90
|
+
sapi_get_capital_withdraw_address_list = sapiGetCapitalWithdrawAddressList = Entry('capital/withdraw/address/list', 'sapi', 'GET', {'cost': 10})
|
90
91
|
sapi_get_capital_contract_convertible_coins = sapiGetCapitalContractConvertibleCoins = Entry('capital/contract/convertible-coins', 'sapi', 'GET', {'cost': 4.0002})
|
91
92
|
sapi_get_convert_tradeflow = sapiGetConvertTradeFlow = Entry('convert/tradeFlow', 'sapi', 'GET', {'cost': 20.001})
|
92
93
|
sapi_get_convert_exchangeinfo = sapiGetConvertExchangeInfo = Entry('convert/exchangeInfo', 'sapi', 'GET', {'cost': 50})
|
ccxt/abstract/binanceus.py
CHANGED
@@ -87,6 +87,7 @@ class ImplicitAPI:
|
|
87
87
|
sapi_get_capital_deposit_subaddress = sapiGetCapitalDepositSubAddress = Entry('capital/deposit/subAddress', 'sapi', 'GET', {'cost': 0.1})
|
88
88
|
sapi_get_capital_deposit_subhisrec = sapiGetCapitalDepositSubHisrec = Entry('capital/deposit/subHisrec', 'sapi', 'GET', {'cost': 0.1})
|
89
89
|
sapi_get_capital_withdraw_history = sapiGetCapitalWithdrawHistory = Entry('capital/withdraw/history', 'sapi', 'GET', {'cost': 1800})
|
90
|
+
sapi_get_capital_withdraw_address_list = sapiGetCapitalWithdrawAddressList = Entry('capital/withdraw/address/list', 'sapi', 'GET', {'cost': 10})
|
90
91
|
sapi_get_capital_contract_convertible_coins = sapiGetCapitalContractConvertibleCoins = Entry('capital/contract/convertible-coins', 'sapi', 'GET', {'cost': 4.0002})
|
91
92
|
sapi_get_convert_tradeflow = sapiGetConvertTradeFlow = Entry('convert/tradeFlow', 'sapi', 'GET', {'cost': 20.001})
|
92
93
|
sapi_get_convert_exchangeinfo = sapiGetConvertExchangeInfo = Entry('convert/exchangeInfo', 'sapi', 'GET', {'cost': 50})
|
ccxt/abstract/binanceusdm.py
CHANGED
@@ -87,6 +87,7 @@ class ImplicitAPI:
|
|
87
87
|
sapi_get_capital_deposit_subaddress = sapiGetCapitalDepositSubAddress = Entry('capital/deposit/subAddress', 'sapi', 'GET', {'cost': 0.1})
|
88
88
|
sapi_get_capital_deposit_subhisrec = sapiGetCapitalDepositSubHisrec = Entry('capital/deposit/subHisrec', 'sapi', 'GET', {'cost': 0.1})
|
89
89
|
sapi_get_capital_withdraw_history = sapiGetCapitalWithdrawHistory = Entry('capital/withdraw/history', 'sapi', 'GET', {'cost': 1800})
|
90
|
+
sapi_get_capital_withdraw_address_list = sapiGetCapitalWithdrawAddressList = Entry('capital/withdraw/address/list', 'sapi', 'GET', {'cost': 10})
|
90
91
|
sapi_get_capital_contract_convertible_coins = sapiGetCapitalContractConvertibleCoins = Entry('capital/contract/convertible-coins', 'sapi', 'GET', {'cost': 4.0002})
|
91
92
|
sapi_get_convert_tradeflow = sapiGetConvertTradeFlow = Entry('convert/tradeFlow', 'sapi', 'GET', {'cost': 20.001})
|
92
93
|
sapi_get_convert_exchangeinfo = sapiGetConvertExchangeInfo = Entry('convert/exchangeInfo', 'sapi', 'GET', {'cost': 50})
|
ccxt/abstract/bingx.py
CHANGED
@@ -62,6 +62,7 @@ class ImplicitAPI:
|
|
62
62
|
swap_v2_private_post_trade_order = swapV2PrivatePostTradeOrder = Entry('trade/order', ['swap', 'v2', 'private'], 'POST', {'cost': 3})
|
63
63
|
swap_v2_private_post_trade_batchorders = swapV2PrivatePostTradeBatchOrders = Entry('trade/batchOrders', ['swap', 'v2', 'private'], 'POST', {'cost': 3})
|
64
64
|
swap_v2_private_post_trade_closeallpositions = swapV2PrivatePostTradeCloseAllPositions = Entry('trade/closeAllPositions', ['swap', 'v2', 'private'], 'POST', {'cost': 3})
|
65
|
+
swap_v2_private_post_trade_cancelallafter = swapV2PrivatePostTradeCancelAllAfter = Entry('trade/cancelAllAfter', ['swap', 'v2', 'private'], 'POST', {'cost': 3})
|
65
66
|
swap_v2_private_post_trade_margintype = swapV2PrivatePostTradeMarginType = Entry('trade/marginType', ['swap', 'v2', 'private'], 'POST', {'cost': 3})
|
66
67
|
swap_v2_private_post_trade_leverage = swapV2PrivatePostTradeLeverage = Entry('trade/leverage', ['swap', 'v2', 'private'], 'POST', {'cost': 3})
|
67
68
|
swap_v2_private_post_trade_positionmargin = swapV2PrivatePostTradePositionMargin = Entry('trade/positionMargin', ['swap', 'v2', 'private'], 'POST', {'cost': 3})
|
ccxt/abstract/whitebit.py
CHANGED
@@ -34,7 +34,9 @@ class ImplicitAPI:
|
|
34
34
|
v4_public_get_ping = v4PublicGetPing = Entry('ping', ['v4', 'public'], 'GET', {})
|
35
35
|
v4_public_get_markets = v4PublicGetMarkets = Entry('markets', ['v4', 'public'], 'GET', {})
|
36
36
|
v4_public_get_futures = v4PublicGetFutures = Entry('futures', ['v4', 'public'], 'GET', {})
|
37
|
+
v4_public_get_platform_status = v4PublicGetPlatformStatus = Entry('platform/status', ['v4', 'public'], 'GET', {})
|
37
38
|
v4_private_post_collateral_account_balance = v4PrivatePostCollateralAccountBalance = Entry('collateral-account/balance', ['v4', 'private'], 'POST', {})
|
39
|
+
v4_private_post_collateral_account_balance_summary = v4PrivatePostCollateralAccountBalanceSummary = Entry('collateral-account/balance-summary', ['v4', 'private'], 'POST', {})
|
38
40
|
v4_private_post_collateral_account_positions_history = v4PrivatePostCollateralAccountPositionsHistory = Entry('collateral-account/positions/history', ['v4', 'private'], 'POST', {})
|
39
41
|
v4_private_post_collateral_account_leverage = v4PrivatePostCollateralAccountLeverage = Entry('collateral-account/leverage', ['v4', 'private'], 'POST', {})
|
40
42
|
v4_private_post_collateral_account_positions_open = v4PrivatePostCollateralAccountPositionsOpen = Entry('collateral-account/positions/open', ['v4', 'private'], 'POST', {})
|
@@ -51,18 +53,37 @@ class ImplicitAPI:
|
|
51
53
|
v4_private_post_main_account_withdraw = v4PrivatePostMainAccountWithdraw = Entry('main-account/withdraw', ['v4', 'private'], 'POST', {})
|
52
54
|
v4_private_post_main_account_withdraw_pay = v4PrivatePostMainAccountWithdrawPay = Entry('main-account/withdraw-pay', ['v4', 'private'], 'POST', {})
|
53
55
|
v4_private_post_main_account_transfer = v4PrivatePostMainAccountTransfer = Entry('main-account/transfer', ['v4', 'private'], 'POST', {})
|
56
|
+
v4_private_post_main_account_smart_plans = v4PrivatePostMainAccountSmartPlans = Entry('main-account/smart/plans', ['v4', 'private'], 'POST', {})
|
57
|
+
v4_private_post_main_account_smart_investment = v4PrivatePostMainAccountSmartInvestment = Entry('main-account/smart/investment', ['v4', 'private'], 'POST', {})
|
58
|
+
v4_private_post_main_account_smart_investment_close = v4PrivatePostMainAccountSmartInvestmentClose = Entry('main-account/smart/investment/close', ['v4', 'private'], 'POST', {})
|
59
|
+
v4_private_post_main_account_smart_investments = v4PrivatePostMainAccountSmartInvestments = Entry('main-account/smart/investments', ['v4', 'private'], 'POST', {})
|
60
|
+
v4_private_post_main_account_fee = v4PrivatePostMainAccountFee = Entry('main-account/fee', ['v4', 'private'], 'POST', {})
|
61
|
+
v4_private_post_main_account_smart_interest_payment_history = v4PrivatePostMainAccountSmartInterestPaymentHistory = Entry('main-account/smart/interest-payment-history', ['v4', 'private'], 'POST', {})
|
54
62
|
v4_private_post_trade_account_balance = v4PrivatePostTradeAccountBalance = Entry('trade-account/balance', ['v4', 'private'], 'POST', {})
|
55
63
|
v4_private_post_trade_account_executed_history = v4PrivatePostTradeAccountExecutedHistory = Entry('trade-account/executed-history', ['v4', 'private'], 'POST', {})
|
56
64
|
v4_private_post_trade_account_order = v4PrivatePostTradeAccountOrder = Entry('trade-account/order', ['v4', 'private'], 'POST', {})
|
57
65
|
v4_private_post_trade_account_order_history = v4PrivatePostTradeAccountOrderHistory = Entry('trade-account/order/history', ['v4', 'private'], 'POST', {})
|
58
66
|
v4_private_post_order_collateral_limit = v4PrivatePostOrderCollateralLimit = Entry('order/collateral/limit', ['v4', 'private'], 'POST', {})
|
59
67
|
v4_private_post_order_collateral_market = v4PrivatePostOrderCollateralMarket = Entry('order/collateral/market', ['v4', 'private'], 'POST', {})
|
60
|
-
|
68
|
+
v4_private_post_order_collateral_stop_limit = v4PrivatePostOrderCollateralStopLimit = Entry('order/collateral/stop-limit', ['v4', 'private'], 'POST', {})
|
69
|
+
v4_private_post_order_collateral_trigger_market = v4PrivatePostOrderCollateralTriggerMarket = Entry('order/collateral/trigger-market', ['v4', 'private'], 'POST', {})
|
61
70
|
v4_private_post_order_new = v4PrivatePostOrderNew = Entry('order/new', ['v4', 'private'], 'POST', {})
|
62
71
|
v4_private_post_order_market = v4PrivatePostOrderMarket = Entry('order/market', ['v4', 'private'], 'POST', {})
|
63
72
|
v4_private_post_order_stock_market = v4PrivatePostOrderStockMarket = Entry('order/stock_market', ['v4', 'private'], 'POST', {})
|
64
73
|
v4_private_post_order_stop_limit = v4PrivatePostOrderStopLimit = Entry('order/stop_limit', ['v4', 'private'], 'POST', {})
|
65
74
|
v4_private_post_order_stop_market = v4PrivatePostOrderStopMarket = Entry('order/stop_market', ['v4', 'private'], 'POST', {})
|
66
75
|
v4_private_post_order_cancel = v4PrivatePostOrderCancel = Entry('order/cancel', ['v4', 'private'], 'POST', {})
|
76
|
+
v4_private_post_order_cancel_all = v4PrivatePostOrderCancelAll = Entry('order/cancel/all', ['v4', 'private'], 'POST', {})
|
77
|
+
v4_private_post_order_kill_switch = v4PrivatePostOrderKillSwitch = Entry('order/kill-switch', ['v4', 'private'], 'POST', {})
|
78
|
+
v4_private_post_order_kill_switch_status = v4PrivatePostOrderKillSwitchStatus = Entry('order/kill-switch/status', ['v4', 'private'], 'POST', {})
|
79
|
+
v4_private_post_order_bulk = v4PrivatePostOrderBulk = Entry('order/bulk', ['v4', 'private'], 'POST', {})
|
80
|
+
v4_private_post_order_modify = v4PrivatePostOrderModify = Entry('order/modify', ['v4', 'private'], 'POST', {})
|
67
81
|
v4_private_post_orders = v4PrivatePostOrders = Entry('orders', ['v4', 'private'], 'POST', {})
|
82
|
+
v4_private_post_oco_orders = v4PrivatePostOcoOrders = Entry('oco-orders', ['v4', 'private'], 'POST', {})
|
83
|
+
v4_private_post_order_collateral_oco = v4PrivatePostOrderCollateralOco = Entry('order/collateral/oco', ['v4', 'private'], 'POST', {})
|
84
|
+
v4_private_post_order_oco_cancel = v4PrivatePostOrderOcoCancel = Entry('order/oco-cancel', ['v4', 'private'], 'POST', {})
|
85
|
+
v4_private_post_order_oto_cancel = v4PrivatePostOrderOtoCancel = Entry('order/oto-cancel', ['v4', 'private'], 'POST', {})
|
68
86
|
v4_private_post_profile_websocket_token = v4PrivatePostProfileWebsocketToken = Entry('profile/websocket_token', ['v4', 'private'], 'POST', {})
|
87
|
+
v4_private_post_convert_estimate = v4PrivatePostConvertEstimate = Entry('convert/estimate', ['v4', 'private'], 'POST', {})
|
88
|
+
v4_private_post_convert_confirm = v4PrivatePostConvertConfirm = Entry('convert/confirm', ['v4', 'private'], 'POST', {})
|
89
|
+
v4_private_post_convert_history = v4PrivatePostConvertHistory = Entry('convert/history', ['v4', 'private'], 'POST', {})
|
ccxt/abstract/woo.py
CHANGED
@@ -43,6 +43,7 @@ class ImplicitAPI:
|
|
43
43
|
v1_private_get_position_symbol = v1PrivateGetPositionSymbol = Entry('position/{symbol}', ['v1', 'private'], 'GET', {'cost': 3.33})
|
44
44
|
v1_private_get_client_transaction_history = v1PrivateGetClientTransactionHistory = Entry('client/transaction_history', ['v1', 'private'], 'GET', {'cost': 60})
|
45
45
|
v1_private_post_order = v1PrivatePostOrder = Entry('order', ['v1', 'private'], 'POST', {'cost': 5})
|
46
|
+
v1_private_post_order_cancel_all_after = v1PrivatePostOrderCancelAllAfter = Entry('order/cancel_all_after', ['v1', 'private'], 'POST', {'cost': 1})
|
46
47
|
v1_private_post_asset_main_sub_transfer = v1PrivatePostAssetMainSubTransfer = Entry('asset/main_sub_transfer', ['v1', 'private'], 'POST', {'cost': 30})
|
47
48
|
v1_private_post_asset_ltv = v1PrivatePostAssetLtv = Entry('asset/ltv', ['v1', 'private'], 'POST', {'cost': 30})
|
48
49
|
v1_private_post_asset_withdraw = v1PrivatePostAssetWithdraw = Entry('asset/withdraw', ['v1', 'private'], 'POST', {'cost': 30})
|
ccxt/async_support/__init__.py
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# -----------------------------------------------------------------------------
|
4
4
|
|
5
|
-
__version__ = '4.3.
|
5
|
+
__version__ = '4.3.6'
|
6
6
|
|
7
7
|
# -----------------------------------------------------------------------------
|
8
8
|
|
@@ -849,6 +849,9 @@ class Exchange(BaseExchange):
|
|
849
849
|
async def fetch_position(self, symbol: str, params={}):
|
850
850
|
raise NotSupported(self.id + ' fetchPosition() is not supported yet')
|
851
851
|
|
852
|
+
async def fetch_position_ws(self, symbol: str, params={}):
|
853
|
+
raise NotSupported(self.id + ' fetchPositionWs() is not supported yet')
|
854
|
+
|
852
855
|
async def watch_position(self, symbol: Str = None, params={}):
|
853
856
|
raise NotSupported(self.id + ' watchPosition() is not supported yet')
|
854
857
|
|
@@ -867,9 +870,21 @@ class Exchange(BaseExchange):
|
|
867
870
|
"""
|
868
871
|
raise NotSupported(self.id + ' fetchPositionsForSymbol() is not supported yet')
|
869
872
|
|
873
|
+
async def fetch_positions_for_symbol_ws(self, symbol: str, params={}):
|
874
|
+
"""
|
875
|
+
fetches all open positions for specific symbol, unlike fetchPositions(which is designed to work with multiple symbols) so self method might be preffered for one-market position, because of less rate-limit consumption and speed
|
876
|
+
:param str symbol: unified market symbol
|
877
|
+
:param dict params: extra parameters specific to the endpoint
|
878
|
+
:returns dict[]: a list of `position structure <https://docs.ccxt.com/#/?id=position-structure>` with maximum 3 items - possible one position for "one-way" mode, and possible two positions(long & short) for "two-way"(a.k.a. hedge) mode
|
879
|
+
"""
|
880
|
+
raise NotSupported(self.id + ' fetchPositionsForSymbol() is not supported yet')
|
881
|
+
|
870
882
|
async def fetch_positions(self, symbols: List[str] = None, params={}):
|
871
883
|
raise NotSupported(self.id + ' fetchPositions() is not supported yet')
|
872
884
|
|
885
|
+
async def fetch_positions_ws(self, symbols: List[str] = None, params={}):
|
886
|
+
raise NotSupported(self.id + ' fetchPositions() is not supported yet')
|
887
|
+
|
873
888
|
async def fetch_positions_risk(self, symbols: List[str] = None, params={}):
|
874
889
|
raise NotSupported(self.id + ' fetchPositionsRisk() is not supported yet')
|
875
890
|
|
@@ -961,12 +976,29 @@ class Exchange(BaseExchange):
|
|
961
976
|
else:
|
962
977
|
raise NotSupported(self.id + ' fetchTicker() is not supported yet')
|
963
978
|
|
979
|
+
async def fetch_ticker_ws(self, symbol: str, params={}):
|
980
|
+
if self.has['fetchTickersWs']:
|
981
|
+
await self.load_markets()
|
982
|
+
market = self.market(symbol)
|
983
|
+
symbol = market['symbol']
|
984
|
+
tickers = await self.fetchTickerWs(symbol, params)
|
985
|
+
ticker = self.safe_dict(tickers, symbol)
|
986
|
+
if ticker is None:
|
987
|
+
raise NullResponse(self.id + ' fetchTickers() could not find a ticker for ' + symbol)
|
988
|
+
else:
|
989
|
+
return ticker
|
990
|
+
else:
|
991
|
+
raise NotSupported(self.id + ' fetchTicker() is not supported yet')
|
992
|
+
|
964
993
|
async def watch_ticker(self, symbol: str, params={}):
|
965
994
|
raise NotSupported(self.id + ' watchTicker() is not supported yet')
|
966
995
|
|
967
996
|
async def fetch_tickers(self, symbols: List[str] = None, params={}):
|
968
997
|
raise NotSupported(self.id + ' fetchTickers() is not supported yet')
|
969
998
|
|
999
|
+
async def fetch_tickers_ws(self, symbols: List[str] = None, params={}):
|
1000
|
+
raise NotSupported(self.id + ' fetchTickers() is not supported yet')
|
1001
|
+
|
970
1002
|
async def fetch_order_books(self, symbols: List[str] = None, limit: Int = None, params={}):
|
971
1003
|
raise NotSupported(self.id + ' fetchOrderBooks() is not supported yet')
|
972
1004
|
|
@@ -1016,6 +1048,28 @@ class Exchange(BaseExchange):
|
|
1016
1048
|
return await self.create_order(symbol, type, side, amount, price, params)
|
1017
1049
|
raise NotSupported(self.id + ' createTrailingAmountOrder() is not supported yet')
|
1018
1050
|
|
1051
|
+
async def create_trailing_amount_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, trailingAmount=None, trailingTriggerPrice=None, params={}):
|
1052
|
+
"""
|
1053
|
+
create a trailing order by providing the symbol, type, side, amount, price and trailingAmount
|
1054
|
+
:param str symbol: unified symbol of the market to create an order in
|
1055
|
+
:param str type: 'market' or 'limit'
|
1056
|
+
:param str side: 'buy' or 'sell'
|
1057
|
+
:param float amount: how much you want to trade in units of the base currency, or number of contracts
|
1058
|
+
:param float [price]: the price for the order to be filled at, in units of the quote currency, ignored in market orders
|
1059
|
+
:param float trailingAmount: the quote amount to trail away from the current market price
|
1060
|
+
:param float [trailingTriggerPrice]: the price to activate a trailing order, default uses the price argument
|
1061
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1062
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1063
|
+
"""
|
1064
|
+
if trailingAmount is None:
|
1065
|
+
raise ArgumentsRequired(self.id + ' createTrailingAmountOrderWs() requires a trailingAmount argument')
|
1066
|
+
params['trailingAmount'] = trailingAmount
|
1067
|
+
if trailingTriggerPrice is not None:
|
1068
|
+
params['trailingTriggerPrice'] = trailingTriggerPrice
|
1069
|
+
if self.has['createTrailingAmountOrderWs']:
|
1070
|
+
return await self.createOrderWs(symbol, type, side, amount, price, params)
|
1071
|
+
raise NotSupported(self.id + ' createTrailingAmountOrderWs() is not supported yet')
|
1072
|
+
|
1019
1073
|
async def create_trailing_percent_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, trailingPercent=None, trailingTriggerPrice=None, params={}):
|
1020
1074
|
"""
|
1021
1075
|
create a trailing order by providing the symbol, type, side, amount, price and trailingPercent
|
@@ -1038,6 +1092,28 @@ class Exchange(BaseExchange):
|
|
1038
1092
|
return await self.create_order(symbol, type, side, amount, price, params)
|
1039
1093
|
raise NotSupported(self.id + ' createTrailingPercentOrder() is not supported yet')
|
1040
1094
|
|
1095
|
+
async def create_trailing_percent_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, trailingPercent=None, trailingTriggerPrice=None, params={}):
|
1096
|
+
"""
|
1097
|
+
create a trailing order by providing the symbol, type, side, amount, price and trailingPercent
|
1098
|
+
:param str symbol: unified symbol of the market to create an order in
|
1099
|
+
:param str type: 'market' or 'limit'
|
1100
|
+
:param str side: 'buy' or 'sell'
|
1101
|
+
:param float amount: how much you want to trade in units of the base currency, or number of contracts
|
1102
|
+
:param float [price]: the price for the order to be filled at, in units of the quote currency, ignored in market orders
|
1103
|
+
:param float trailingPercent: the percent to trail away from the current market price
|
1104
|
+
:param float [trailingTriggerPrice]: the price to activate a trailing order, default uses the price argument
|
1105
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1106
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1107
|
+
"""
|
1108
|
+
if trailingPercent is None:
|
1109
|
+
raise ArgumentsRequired(self.id + ' createTrailingPercentOrderWs() requires a trailingPercent argument')
|
1110
|
+
params['trailingPercent'] = trailingPercent
|
1111
|
+
if trailingTriggerPrice is not None:
|
1112
|
+
params['trailingTriggerPrice'] = trailingTriggerPrice
|
1113
|
+
if self.has['createTrailingPercentOrderWs']:
|
1114
|
+
return await self.createOrderWs(symbol, type, side, amount, price, params)
|
1115
|
+
raise NotSupported(self.id + ' createTrailingPercentOrderWs() is not supported yet')
|
1116
|
+
|
1041
1117
|
async def create_market_order_with_cost(self, symbol: str, side: OrderSide, cost: float, params={}):
|
1042
1118
|
"""
|
1043
1119
|
create a market order by providing the symbol, side and cost
|
@@ -1075,6 +1151,19 @@ class Exchange(BaseExchange):
|
|
1075
1151
|
return await self.create_order(symbol, 'market', 'sell', cost, 1, params)
|
1076
1152
|
raise NotSupported(self.id + ' createMarketSellOrderWithCost() is not supported yet')
|
1077
1153
|
|
1154
|
+
async def create_market_order_with_cost_ws(self, symbol: str, side: OrderSide, cost: float, params={}):
|
1155
|
+
"""
|
1156
|
+
create a market order by providing the symbol, side and cost
|
1157
|
+
:param str symbol: unified symbol of the market to create an order in
|
1158
|
+
:param str side: 'buy' or 'sell'
|
1159
|
+
:param float cost: how much you want to trade in units of the quote currency
|
1160
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1161
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1162
|
+
"""
|
1163
|
+
if self.has['createMarketOrderWithCostWs'] or (self.has['createMarketBuyOrderWithCostWs'] and self.has['createMarketSellOrderWithCostWs']):
|
1164
|
+
return await self.createOrderWs(symbol, 'market', side, cost, 1, params)
|
1165
|
+
raise NotSupported(self.id + ' createMarketOrderWithCostWs() is not supported yet')
|
1166
|
+
|
1078
1167
|
async def create_trigger_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, triggerPrice: Num = None, params={}):
|
1079
1168
|
"""
|
1080
1169
|
create a trigger stop order(type 1)
|
@@ -1094,6 +1183,25 @@ class Exchange(BaseExchange):
|
|
1094
1183
|
return await self.create_order(symbol, type, side, amount, price, params)
|
1095
1184
|
raise NotSupported(self.id + ' createTriggerOrder() is not supported yet')
|
1096
1185
|
|
1186
|
+
async def create_trigger_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, triggerPrice: Num = None, params={}):
|
1187
|
+
"""
|
1188
|
+
create a trigger stop order(type 1)
|
1189
|
+
:param str symbol: unified symbol of the market to create an order in
|
1190
|
+
:param str type: 'market' or 'limit'
|
1191
|
+
:param str side: 'buy' or 'sell'
|
1192
|
+
:param float amount: how much you want to trade in units of the base currency or the number of contracts
|
1193
|
+
:param float [price]: the price to fulfill the order, in units of the quote currency, ignored in market orders
|
1194
|
+
:param float triggerPrice: the price to trigger the stop order, in units of the quote currency
|
1195
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1196
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1197
|
+
"""
|
1198
|
+
if triggerPrice is None:
|
1199
|
+
raise ArgumentsRequired(self.id + ' createTriggerOrderWs() requires a triggerPrice argument')
|
1200
|
+
params['triggerPrice'] = triggerPrice
|
1201
|
+
if self.has['createTriggerOrderWs']:
|
1202
|
+
return await self.createOrderWs(symbol, type, side, amount, price, params)
|
1203
|
+
raise NotSupported(self.id + ' createTriggerOrderWs() is not supported yet')
|
1204
|
+
|
1097
1205
|
async def create_stop_loss_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, stopLossPrice: Num = None, params={}):
|
1098
1206
|
"""
|
1099
1207
|
create a trigger stop loss order(type 2)
|
@@ -1113,6 +1221,25 @@ class Exchange(BaseExchange):
|
|
1113
1221
|
return await self.create_order(symbol, type, side, amount, price, params)
|
1114
1222
|
raise NotSupported(self.id + ' createStopLossOrder() is not supported yet')
|
1115
1223
|
|
1224
|
+
async def create_stop_loss_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, stopLossPrice: Num = None, params={}):
|
1225
|
+
"""
|
1226
|
+
create a trigger stop loss order(type 2)
|
1227
|
+
:param str symbol: unified symbol of the market to create an order in
|
1228
|
+
:param str type: 'market' or 'limit'
|
1229
|
+
:param str side: 'buy' or 'sell'
|
1230
|
+
:param float amount: how much you want to trade in units of the base currency or the number of contracts
|
1231
|
+
:param float [price]: the price to fulfill the order, in units of the quote currency, ignored in market orders
|
1232
|
+
:param float stopLossPrice: the price to trigger the stop loss order, in units of the quote currency
|
1233
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1234
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1235
|
+
"""
|
1236
|
+
if stopLossPrice is None:
|
1237
|
+
raise ArgumentsRequired(self.id + ' createStopLossOrderWs() requires a stopLossPrice argument')
|
1238
|
+
params['stopLossPrice'] = stopLossPrice
|
1239
|
+
if self.has['createStopLossOrderWs']:
|
1240
|
+
return await self.createOrderWs(symbol, type, side, amount, price, params)
|
1241
|
+
raise NotSupported(self.id + ' createStopLossOrderWs() is not supported yet')
|
1242
|
+
|
1116
1243
|
async def create_take_profit_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, takeProfitPrice: Num = None, params={}):
|
1117
1244
|
"""
|
1118
1245
|
create a trigger take profit order(type 2)
|
@@ -1132,6 +1259,25 @@ class Exchange(BaseExchange):
|
|
1132
1259
|
return await self.create_order(symbol, type, side, amount, price, params)
|
1133
1260
|
raise NotSupported(self.id + ' createTakeProfitOrder() is not supported yet')
|
1134
1261
|
|
1262
|
+
async def create_take_profit_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, takeProfitPrice: Num = None, params={}):
|
1263
|
+
"""
|
1264
|
+
create a trigger take profit order(type 2)
|
1265
|
+
:param str symbol: unified symbol of the market to create an order in
|
1266
|
+
:param str type: 'market' or 'limit'
|
1267
|
+
:param str side: 'buy' or 'sell'
|
1268
|
+
:param float amount: how much you want to trade in units of the base currency or the number of contracts
|
1269
|
+
:param float [price]: the price to fulfill the order, in units of the quote currency, ignored in market orders
|
1270
|
+
:param float takeProfitPrice: the price to trigger the take profit order, in units of the quote currency
|
1271
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1272
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1273
|
+
"""
|
1274
|
+
if takeProfitPrice is None:
|
1275
|
+
raise ArgumentsRequired(self.id + ' createTakeProfitOrderWs() requires a takeProfitPrice argument')
|
1276
|
+
params['takeProfitPrice'] = takeProfitPrice
|
1277
|
+
if self.has['createTakeProfitOrderWs']:
|
1278
|
+
return await self.createOrderWs(symbol, type, side, amount, price, params)
|
1279
|
+
raise NotSupported(self.id + ' createTakeProfitOrderWs() is not supported yet')
|
1280
|
+
|
1135
1281
|
async def create_order_with_take_profit_and_stop_loss(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, takeProfit: Num = None, stopLoss: Num = None, params={}):
|
1136
1282
|
"""
|
1137
1283
|
create an order with a stop loss or take profit attached(type 3)
|
@@ -1153,45 +1299,37 @@ class Exchange(BaseExchange):
|
|
1153
1299
|
:param float [params.stopLossAmount]: *not available on all exchanges* the amount for a stop loss
|
1154
1300
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1155
1301
|
"""
|
1156
|
-
|
1157
|
-
raise ArgumentsRequired(self.id + ' createOrderWithTakeProfitAndStopLoss() requires either a takeProfit or stopLoss argument')
|
1158
|
-
if takeProfit is not None:
|
1159
|
-
params['takeProfit'] = {
|
1160
|
-
'triggerPrice': takeProfit,
|
1161
|
-
}
|
1162
|
-
if stopLoss is not None:
|
1163
|
-
params['stopLoss'] = {
|
1164
|
-
'triggerPrice': stopLoss,
|
1165
|
-
}
|
1166
|
-
takeProfitType = self.safe_string(params, 'takeProfitType')
|
1167
|
-
takeProfitPriceType = self.safe_string(params, 'takeProfitPriceType')
|
1168
|
-
takeProfitLimitPrice = self.safe_string(params, 'takeProfitLimitPrice')
|
1169
|
-
takeProfitAmount = self.safe_string(params, 'takeProfitAmount')
|
1170
|
-
stopLossType = self.safe_string(params, 'stopLossType')
|
1171
|
-
stopLossPriceType = self.safe_string(params, 'stopLossPriceType')
|
1172
|
-
stopLossLimitPrice = self.safe_string(params, 'stopLossLimitPrice')
|
1173
|
-
stopLossAmount = self.safe_string(params, 'stopLossAmount')
|
1174
|
-
if takeProfitType is not None:
|
1175
|
-
params['takeProfit']['type'] = takeProfitType
|
1176
|
-
if takeProfitPriceType is not None:
|
1177
|
-
params['takeProfit']['priceType'] = takeProfitPriceType
|
1178
|
-
if takeProfitLimitPrice is not None:
|
1179
|
-
params['takeProfit']['price'] = self.parse_to_numeric(takeProfitLimitPrice)
|
1180
|
-
if takeProfitAmount is not None:
|
1181
|
-
params['takeProfit']['amount'] = self.parse_to_numeric(takeProfitAmount)
|
1182
|
-
if stopLossType is not None:
|
1183
|
-
params['stopLoss']['type'] = stopLossType
|
1184
|
-
if stopLossPriceType is not None:
|
1185
|
-
params['stopLoss']['priceType'] = stopLossPriceType
|
1186
|
-
if stopLossLimitPrice is not None:
|
1187
|
-
params['stopLoss']['price'] = self.parse_to_numeric(stopLossLimitPrice)
|
1188
|
-
if stopLossAmount is not None:
|
1189
|
-
params['stopLoss']['amount'] = self.parse_to_numeric(stopLossAmount)
|
1190
|
-
params = self.omit(params, ['takeProfitType', 'takeProfitPriceType', 'takeProfitLimitPrice', 'takeProfitAmount', 'stopLossType', 'stopLossPriceType', 'stopLossLimitPrice', 'stopLossAmount'])
|
1302
|
+
params = self.set_take_profit_and_stop_loss_params(symbol, type, side, amount, price, takeProfit, stopLoss, params)
|
1191
1303
|
if self.has['createOrderWithTakeProfitAndStopLoss']:
|
1192
1304
|
return await self.create_order(symbol, type, side, amount, price, params)
|
1193
1305
|
raise NotSupported(self.id + ' createOrderWithTakeProfitAndStopLoss() is not supported yet')
|
1194
1306
|
|
1307
|
+
async def create_order_with_take_profit_and_stop_loss_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, takeProfit: Num = None, stopLoss: Num = None, params={}):
|
1308
|
+
"""
|
1309
|
+
create an order with a stop loss or take profit attached(type 3)
|
1310
|
+
:param str symbol: unified symbol of the market to create an order in
|
1311
|
+
:param str type: 'market' or 'limit'
|
1312
|
+
:param str side: 'buy' or 'sell'
|
1313
|
+
:param float amount: how much you want to trade in units of the base currency or the number of contracts
|
1314
|
+
:param float [price]: the price to fulfill the order, in units of the quote currency, ignored in market orders
|
1315
|
+
:param float [takeProfit]: the take profit price, in units of the quote currency
|
1316
|
+
:param float [stopLoss]: the stop loss price, in units of the quote currency
|
1317
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1318
|
+
:param str [params.takeProfitType]: *not available on all exchanges* 'limit' or 'market'
|
1319
|
+
:param str [params.stopLossType]: *not available on all exchanges* 'limit' or 'market'
|
1320
|
+
:param str [params.takeProfitPriceType]: *not available on all exchanges* 'last', 'mark' or 'index'
|
1321
|
+
:param str [params.stopLossPriceType]: *not available on all exchanges* 'last', 'mark' or 'index'
|
1322
|
+
:param float [params.takeProfitLimitPrice]: *not available on all exchanges* limit price for a limit take profit order
|
1323
|
+
:param float [params.stopLossLimitPrice]: *not available on all exchanges* stop loss for a limit stop loss order
|
1324
|
+
:param float [params.takeProfitAmount]: *not available on all exchanges* the amount for a take profit
|
1325
|
+
:param float [params.stopLossAmount]: *not available on all exchanges* the amount for a stop loss
|
1326
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1327
|
+
"""
|
1328
|
+
params = self.set_take_profit_and_stop_loss_params(symbol, type, side, amount, price, takeProfit, stopLoss, params)
|
1329
|
+
if self.has['createOrderWithTakeProfitAndStopLossWs']:
|
1330
|
+
return await self.createOrderWs(symbol, type, side, amount, price, params)
|
1331
|
+
raise NotSupported(self.id + ' createOrderWithTakeProfitAndStopLossWs() is not supported yet')
|
1332
|
+
|
1195
1333
|
async def create_orders(self, orders: List[OrderRequest], params={}):
|
1196
1334
|
raise NotSupported(self.id + ' createOrders() is not supported yet')
|
1197
1335
|
|
@@ -1210,6 +1348,9 @@ class Exchange(BaseExchange):
|
|
1210
1348
|
async def cancel_all_orders(self, symbol: Str = None, params={}):
|
1211
1349
|
raise NotSupported(self.id + ' cancelAllOrders() is not supported yet')
|
1212
1350
|
|
1351
|
+
async def cancel_all_orders_after(self, timeout: Int, params={}):
|
1352
|
+
raise NotSupported(self.id + ' cancelAllOrdersAfter() is not supported yet')
|
1353
|
+
|
1213
1354
|
async def cancel_orders_for_symbols(self, orders: List[CancellationRequest], params={}):
|
1214
1355
|
raise NotSupported(self.id + ' cancelOrdersForSymbols() is not supported yet')
|
1215
1356
|
|
@@ -1349,21 +1490,39 @@ class Exchange(BaseExchange):
|
|
1349
1490
|
async def create_limit_order(self, symbol: str, side: OrderSide, amount: float, price: float, params={}):
|
1350
1491
|
return await self.create_order(symbol, 'limit', side, amount, price, params)
|
1351
1492
|
|
1493
|
+
async def create_limit_order_ws(self, symbol: str, side: OrderSide, amount: float, price: float, params={}):
|
1494
|
+
return await self.createOrderWs(symbol, 'limit', side, amount, price, params)
|
1495
|
+
|
1352
1496
|
async def create_market_order(self, symbol: str, side: OrderSide, amount: float, price: Num = None, params={}):
|
1353
1497
|
return await self.create_order(symbol, 'market', side, amount, price, params)
|
1354
1498
|
|
1499
|
+
async def create_market_order_ws(self, symbol: str, side: OrderSide, amount: float, price: Num = None, params={}):
|
1500
|
+
return await self.createOrderWs(symbol, 'market', side, amount, price, params)
|
1501
|
+
|
1355
1502
|
async def create_limit_buy_order(self, symbol: str, amount: float, price: float, params={}):
|
1356
1503
|
return await self.create_order(symbol, 'limit', 'buy', amount, price, params)
|
1357
1504
|
|
1505
|
+
async def create_limit_buy_order_ws(self, symbol: str, amount: float, price: float, params={}):
|
1506
|
+
return await self.createOrderWs(symbol, 'limit', 'buy', amount, price, params)
|
1507
|
+
|
1358
1508
|
async def create_limit_sell_order(self, symbol: str, amount: float, price: float, params={}):
|
1359
1509
|
return await self.create_order(symbol, 'limit', 'sell', amount, price, params)
|
1360
1510
|
|
1511
|
+
async def create_limit_sell_order_ws(self, symbol: str, amount: float, price: float, params={}):
|
1512
|
+
return await self.createOrderWs(symbol, 'limit', 'sell', amount, price, params)
|
1513
|
+
|
1361
1514
|
async def create_market_buy_order(self, symbol: str, amount: float, params={}):
|
1362
1515
|
return await self.create_order(symbol, 'market', 'buy', amount, None, params)
|
1363
1516
|
|
1517
|
+
async def create_market_buy_order_ws(self, symbol: str, amount: float, params={}):
|
1518
|
+
return await self.createOrderWs(symbol, 'market', 'buy', amount, None, params)
|
1519
|
+
|
1364
1520
|
async def create_market_sell_order(self, symbol: str, amount: float, params={}):
|
1365
1521
|
return await self.create_order(symbol, 'market', 'sell', amount, None, params)
|
1366
1522
|
|
1523
|
+
async def create_market_sell_order_ws(self, symbol: str, amount: float, params={}):
|
1524
|
+
return await self.createOrderWs(symbol, 'market', 'sell', amount, None, params)
|
1525
|
+
|
1367
1526
|
async def load_time_difference(self, params={}):
|
1368
1527
|
serverTime = await self.fetch_time(params)
|
1369
1528
|
after = self.milliseconds()
|
@@ -1386,12 +1545,24 @@ class Exchange(BaseExchange):
|
|
1386
1545
|
query = self.extend(params, {'postOnly': True})
|
1387
1546
|
return await self.create_order(symbol, type, side, amount, price, query)
|
1388
1547
|
|
1548
|
+
async def create_post_only_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
1549
|
+
if not self.has['createPostOnlyOrderWs']:
|
1550
|
+
raise NotSupported(self.id + 'createPostOnlyOrderWs() is not supported yet')
|
1551
|
+
query = self.extend(params, {'postOnly': True})
|
1552
|
+
return await self.createOrderWs(symbol, type, side, amount, price, query)
|
1553
|
+
|
1389
1554
|
async def create_reduce_only_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
1390
1555
|
if not self.has['createReduceOnlyOrder']:
|
1391
1556
|
raise NotSupported(self.id + 'createReduceOnlyOrder() is not supported yet')
|
1392
1557
|
query = self.extend(params, {'reduceOnly': True})
|
1393
1558
|
return await self.create_order(symbol, type, side, amount, price, query)
|
1394
1559
|
|
1560
|
+
async def create_reduce_only_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
1561
|
+
if not self.has['createReduceOnlyOrderWs']:
|
1562
|
+
raise NotSupported(self.id + 'createReduceOnlyOrderWs() is not supported yet')
|
1563
|
+
query = self.extend(params, {'reduceOnly': True})
|
1564
|
+
return await self.createOrderWs(symbol, type, side, amount, price, query)
|
1565
|
+
|
1395
1566
|
async def create_stop_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, stopPrice: Num = None, params={}):
|
1396
1567
|
if not self.has['createStopOrder']:
|
1397
1568
|
raise NotSupported(self.id + ' createStopOrder() is not supported yet')
|
@@ -1400,18 +1571,38 @@ class Exchange(BaseExchange):
|
|
1400
1571
|
query = self.extend(params, {'stopPrice': stopPrice})
|
1401
1572
|
return await self.create_order(symbol, type, side, amount, price, query)
|
1402
1573
|
|
1574
|
+
async def create_stop_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, stopPrice: Num = None, params={}):
|
1575
|
+
if not self.has['createStopOrderWs']:
|
1576
|
+
raise NotSupported(self.id + ' createStopOrderWs() is not supported yet')
|
1577
|
+
if stopPrice is None:
|
1578
|
+
raise ArgumentsRequired(self.id + ' createStopOrderWs() requires a stopPrice argument')
|
1579
|
+
query = self.extend(params, {'stopPrice': stopPrice})
|
1580
|
+
return await self.createOrderWs(symbol, type, side, amount, price, query)
|
1581
|
+
|
1403
1582
|
async def create_stop_limit_order(self, symbol: str, side: OrderSide, amount: float, price: float, stopPrice: float, params={}):
|
1404
1583
|
if not self.has['createStopLimitOrder']:
|
1405
1584
|
raise NotSupported(self.id + ' createStopLimitOrder() is not supported yet')
|
1406
1585
|
query = self.extend(params, {'stopPrice': stopPrice})
|
1407
1586
|
return await self.create_order(symbol, 'limit', side, amount, price, query)
|
1408
1587
|
|
1588
|
+
async def create_stop_limit_order_ws(self, symbol: str, side: OrderSide, amount: float, price: float, stopPrice: float, params={}):
|
1589
|
+
if not self.has['createStopLimitOrderWs']:
|
1590
|
+
raise NotSupported(self.id + ' createStopLimitOrderWs() is not supported yet')
|
1591
|
+
query = self.extend(params, {'stopPrice': stopPrice})
|
1592
|
+
return await self.createOrderWs(symbol, 'limit', side, amount, price, query)
|
1593
|
+
|
1409
1594
|
async def create_stop_market_order(self, symbol: str, side: OrderSide, amount: float, stopPrice: float, params={}):
|
1410
1595
|
if not self.has['createStopMarketOrder']:
|
1411
1596
|
raise NotSupported(self.id + ' createStopMarketOrder() is not supported yet')
|
1412
1597
|
query = self.extend(params, {'stopPrice': stopPrice})
|
1413
1598
|
return await self.create_order(symbol, 'market', side, amount, None, query)
|
1414
1599
|
|
1600
|
+
async def create_stop_market_order_ws(self, symbol: str, side: OrderSide, amount: float, stopPrice: float, params={}):
|
1601
|
+
if not self.has['createStopMarketOrderWs']:
|
1602
|
+
raise NotSupported(self.id + ' createStopMarketOrderWs() is not supported yet')
|
1603
|
+
query = self.extend(params, {'stopPrice': stopPrice})
|
1604
|
+
return await self.createOrderWs(symbol, 'market', side, amount, None, query)
|
1605
|
+
|
1415
1606
|
async def fetch_last_prices(self, symbols: List[str] = None, params={}):
|
1416
1607
|
raise NotSupported(self.id + ' fetchLastPrices() is not supported yet')
|
1417
1608
|
|
ccxt/async_support/binance.py
CHANGED
@@ -344,6 +344,7 @@ class binance(Exchange, ImplicitAPI):
|
|
344
344
|
'capital/deposit/subAddress': 0.1,
|
345
345
|
'capital/deposit/subHisrec': 0.1,
|
346
346
|
'capital/withdraw/history': 1800, # Weight(IP): 18000 => cost = 0.1 * 18000 = 1800
|
347
|
+
'capital/withdraw/address/list': 10,
|
347
348
|
'capital/contract/convertible-coins': 4.0002, # Weight(UID): 600 => cost = 0.006667 * 600 = 4.0002
|
348
349
|
'convert/tradeFlow': 20.001, # Weight(UID): 3000 => cost = 0.006667 * 3000 = 20.001
|
349
350
|
'convert/exchangeInfo': 50,
|
@@ -3988,6 +3989,7 @@ class binance(Exchange, ImplicitAPI):
|
|
3988
3989
|
:param str[] [symbols]: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
3989
3990
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3990
3991
|
:param str [params.subType]: "linear" or "inverse"
|
3992
|
+
:param str [params.type]: 'spot', 'option', use params["subType"] for swap and future markets
|
3991
3993
|
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
3992
3994
|
"""
|
3993
3995
|
await self.load_markets()
|
@@ -4742,6 +4744,24 @@ class binance(Exchange, ImplicitAPI):
|
|
4742
4744
|
params = self.omit(params, ['quoteOrderQty', 'cost', 'stopPrice', 'newClientOrderId', 'clientOrderId', 'postOnly'])
|
4743
4745
|
return self.extend(request, params)
|
4744
4746
|
|
4747
|
+
def edit_contract_order_request(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
4748
|
+
market = self.market(symbol)
|
4749
|
+
if not market['contract']:
|
4750
|
+
raise NotSupported(self.id + ' editContractOrder() does not support ' + market['type'] + ' orders')
|
4751
|
+
request = {
|
4752
|
+
'symbol': market['id'],
|
4753
|
+
'side': side.upper(),
|
4754
|
+
}
|
4755
|
+
clientOrderId = self.safe_string_n(params, ['newClientOrderId', 'clientOrderId', 'origClientOrderId'])
|
4756
|
+
request['orderId'] = id
|
4757
|
+
request['quantity'] = self.amount_to_precision(symbol, amount)
|
4758
|
+
if price is not None:
|
4759
|
+
request['price'] = self.price_to_precision(symbol, price)
|
4760
|
+
if clientOrderId is not None:
|
4761
|
+
request['origClientOrderId'] = clientOrderId
|
4762
|
+
params = self.omit(params, ['clientOrderId', 'newClientOrderId'])
|
4763
|
+
return request
|
4764
|
+
|
4745
4765
|
async def edit_contract_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
4746
4766
|
"""
|
4747
4767
|
edit a trade order
|
@@ -4758,20 +4778,7 @@ class binance(Exchange, ImplicitAPI):
|
|
4758
4778
|
"""
|
4759
4779
|
await self.load_markets()
|
4760
4780
|
market = self.market(symbol)
|
4761
|
-
|
4762
|
-
raise NotSupported(self.id + ' editContractOrder() does not support ' + market['type'] + ' orders')
|
4763
|
-
request = {
|
4764
|
-
'symbol': market['id'],
|
4765
|
-
'side': side.upper(),
|
4766
|
-
}
|
4767
|
-
clientOrderId = self.safe_string_n(params, ['newClientOrderId', 'clientOrderId', 'origClientOrderId'])
|
4768
|
-
request['orderId'] = id
|
4769
|
-
request['quantity'] = self.amount_to_precision(symbol, amount)
|
4770
|
-
if price is not None:
|
4771
|
-
request['price'] = self.price_to_precision(symbol, price)
|
4772
|
-
if clientOrderId is not None:
|
4773
|
-
request['origClientOrderId'] = clientOrderId
|
4774
|
-
params = self.omit(params, ['clientOrderId', 'newClientOrderId'])
|
4781
|
+
request = self.edit_contract_order_request(id, symbol, type, side, amount, price, params)
|
4775
4782
|
response = None
|
4776
4783
|
if market['linear']:
|
4777
4784
|
response = await self.fapiPrivatePutOrder(self.extend(request, params))
|