ccxt 4.3.11__py2.py3-none-any.whl → 4.3.13__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/bybit.py +1 -0
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/bigone.py +22 -22
- ccxt/async_support/binance.py +7 -7
- ccxt/async_support/bingx.py +2 -2
- ccxt/async_support/bitget.py +10 -8
- ccxt/async_support/bitmart.py +7 -11
- ccxt/async_support/bitmex.py +2 -2
- ccxt/async_support/bybit.py +76 -65
- ccxt/async_support/coinbase.py +8 -8
- ccxt/async_support/coinbaseinternational.py +2 -2
- ccxt/async_support/coinex.py +501 -445
- ccxt/async_support/coinlist.py +12 -12
- ccxt/async_support/coinmetro.py +2 -2
- ccxt/async_support/cryptocom.py +16 -16
- ccxt/async_support/digifinex.py +3 -3
- ccxt/async_support/gate.py +2 -2
- ccxt/async_support/hitbtc.py +3 -3
- ccxt/async_support/htx.py +6 -9
- ccxt/async_support/indodax.py +2 -2
- ccxt/async_support/kraken.py +3 -1
- ccxt/async_support/kucoin.py +4 -4
- ccxt/async_support/kucoinfutures.py +6 -6
- ccxt/async_support/mexc.py +5 -5
- ccxt/async_support/okx.py +9 -9
- ccxt/async_support/poloniexfutures.py +4 -4
- ccxt/async_support/probit.py +2 -2
- ccxt/async_support/whitebit.py +72 -1
- ccxt/async_support/woo.py +2 -2
- ccxt/base/exchange.py +14 -2
- ccxt/base/types.py +25 -0
- ccxt/bigone.py +22 -22
- ccxt/binance.py +7 -7
- ccxt/bingx.py +2 -2
- ccxt/bitget.py +10 -8
- ccxt/bitmart.py +7 -11
- ccxt/bitmex.py +2 -2
- ccxt/bybit.py +76 -65
- ccxt/coinbase.py +8 -8
- ccxt/coinbaseinternational.py +2 -2
- ccxt/coinex.py +501 -445
- ccxt/coinlist.py +12 -12
- ccxt/coinmetro.py +2 -2
- ccxt/cryptocom.py +16 -16
- ccxt/digifinex.py +3 -3
- ccxt/gate.py +2 -2
- ccxt/hitbtc.py +3 -3
- ccxt/htx.py +6 -9
- ccxt/indodax.py +2 -2
- ccxt/kraken.py +3 -1
- ccxt/kucoin.py +4 -4
- ccxt/kucoinfutures.py +6 -6
- ccxt/mexc.py +5 -5
- ccxt/okx.py +9 -9
- ccxt/poloniexfutures.py +4 -4
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/bitget.py +139 -87
- ccxt/pro/bybit.py +192 -12
- ccxt/pro/coinbase.py +90 -20
- ccxt/pro/mexc.py +21 -1
- ccxt/probit.py +2 -2
- ccxt/test/base/test_datetime.py +6 -0
- ccxt/test/base/test_ledger_entry.py +2 -2
- ccxt/whitebit.py +72 -1
- ccxt/woo.py +2 -2
- {ccxt-4.3.11.dist-info → ccxt-4.3.13.dist-info}/METADATA +4 -4
- {ccxt-4.3.11.dist-info → ccxt-4.3.13.dist-info}/RECORD +71 -73
- ccxt/async_support/flowbtc.py +0 -34
- ccxt/flowbtc.py +0 -34
- {ccxt-4.3.11.dist-info → ccxt-4.3.13.dist-info}/WHEEL +0 -0
- {ccxt-4.3.11.dist-info → ccxt-4.3.13.dist-info}/top_level.txt +0 -0
ccxt/coinex.py
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.coinex import ImplicitAPI
|
8
|
-
from ccxt.base.types import Balances, Currencies, Currency, Int, Leverage, Leverages, MarginModification, Market, Num, Order, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
|
8
|
+
from ccxt.base.types import Balances, Currencies, Currency, Int, IsolatedBorrowRate, IsolatedBorrowRates, Leverage, Leverages, MarginModification, Market, Num, Order, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
|
9
9
|
from typing import List
|
10
10
|
from ccxt.base.errors import ExchangeError
|
11
11
|
from ccxt.base.errors import AuthenticationError
|
@@ -1663,121 +1663,6 @@ class coinex(Exchange, ImplicitAPI):
|
|
1663
1663
|
return self.safe_string(statuses, status, status)
|
1664
1664
|
|
1665
1665
|
def parse_order(self, order, market: Market = None) -> Order:
|
1666
|
-
#
|
1667
|
-
# fetchOrder
|
1668
|
-
#
|
1669
|
-
# {
|
1670
|
-
# "amount": "0.1",
|
1671
|
-
# "asset_fee": "0.22736197736197736197",
|
1672
|
-
# "avg_price": "196.85000000000000000000",
|
1673
|
-
# "create_time": 1537270135,
|
1674
|
-
# "deal_amount": "0.1",
|
1675
|
-
# "deal_fee": "0",
|
1676
|
-
# "deal_money": "19.685",
|
1677
|
-
# "fee_asset": "CET",
|
1678
|
-
# "fee_discount": "0.5",
|
1679
|
-
# "id": 1788259447,
|
1680
|
-
# "left": "0",
|
1681
|
-
# "maker_fee_rate": "0",
|
1682
|
-
# "market": "ETHUSDT",
|
1683
|
-
# "order_type": "limit",
|
1684
|
-
# "price": "170.00000000",
|
1685
|
-
# "status": "done",
|
1686
|
-
# "taker_fee_rate": "0.0005",
|
1687
|
-
# "type": "sell",
|
1688
|
-
# "client_id": "",
|
1689
|
-
# }
|
1690
|
-
#
|
1691
|
-
# Spot and Margin cancelOrder, fetchOrder
|
1692
|
-
#
|
1693
|
-
# {
|
1694
|
-
# "amount":"1.5",
|
1695
|
-
# "asset_fee":"0",
|
1696
|
-
# "avg_price":"0.14208538",
|
1697
|
-
# "client_id":"",
|
1698
|
-
# "create_time":1650993819,
|
1699
|
-
# "deal_amount":"10.55703267",
|
1700
|
-
# "deal_fee":"0.0029999999971787292",
|
1701
|
-
# "deal_money":"1.4999999985893646",
|
1702
|
-
# "fee_asset":null,
|
1703
|
-
# "fee_discount":"1",
|
1704
|
-
# "finished_time":null,
|
1705
|
-
# "id":74556296907,
|
1706
|
-
# "left":"0.0000000014106354",
|
1707
|
-
# "maker_fee_rate":"0",
|
1708
|
-
# "market":"DOGEUSDT",
|
1709
|
-
# "money_fee":"0.0029999999971787292",
|
1710
|
-
# "order_type":"market",
|
1711
|
-
# "price":"0",
|
1712
|
-
# "status":"done",
|
1713
|
-
# "stock_fee":"0",
|
1714
|
-
# "taker_fee_rate":"0.002",
|
1715
|
-
# "type":"buy"
|
1716
|
-
# "client_id": "",
|
1717
|
-
# }
|
1718
|
-
#
|
1719
|
-
# Swap cancelOrder, fetchOrder
|
1720
|
-
#
|
1721
|
-
# {
|
1722
|
-
# "amount": "0.0005",
|
1723
|
-
# "client_id": "",
|
1724
|
-
# "create_time": 1651004578.618224,
|
1725
|
-
# "deal_asset_fee": "0.00000000000000000000",
|
1726
|
-
# "deal_fee": "0.00000000000000000000",
|
1727
|
-
# "deal_profit": "0.00000000000000000000",
|
1728
|
-
# "deal_stock": "0.00000000000000000000",
|
1729
|
-
# "effect_type": 1,
|
1730
|
-
# "fee_asset": "",
|
1731
|
-
# "fee_discount": "0.00000000000000000000",
|
1732
|
-
# "last_deal_amount": "0.00000000000000000000",
|
1733
|
-
# "last_deal_id": 0,
|
1734
|
-
# "last_deal_price": "0.00000000000000000000",
|
1735
|
-
# "last_deal_role": 0,
|
1736
|
-
# "last_deal_time": 0,
|
1737
|
-
# "last_deal_type": 0,
|
1738
|
-
# "left": "0.0005",
|
1739
|
-
# "leverage": "3",
|
1740
|
-
# "maker_fee": "0.00030",
|
1741
|
-
# "market": "BTCUSDT",
|
1742
|
-
# "order_id": 18221659097,
|
1743
|
-
# "position_id": 0,
|
1744
|
-
# "position_type": 1,
|
1745
|
-
# "price": "30000.00",
|
1746
|
-
# "side": 2,
|
1747
|
-
# "source": "api.v1",
|
1748
|
-
# "stop_id": 0,
|
1749
|
-
# "taker_fee": "0.00050",
|
1750
|
-
# "target": 0,
|
1751
|
-
# "type": 1,
|
1752
|
-
# "update_time": 1651004578.618224,
|
1753
|
-
# "user_id": 3620173
|
1754
|
-
# }
|
1755
|
-
#
|
1756
|
-
# Swap Stop cancelOrder, fetchOrder
|
1757
|
-
#
|
1758
|
-
# {
|
1759
|
-
# "amount": "0.0005",
|
1760
|
-
# "client_id": "",
|
1761
|
-
# "create_time": 1651034023.008771,
|
1762
|
-
# "effect_type": 1,
|
1763
|
-
# "fee_asset": "",
|
1764
|
-
# "fee_discount": "0.00000000000000000000",
|
1765
|
-
# "maker_fee": "0.00030",
|
1766
|
-
# "market": "BTCUSDT",
|
1767
|
-
# "order_id": 18256915101,
|
1768
|
-
# "price": "31000.00",
|
1769
|
-
# "side": 2,
|
1770
|
-
# "source": "api.v1",
|
1771
|
-
# "state": 1,
|
1772
|
-
# "stop_price": "31500.00",
|
1773
|
-
# "stop_type": 1,
|
1774
|
-
# "taker_fee": "0.00050",
|
1775
|
-
# "target": 0,
|
1776
|
-
# "type": 1,
|
1777
|
-
# "update_time": 1651034397.193624,
|
1778
|
-
# "user_id": 3620173
|
1779
|
-
# }
|
1780
|
-
#
|
1781
1666
|
#
|
1782
1667
|
# Spot and Margin fetchOpenOrders, fetchClosedOrders
|
1783
1668
|
#
|
@@ -1883,7 +1768,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
1883
1768
|
# "user_id": 3620173
|
1884
1769
|
# }
|
1885
1770
|
#
|
1886
|
-
# Spot and Margin createOrder, createOrders, cancelOrders v2
|
1771
|
+
# Spot and Margin createOrder, createOrders, editOrder, cancelOrders, cancelOrder v2
|
1887
1772
|
#
|
1888
1773
|
# {
|
1889
1774
|
# "amount": "0.0001",
|
@@ -1909,13 +1794,13 @@ class coinex(Exchange, ImplicitAPI):
|
|
1909
1794
|
# "updated_at": 1714114386250
|
1910
1795
|
# }
|
1911
1796
|
#
|
1912
|
-
# Spot, Margin and Swap trigger createOrder, createOrders v2
|
1797
|
+
# Spot, Margin and Swap trigger createOrder, createOrders, editOrder v2
|
1913
1798
|
#
|
1914
1799
|
# {
|
1915
1800
|
# "stop_id": 117180138153
|
1916
1801
|
# }
|
1917
1802
|
#
|
1918
|
-
# Swap createOrder, createOrders, cancelOrders v2
|
1803
|
+
# Swap createOrder, createOrders, editOrder, cancelOrders, cancelOrder v2
|
1919
1804
|
#
|
1920
1805
|
# {
|
1921
1806
|
# "amount": "0.0001",
|
@@ -1975,7 +1860,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
1975
1860
|
# "updated_at": 1714119054559
|
1976
1861
|
# }
|
1977
1862
|
#
|
1978
|
-
# Swap and Spot stop cancelOrders v2
|
1863
|
+
# Swap and Spot stop cancelOrders, cancelOrder v2
|
1979
1864
|
#
|
1980
1865
|
# {
|
1981
1866
|
# "amount": "0.0001",
|
@@ -1993,6 +1878,59 @@ class coinex(Exchange, ImplicitAPI):
|
|
1993
1878
|
# "updated_at": 1714187974363
|
1994
1879
|
# }
|
1995
1880
|
#
|
1881
|
+
# Swap fetchOrder v2
|
1882
|
+
#
|
1883
|
+
# {
|
1884
|
+
# "amount": "0.0001",
|
1885
|
+
# "client_id": "x-167673045-da5f31dcd478a829",
|
1886
|
+
# "created_at": 1714460987164,
|
1887
|
+
# "fee": "0",
|
1888
|
+
# "fee_ccy": "USDT",
|
1889
|
+
# "filled_amount": "0",
|
1890
|
+
# "filled_value": "0",
|
1891
|
+
# "last_filled_amount": "0",
|
1892
|
+
# "last_filled_price": "0",
|
1893
|
+
# "maker_fee_rate": "0.0003",
|
1894
|
+
# "market": "BTCUSDT",
|
1895
|
+
# "market_type": "FUTURES",
|
1896
|
+
# "order_id": 137319868771,
|
1897
|
+
# "price": "61000",
|
1898
|
+
# "realized_pnl": "0",
|
1899
|
+
# "side": "buy",
|
1900
|
+
# "status": "open",
|
1901
|
+
# "taker_fee_rate": "0.0005",
|
1902
|
+
# "type": "limit",
|
1903
|
+
# "unfilled_amount": "0.0001",
|
1904
|
+
# "updated_at": 1714460987164
|
1905
|
+
# }
|
1906
|
+
#
|
1907
|
+
# Spot and Margin fetchOrder v2
|
1908
|
+
#
|
1909
|
+
# {
|
1910
|
+
# "amount": "0.0001",
|
1911
|
+
# "base_fee": "0",
|
1912
|
+
# "ccy": "BTC",
|
1913
|
+
# "client_id": "x-167673045-da918d6724e3af81",
|
1914
|
+
# "created_at": 1714461638958,
|
1915
|
+
# "discount_fee": "0",
|
1916
|
+
# "filled_amount": "0",
|
1917
|
+
# "filled_value": "0",
|
1918
|
+
# "last_fill_amount": "0",
|
1919
|
+
# "last_fill_price": "0",
|
1920
|
+
# "maker_fee_rate": "0.002",
|
1921
|
+
# "market": "BTCUSDT",
|
1922
|
+
# "market_type": "SPOT",
|
1923
|
+
# "order_id": 117492012985,
|
1924
|
+
# "price": "61000",
|
1925
|
+
# "quote_fee": "0",
|
1926
|
+
# "side": "buy",
|
1927
|
+
# "status": "open",
|
1928
|
+
# "taker_fee_rate": "0.002",
|
1929
|
+
# "type": "limit",
|
1930
|
+
# "unfilled_amount": "0.0001",
|
1931
|
+
# "updated_at": 1714461638958
|
1932
|
+
# }
|
1933
|
+
#
|
1996
1934
|
rawStatus = self.safe_string(order, 'status')
|
1997
1935
|
timestamp = self.safe_timestamp(order, 'create_time')
|
1998
1936
|
if timestamp is None:
|
@@ -2598,7 +2536,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
2598
2536
|
:param str[] ids: order ids
|
2599
2537
|
:param str symbol: unified market symbol
|
2600
2538
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2601
|
-
:param boolean [params.
|
2539
|
+
:param boolean [params.trigger]: set to True for canceling stop orders
|
2602
2540
|
:returns dict: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
2603
2541
|
"""
|
2604
2542
|
if symbol is None:
|
@@ -2762,7 +2700,10 @@ class coinex(Exchange, ImplicitAPI):
|
|
2762
2700
|
def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
|
2763
2701
|
"""
|
2764
2702
|
edit a trade order
|
2765
|
-
:see: https://
|
2703
|
+
:see: https://docs.coinex.com/api/v2/spot/order/http/edit-order
|
2704
|
+
:see: https://docs.coinex.com/api/v2/spot/order/http/edit-stop-order
|
2705
|
+
:see: https://docs.coinex.com/api/v2/futures/order/http/edit-order
|
2706
|
+
:see: https://docs.coinex.com/api/v2/futures/order/http/edit-stop-order
|
2766
2707
|
:param str id: order id
|
2767
2708
|
:param str symbol: unified symbol of the market to create an order in
|
2768
2709
|
:param str type: 'market' or 'limit'
|
@@ -2770,282 +2711,448 @@ class coinex(Exchange, ImplicitAPI):
|
|
2770
2711
|
:param float amount: how much of the currency you want to trade in units of the base currency
|
2771
2712
|
:param float [price]: the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
2772
2713
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2714
|
+
:param float [params.triggerPrice]: the price to trigger stop orders
|
2773
2715
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
2774
2716
|
"""
|
2775
2717
|
if symbol is None:
|
2776
2718
|
raise ArgumentsRequired(self.id + ' editOrder() requires a symbol argument')
|
2777
2719
|
self.load_markets()
|
2778
2720
|
market = self.market(symbol)
|
2779
|
-
if not market['spot']:
|
2780
|
-
raise NotSupported(self.id + ' editOrder() does not support ' + market['type'] + ' orders, only spot orders are accepted')
|
2781
2721
|
request = {
|
2782
2722
|
'market': market['id'],
|
2783
|
-
'id': int(id),
|
2784
2723
|
}
|
2785
2724
|
if amount is not None:
|
2786
2725
|
request['amount'] = self.amount_to_precision(symbol, amount)
|
2787
2726
|
if price is not None:
|
2788
2727
|
request['price'] = self.price_to_precision(symbol, price)
|
2789
|
-
response =
|
2790
|
-
|
2791
|
-
|
2792
|
-
|
2793
|
-
|
2794
|
-
|
2795
|
-
|
2796
|
-
|
2797
|
-
|
2798
|
-
|
2799
|
-
|
2800
|
-
|
2801
|
-
|
2802
|
-
|
2803
|
-
|
2804
|
-
|
2805
|
-
|
2806
|
-
|
2807
|
-
|
2808
|
-
|
2809
|
-
|
2810
|
-
|
2811
|
-
|
2812
|
-
|
2813
|
-
|
2814
|
-
|
2815
|
-
|
2816
|
-
|
2817
|
-
|
2818
|
-
|
2819
|
-
|
2820
|
-
|
2728
|
+
response = None
|
2729
|
+
triggerPrice = self.safe_string_n(params, ['stopPrice', 'triggerPrice', 'trigger_price'])
|
2730
|
+
params = self.omit(params, ['stopPrice', 'triggerPrice'])
|
2731
|
+
isTriggerOrder = triggerPrice is not None
|
2732
|
+
if isTriggerOrder:
|
2733
|
+
request['trigger_price'] = self.price_to_precision(symbol, triggerPrice)
|
2734
|
+
request['stop_id'] = self.parse_to_numeric(id)
|
2735
|
+
else:
|
2736
|
+
request['order_id'] = self.parse_to_numeric(id)
|
2737
|
+
marginMode = None
|
2738
|
+
marginMode, params = self.handle_margin_mode_and_params('editOrder', params)
|
2739
|
+
if market['spot']:
|
2740
|
+
if marginMode is not None:
|
2741
|
+
request['market_type'] = 'MARGIN'
|
2742
|
+
else:
|
2743
|
+
request['market_type'] = 'SPOT'
|
2744
|
+
if isTriggerOrder:
|
2745
|
+
response = self.v2PrivatePostSpotModifyStopOrder(self.extend(request, params))
|
2746
|
+
#
|
2747
|
+
# {
|
2748
|
+
# "code": 0,
|
2749
|
+
# "data": {
|
2750
|
+
# "stop_id": 117337235167
|
2751
|
+
# },
|
2752
|
+
# "message": "OK"
|
2753
|
+
# }
|
2754
|
+
#
|
2755
|
+
else:
|
2756
|
+
response = self.v2PrivatePostSpotModifyOrder(self.extend(request, params))
|
2757
|
+
#
|
2758
|
+
# {
|
2759
|
+
# "code": 0,
|
2760
|
+
# "data": {
|
2761
|
+
# "amount": "0.0001",
|
2762
|
+
# "base_fee": "0",
|
2763
|
+
# "ccy": "BTC",
|
2764
|
+
# "client_id": "x-167673045-87eb2bebf42882d8",
|
2765
|
+
# "created_at": 1714290302047,
|
2766
|
+
# "discount_fee": "0",
|
2767
|
+
# "filled_amount": "0",
|
2768
|
+
# "filled_value": "0",
|
2769
|
+
# "last_fill_amount": "0",
|
2770
|
+
# "last_fill_price": "0",
|
2771
|
+
# "maker_fee_rate": "0.002",
|
2772
|
+
# "market": "BTCUSDT",
|
2773
|
+
# "market_type": "SPOT",
|
2774
|
+
# "order_id": 117336922195,
|
2775
|
+
# "price": "61000",
|
2776
|
+
# "quote_fee": "0",
|
2777
|
+
# "side": "buy",
|
2778
|
+
# "status": "open",
|
2779
|
+
# "taker_fee_rate": "0.002",
|
2780
|
+
# "type": "limit",
|
2781
|
+
# "unfilled_amount": "0.0001",
|
2782
|
+
# "updated_at": 1714290191141
|
2783
|
+
# },
|
2784
|
+
# "message": "OK"
|
2785
|
+
# }
|
2786
|
+
#
|
2787
|
+
else:
|
2788
|
+
request['market_type'] = 'FUTURES'
|
2789
|
+
if isTriggerOrder:
|
2790
|
+
response = self.v2PrivatePostFuturesModifyStopOrder(self.extend(request, params))
|
2791
|
+
#
|
2792
|
+
# {
|
2793
|
+
# "code": 0,
|
2794
|
+
# "data": {
|
2795
|
+
# "stop_id": 137091875605
|
2796
|
+
# },
|
2797
|
+
# "message": "OK"
|
2798
|
+
# }
|
2799
|
+
#
|
2800
|
+
else:
|
2801
|
+
response = self.v2PrivatePostFuturesModifyOrder(self.extend(request, params))
|
2802
|
+
#
|
2803
|
+
# {
|
2804
|
+
# "code": 0,
|
2805
|
+
# "data": {
|
2806
|
+
# "amount": "0.0001",
|
2807
|
+
# "client_id": "x-167673045-3f2d09191462b207",
|
2808
|
+
# "created_at": 1714290927630,
|
2809
|
+
# "fee": "0",
|
2810
|
+
# "fee_ccy": "USDT",
|
2811
|
+
# "filled_amount": "0",
|
2812
|
+
# "filled_value": "0",
|
2813
|
+
# "last_filled_amount": "0",
|
2814
|
+
# "last_filled_price": "0",
|
2815
|
+
# "maker_fee_rate": "0.0003",
|
2816
|
+
# "market": "BTCUSDT",
|
2817
|
+
# "market_type": "FUTURES",
|
2818
|
+
# "order_id": 137091566717,
|
2819
|
+
# "price": "61000",
|
2820
|
+
# "realized_pnl": "0",
|
2821
|
+
# "side": "buy",
|
2822
|
+
# "taker_fee_rate": "0.0005",
|
2823
|
+
# "type": "limit",
|
2824
|
+
# "unfilled_amount": "0.0001",
|
2825
|
+
# "updated_at": 1714290927630
|
2826
|
+
# },
|
2827
|
+
# "message": "OK"
|
2828
|
+
# }
|
2829
|
+
#
|
2821
2830
|
data = self.safe_dict(response, 'data', {})
|
2822
2831
|
return self.parse_order(data, market)
|
2823
2832
|
|
2824
2833
|
def cancel_order(self, id: str, symbol: Str = None, params={}):
|
2825
2834
|
"""
|
2826
2835
|
cancels an open order
|
2827
|
-
:see: https://
|
2828
|
-
:see: https://
|
2829
|
-
:see: https://
|
2830
|
-
:see: https://
|
2831
|
-
:see: https://
|
2832
|
-
:see: https://
|
2833
|
-
:see: https://
|
2834
|
-
:see: https://
|
2836
|
+
:see: https://docs.coinex.com/api/v2/spot/order/http/cancel-order
|
2837
|
+
:see: https://docs.coinex.com/api/v2/spot/order/http/cancel-stop-order
|
2838
|
+
:see: https://docs.coinex.com/api/v2/spot/order/http/cancel-order-by-client-id
|
2839
|
+
:see: https://docs.coinex.com/api/v2/spot/order/http/cancel-stop-order-by-client-id
|
2840
|
+
:see: https://docs.coinex.com/api/v2/futures/order/http/cancel-order
|
2841
|
+
:see: https://docs.coinex.com/api/v2/futures/order/http/cancel-stop-order
|
2842
|
+
:see: https://docs.coinex.com/api/v2/futures/order/http/cancel-order-by-client-id
|
2843
|
+
:see: https://docs.coinex.com/api/v2/futures/order/http/cancel-stop-order-by-client-id
|
2835
2844
|
:param str id: order id
|
2836
2845
|
:param str symbol: unified symbol of the market the order was made in
|
2837
2846
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2838
2847
|
:param str [params.clientOrderId]: client order id, defaults to id if not passed
|
2839
|
-
:param boolean [params.
|
2840
|
-
:returns dict:
|
2848
|
+
:param boolean [params.trigger]: set to True for canceling a trigger order
|
2849
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
2841
2850
|
"""
|
2842
2851
|
if symbol is None:
|
2843
2852
|
raise ArgumentsRequired(self.id + ' cancelOrder() requires a symbol argument')
|
2844
2853
|
self.load_markets()
|
2845
2854
|
market = self.market(symbol)
|
2846
|
-
|
2855
|
+
isTriggerOrder = self.safe_bool_2(params, 'stop', 'trigger')
|
2847
2856
|
swap = market['swap']
|
2848
2857
|
request = {
|
2849
2858
|
'market': market['id'],
|
2850
2859
|
}
|
2851
|
-
accountId = self.safe_integer(params, 'account_id')
|
2852
2860
|
marginMode = None
|
2853
2861
|
marginMode, params = self.handle_margin_mode_and_params('cancelOrder', params)
|
2862
|
+
if swap:
|
2863
|
+
request['market_type'] = 'FUTURES'
|
2864
|
+
else:
|
2865
|
+
if marginMode is not None:
|
2866
|
+
request['market_type'] = 'MARGIN'
|
2867
|
+
else:
|
2868
|
+
request['market_type'] = 'SPOT'
|
2854
2869
|
clientOrderId = self.safe_string_2(params, 'client_id', 'clientOrderId')
|
2855
|
-
|
2856
|
-
if accountId is None:
|
2857
|
-
raise BadRequest(self.id + ' cancelOrder() requires an account_id parameter for margin orders')
|
2858
|
-
request['account_id'] = accountId
|
2859
|
-
query = self.omit(params, ['stop', 'account_id', 'clientOrderId'])
|
2870
|
+
params = self.omit(params, ['stop', 'trigger', 'clientOrderId'])
|
2860
2871
|
response = None
|
2861
2872
|
if clientOrderId is not None:
|
2862
2873
|
request['client_id'] = clientOrderId
|
2863
|
-
if
|
2874
|
+
if isTriggerOrder:
|
2864
2875
|
if swap:
|
2865
|
-
response = self.
|
2876
|
+
response = self.v2PrivatePostFuturesCancelStopOrderByClientId(self.extend(request, params))
|
2877
|
+
# {
|
2878
|
+
# "code": 0,
|
2879
|
+
# "data": [
|
2880
|
+
# {
|
2881
|
+
# "code": 0,
|
2882
|
+
# "data": {
|
2883
|
+
# "amount": "0.0001",
|
2884
|
+
# "client_id": "client01",
|
2885
|
+
# "created_at": 1714368624473,
|
2886
|
+
# "market": "BTCUSDT",
|
2887
|
+
# "market_type": "FUTURES",
|
2888
|
+
# "price": "61000",
|
2889
|
+
# "side": "buy",
|
2890
|
+
# "stop_id": 137175823891,
|
2891
|
+
# "trigger_direction": "higher",
|
2892
|
+
# "trigger_price": "61500",
|
2893
|
+
# "trigger_price_type": "latest_price",
|
2894
|
+
# "type": "limit",
|
2895
|
+
# "updated_at": 1714368661444
|
2896
|
+
# },
|
2897
|
+
# "message": ""
|
2898
|
+
# }
|
2899
|
+
# ],
|
2900
|
+
# "message": "OK"
|
2901
|
+
# }
|
2866
2902
|
else:
|
2867
|
-
response = self.
|
2903
|
+
response = self.v2PrivatePostSpotCancelStopOrderByClientId(self.extend(request, params))
|
2904
|
+
# {
|
2905
|
+
# "code" :0,
|
2906
|
+
# "data": [
|
2907
|
+
# {
|
2908
|
+
# "code": 0,
|
2909
|
+
# "data": {
|
2910
|
+
# "amount": "0.0001",
|
2911
|
+
# "ccy": "BTC",
|
2912
|
+
# "client_id": "client01",
|
2913
|
+
# "created_at": 1714366950279,
|
2914
|
+
# "market": "BTCUSDT",
|
2915
|
+
# "market_type": "SPOT",
|
2916
|
+
# "price": "61000",
|
2917
|
+
# "side": "buy",
|
2918
|
+
# "stop_id": 117402512706,
|
2919
|
+
# "trigger_direction": "higher",
|
2920
|
+
# "trigger_price": "61500",
|
2921
|
+
# "trigger_price_type": "mark_price",
|
2922
|
+
# "type": "limit",
|
2923
|
+
# "updated_at": 1714366950279
|
2924
|
+
# },
|
2925
|
+
# "message": "OK"
|
2926
|
+
# }
|
2927
|
+
# ],
|
2928
|
+
# "message": "OK"
|
2929
|
+
# }
|
2868
2930
|
else:
|
2869
2931
|
if swap:
|
2870
|
-
response = self.
|
2932
|
+
response = self.v2PrivatePostFuturesCancelOrderByClientId(self.extend(request, params))
|
2933
|
+
# {
|
2934
|
+
# "code": 0,
|
2935
|
+
# "data": [
|
2936
|
+
# {
|
2937
|
+
# "code": 0,
|
2938
|
+
# "data": {
|
2939
|
+
# "amount": "0.0001",
|
2940
|
+
# "client_id": "x-167673045-bf60e24bb437a3df",
|
2941
|
+
# "created_at": 1714368416437,
|
2942
|
+
# "fee": "0",
|
2943
|
+
# "fee_ccy": "USDT",
|
2944
|
+
# "filled_amount": "0",
|
2945
|
+
# "filled_value": "0",
|
2946
|
+
# "last_filled_amount": "0",
|
2947
|
+
# "last_filled_price": "0",
|
2948
|
+
# "maker_fee_rate": "0.0003",
|
2949
|
+
# "market": "BTCUSDT",
|
2950
|
+
# "market_type": "FUTURES",
|
2951
|
+
# "order_id": 137175616437,
|
2952
|
+
# "price": "61000",
|
2953
|
+
# "realized_pnl": "0",
|
2954
|
+
# "side": "buy",
|
2955
|
+
# "taker_fee_rate": "0.0005",
|
2956
|
+
# "type": "limit",
|
2957
|
+
# "unfilled_amount": "0.0001",
|
2958
|
+
# "updated_at": 1714368507174
|
2959
|
+
# },
|
2960
|
+
# "message": ""
|
2961
|
+
# }
|
2962
|
+
# ],
|
2963
|
+
# "message": "OK"
|
2964
|
+
# }
|
2871
2965
|
else:
|
2872
|
-
response = self.
|
2966
|
+
response = self.v2PrivatePostSpotCancelOrderByClientId(self.extend(request, params))
|
2967
|
+
# {
|
2968
|
+
# "code": 0,
|
2969
|
+
# "data": [
|
2970
|
+
# {
|
2971
|
+
# "code": 0,
|
2972
|
+
# "data": {
|
2973
|
+
# "amount": "0.0001",
|
2974
|
+
# "base_fee": "0",
|
2975
|
+
# "ccy": "BTC",
|
2976
|
+
# "client_id": "x-167673045-d49eaca5f412afc8",
|
2977
|
+
# "created_at": 1714366502807,
|
2978
|
+
# "discount_fee": "0",
|
2979
|
+
# "filled_amount": "0",
|
2980
|
+
# "filled_value": "0",
|
2981
|
+
# "last_fill_amount": "0",
|
2982
|
+
# "last_fill_price": "0",
|
2983
|
+
# "maker_fee_rate": "0.002",
|
2984
|
+
# "market": "BTCUSDT",
|
2985
|
+
# "market_type": "SPOT",
|
2986
|
+
# "order_id": 117402157490,
|
2987
|
+
# "price": "61000",
|
2988
|
+
# "quote_fee": "0",
|
2989
|
+
# "side": "buy",
|
2990
|
+
# "taker_fee_rate": "0.002",
|
2991
|
+
# "type": "limit",
|
2992
|
+
# "unfilled_amount": "0.0001",
|
2993
|
+
# "updated_at": 1714366502807
|
2994
|
+
# },
|
2995
|
+
# "message": "OK"
|
2996
|
+
# }
|
2997
|
+
# ],
|
2998
|
+
# "message": "OK"
|
2999
|
+
# }
|
2873
3000
|
else:
|
2874
|
-
|
2875
|
-
|
2876
|
-
if stop:
|
3001
|
+
if isTriggerOrder:
|
3002
|
+
request['stop_id'] = self.parse_to_numeric(id)
|
2877
3003
|
if swap:
|
2878
|
-
response = self.
|
3004
|
+
response = self.v2PrivatePostFuturesCancelStopOrder(self.extend(request, params))
|
3005
|
+
# {
|
3006
|
+
# "code": 0,
|
3007
|
+
# "data": {
|
3008
|
+
# "amount": "0.0001",
|
3009
|
+
# "ccy": "BTC",
|
3010
|
+
# "client_id": "x-167673045-f21ecfd7542abf1f",
|
3011
|
+
# "created_at": 1714366177334,
|
3012
|
+
# "market": "BTCUSDT",
|
3013
|
+
# "market_type": "SPOT",
|
3014
|
+
# "price": "61000",
|
3015
|
+
# "side": "buy",
|
3016
|
+
# "stop_id": 117401897954,
|
3017
|
+
# "trigger_direction": "higher",
|
3018
|
+
# "trigger_price": "61500",
|
3019
|
+
# "trigger_price_type": "mark_price",
|
3020
|
+
# "type": "limit",
|
3021
|
+
# "updated_at": 1714366177334
|
3022
|
+
# },
|
3023
|
+
# "message": "OK"
|
3024
|
+
# }
|
2879
3025
|
else:
|
2880
|
-
response = self.
|
3026
|
+
response = self.v2PrivatePostSpotCancelStopOrder(self.extend(request, params))
|
3027
|
+
# {
|
3028
|
+
# "code": 0,
|
3029
|
+
# "data": {
|
3030
|
+
# "amount": "0.0001",
|
3031
|
+
# "ccy": "BTC",
|
3032
|
+
# "client_id": "x-167673045-f21ecfd7542abf1f",
|
3033
|
+
# "created_at": 1714366177334,
|
3034
|
+
# "market": "BTCUSDT",
|
3035
|
+
# "market_type": "SPOT",
|
3036
|
+
# "price": "61000",
|
3037
|
+
# "side": "buy",
|
3038
|
+
# "stop_id": 117401897954,
|
3039
|
+
# "trigger_direction": "higher",
|
3040
|
+
# "trigger_price": "61500",
|
3041
|
+
# "trigger_price_type": "mark_price",
|
3042
|
+
# "type": "limit",
|
3043
|
+
# "updated_at": 1714366177334
|
3044
|
+
# },
|
3045
|
+
# "message": "OK"
|
3046
|
+
# }
|
2881
3047
|
else:
|
3048
|
+
request['order_id'] = self.parse_to_numeric(id)
|
2882
3049
|
if swap:
|
2883
|
-
response = self.
|
3050
|
+
response = self.v2PrivatePostFuturesCancelOrder(self.extend(request, params))
|
3051
|
+
# {
|
3052
|
+
# "code": 0,
|
3053
|
+
# "data": {
|
3054
|
+
# "amount": "0.0001",
|
3055
|
+
# "client_id": "x-167673045-7f14381c74a98a85",
|
3056
|
+
# "created_at": 1714367342024,
|
3057
|
+
# "fee": "0",
|
3058
|
+
# "fee_ccy": "USDT",
|
3059
|
+
# "filled_amount": "0",
|
3060
|
+
# "filled_value": "0",
|
3061
|
+
# "last_filled_amount": "0",
|
3062
|
+
# "last_filled_price": "0",
|
3063
|
+
# "maker_fee_rate": "0.0003",
|
3064
|
+
# "market": "BTCUSDT",
|
3065
|
+
# "market_type": "FUTURES",
|
3066
|
+
# "order_id": 137174472136,
|
3067
|
+
# "price": "61000",
|
3068
|
+
# "realized_pnl": "0",
|
3069
|
+
# "side": "buy",
|
3070
|
+
# "taker_fee_rate": "0.0005",
|
3071
|
+
# "type": "limit",
|
3072
|
+
# "unfilled_amount": "0.0001",
|
3073
|
+
# "updated_at": 1714367515978
|
3074
|
+
# },
|
3075
|
+
# "message": "OK"
|
3076
|
+
# }
|
2884
3077
|
else:
|
2885
|
-
response = self.
|
2886
|
-
|
2887
|
-
|
2888
|
-
|
2889
|
-
|
2890
|
-
|
2891
|
-
|
2892
|
-
|
2893
|
-
|
2894
|
-
|
2895
|
-
|
2896
|
-
|
2897
|
-
|
2898
|
-
|
2899
|
-
|
2900
|
-
|
2901
|
-
|
2902
|
-
|
2903
|
-
|
2904
|
-
|
2905
|
-
|
2906
|
-
|
2907
|
-
|
2908
|
-
|
2909
|
-
|
2910
|
-
|
2911
|
-
|
2912
|
-
|
2913
|
-
|
2914
|
-
|
2915
|
-
|
2916
|
-
|
2917
|
-
|
2918
|
-
|
2919
|
-
#
|
2920
|
-
# {
|
2921
|
-
# "code": 0,
|
2922
|
-
# "data": {
|
2923
|
-
# "amount": "0.0005",
|
2924
|
-
# "client_id": "",
|
2925
|
-
# "create_time": 1651004578.618224,
|
2926
|
-
# "deal_asset_fee": "0.00000000000000000000",
|
2927
|
-
# "deal_fee": "0.00000000000000000000",
|
2928
|
-
# "deal_profit": "0.00000000000000000000",
|
2929
|
-
# "deal_stock": "0.00000000000000000000",
|
2930
|
-
# "effect_type": 1,
|
2931
|
-
# "fee_asset": "",
|
2932
|
-
# "fee_discount": "0.00000000000000000000",
|
2933
|
-
# "last_deal_amount": "0.00000000000000000000",
|
2934
|
-
# "last_deal_id": 0,
|
2935
|
-
# "last_deal_price": "0.00000000000000000000",
|
2936
|
-
# "last_deal_role": 0,
|
2937
|
-
# "last_deal_time": 0,
|
2938
|
-
# "last_deal_type": 0,
|
2939
|
-
# "left": "0.0005",
|
2940
|
-
# "leverage": "3",
|
2941
|
-
# "maker_fee": "0.00030",
|
2942
|
-
# "market": "BTCUSDT",
|
2943
|
-
# "order_id": 18221659097,
|
2944
|
-
# "position_id": 0,
|
2945
|
-
# "position_type": 1,
|
2946
|
-
# "price": "30000.00",
|
2947
|
-
# "side": 2,
|
2948
|
-
# "source": "api.v1",
|
2949
|
-
# "stop_id": 0,
|
2950
|
-
# "taker_fee": "0.00050",
|
2951
|
-
# "target": 0,
|
2952
|
-
# "type": 1,
|
2953
|
-
# "update_time": 1651004578.618224,
|
2954
|
-
# "user_id": 3620173
|
2955
|
-
# },
|
2956
|
-
# "message": "OK"
|
2957
|
-
# }
|
2958
|
-
#
|
2959
|
-
# Swap Stop
|
2960
|
-
#
|
2961
|
-
# {
|
2962
|
-
# "code": 0,
|
2963
|
-
# "data": {
|
2964
|
-
# "amount": "0.0005",
|
2965
|
-
# "client_id": "",
|
2966
|
-
# "create_time": 1651034023.008771,
|
2967
|
-
# "effect_type": 1,
|
2968
|
-
# "fee_asset": "",
|
2969
|
-
# "fee_discount": "0.00000000000000000000",
|
2970
|
-
# "maker_fee": "0.00030",
|
2971
|
-
# "market": "BTCUSDT",
|
2972
|
-
# "order_id": 18256915101,
|
2973
|
-
# "price": "31000.00",
|
2974
|
-
# "side": 2,
|
2975
|
-
# "source": "api.v1",
|
2976
|
-
# "state": 1,
|
2977
|
-
# "stop_price": "31500.00",
|
2978
|
-
# "stop_type": 1,
|
2979
|
-
# "taker_fee": "0.00050",
|
2980
|
-
# "target": 0,
|
2981
|
-
# "type": 1,
|
2982
|
-
# "update_time": 1651034397.193624,
|
2983
|
-
# "user_id": 3620173
|
2984
|
-
# },
|
2985
|
-
# "message":"OK"
|
2986
|
-
# }
|
2987
|
-
#
|
2988
|
-
# Spot and Margin Stop
|
2989
|
-
#
|
2990
|
-
# {"code":0,"data":{},"message":"Success"}
|
2991
|
-
#
|
2992
|
-
data = self.safe_dict(response, 'data')
|
3078
|
+
response = self.v2PrivatePostSpotCancelOrder(self.extend(request, params))
|
3079
|
+
# {
|
3080
|
+
# "code": 0,
|
3081
|
+
# "data": {
|
3082
|
+
# "amount": "0.0001",
|
3083
|
+
# "base_fee": "0",
|
3084
|
+
# "ccy": "BTC",
|
3085
|
+
# "client_id": "x-167673045-86fbe37b54a2aea3",
|
3086
|
+
# "created_at": 1714365277437,
|
3087
|
+
# "discount_fee": "0",
|
3088
|
+
# "filled_amount": "0",
|
3089
|
+
# "filled_value": "0",
|
3090
|
+
# "last_fill_amount": "0",
|
3091
|
+
# "last_fill_price": "0",
|
3092
|
+
# "maker_fee_rate": "0.002",
|
3093
|
+
# "market": "BTCUSDT",
|
3094
|
+
# "market_type": "SPOT",
|
3095
|
+
# "order_id": 117401168172,
|
3096
|
+
# "price": "61000",
|
3097
|
+
# "quote_fee": "0",
|
3098
|
+
# "side": "buy",
|
3099
|
+
# "taker_fee_rate": "0.002",
|
3100
|
+
# "type": "limit",
|
3101
|
+
# "unfilled_amount": "0.0001",
|
3102
|
+
# "updated_at": 1714365277437
|
3103
|
+
# },
|
3104
|
+
# "message": "OK"
|
3105
|
+
# }
|
3106
|
+
data = None
|
3107
|
+
if clientOrderId is not None:
|
3108
|
+
rows = self.safe_list(response, 'data', [])
|
3109
|
+
data = self.safe_dict(rows[0], 'data', {})
|
3110
|
+
else:
|
3111
|
+
data = self.safe_dict(response, 'data', {})
|
2993
3112
|
return self.parse_order(data, market)
|
2994
3113
|
|
2995
3114
|
def cancel_all_orders(self, symbol: Str = None, params={}):
|
2996
3115
|
"""
|
2997
3116
|
cancel all open orders in a market
|
2998
|
-
:see: https://
|
2999
|
-
:see: https://
|
3000
|
-
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http024_cancel_stop_all
|
3001
|
-
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http022_cancel_all
|
3117
|
+
:see: https://docs.coinex.com/api/v2/spot/order/http/cancel-all-order
|
3118
|
+
:see: https://docs.coinex.com/api/v2/futures/order/http/cancel-all-order
|
3002
3119
|
:param str symbol: unified market symbol of the market to cancel orders in
|
3003
3120
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3121
|
+
:param str [params.marginMode]: 'cross' or 'isolated' for canceling spot margin orders
|
3004
3122
|
:returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
3005
3123
|
"""
|
3006
3124
|
if symbol is None:
|
3007
3125
|
raise ArgumentsRequired(self.id + ' cancelAllOrders() requires a symbol argument')
|
3008
3126
|
self.load_markets()
|
3009
3127
|
market = self.market(symbol)
|
3010
|
-
marketId = market['id']
|
3011
|
-
accountId = self.safe_integer(params, 'account_id', 0)
|
3012
3128
|
request = {
|
3013
|
-
'market':
|
3014
|
-
# 'account_id': accountId, # SPOT, main account ID: 0, margin account ID: See < Inquire Margin Account Market Info >, future account ID: See < Inquire Future Account Market Info >
|
3015
|
-
# 'side': 0, # SWAP, 0: All, 1: Sell, 2: Buy
|
3129
|
+
'market': market['id'],
|
3016
3130
|
}
|
3017
|
-
swap = market['swap']
|
3018
|
-
stop = self.safe_value(params, 'stop')
|
3019
|
-
params = self.omit(params, ['stop', 'account_id'])
|
3020
3131
|
response = None
|
3021
|
-
if swap:
|
3022
|
-
|
3023
|
-
|
3024
|
-
|
3025
|
-
|
3132
|
+
if market['swap']:
|
3133
|
+
request['market_type'] = 'FUTURES'
|
3134
|
+
response = self.v2PrivatePostFuturesCancelAllOrder(self.extend(request, params))
|
3135
|
+
#
|
3136
|
+
# {"code":0,"data":{},"message":"OK"}
|
3137
|
+
#
|
3026
3138
|
else:
|
3027
|
-
|
3028
|
-
|
3029
|
-
|
3139
|
+
marginMode = None
|
3140
|
+
marginMode, params = self.handle_margin_mode_and_params('fetchOrdersByStatus', params)
|
3141
|
+
if marginMode is not None:
|
3142
|
+
request['market_type'] = 'MARGIN'
|
3030
3143
|
else:
|
3031
|
-
|
3032
|
-
|
3033
|
-
|
3034
|
-
|
3035
|
-
|
3036
|
-
#
|
3037
|
-
# Swap
|
3038
|
-
#
|
3039
|
-
# {"code": 0, "data": {"status":"success"}, "message": "OK"}
|
3040
|
-
#
|
3144
|
+
request['market_type'] = 'SPOT'
|
3145
|
+
response = self.v2PrivatePostSpotCancelAllOrder(self.extend(request, params))
|
3146
|
+
#
|
3147
|
+
# {"code":0,"data":{},"message":"OK"}
|
3148
|
+
#
|
3041
3149
|
return response
|
3042
3150
|
|
3043
3151
|
def fetch_order(self, id: str, symbol: Str = None, params={}):
|
3044
3152
|
"""
|
3045
3153
|
fetches information on an order made by the user
|
3046
|
-
:see: https://
|
3047
|
-
:see: https://
|
3048
|
-
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade007_order_status
|
3154
|
+
:see: https://docs.coinex.com/api/v2/spot/order/http/get-order-status
|
3155
|
+
:see: https://docs.coinex.com/api/v2/futures/order/http/get-order-status
|
3049
3156
|
:param str symbol: unified symbol of the market the order was made in
|
3050
3157
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3051
3158
|
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
@@ -3054,123 +3161,75 @@ class coinex(Exchange, ImplicitAPI):
|
|
3054
3161
|
raise ArgumentsRequired(self.id + ' fetchOrder() requires a symbol argument')
|
3055
3162
|
self.load_markets()
|
3056
3163
|
market = self.market(symbol)
|
3057
|
-
swap = market['swap']
|
3058
|
-
stop = self.safe_value(params, 'stop')
|
3059
|
-
params = self.omit(params, 'stop')
|
3060
3164
|
request = {
|
3061
3165
|
'market': market['id'],
|
3062
|
-
|
3063
|
-
# 'order_id': id, # SWAP
|
3166
|
+
'order_id': self.parse_to_numeric(id),
|
3064
3167
|
}
|
3065
|
-
idRequest = 'order_id' if swap else 'id'
|
3066
|
-
request[idRequest] = id
|
3067
3168
|
response = None
|
3068
|
-
if swap:
|
3069
|
-
|
3070
|
-
|
3071
|
-
|
3072
|
-
|
3169
|
+
if market['swap']:
|
3170
|
+
response = self.v2PrivateGetFuturesOrderStatus(self.extend(request, params))
|
3171
|
+
#
|
3172
|
+
# {
|
3173
|
+
# "code": 0,
|
3174
|
+
# "data": {
|
3175
|
+
# "amount": "0.0001",
|
3176
|
+
# "client_id": "x-167673045-da5f31dcd478a829",
|
3177
|
+
# "created_at": 1714460987164,
|
3178
|
+
# "fee": "0",
|
3179
|
+
# "fee_ccy": "USDT",
|
3180
|
+
# "filled_amount": "0",
|
3181
|
+
# "filled_value": "0",
|
3182
|
+
# "last_filled_amount": "0",
|
3183
|
+
# "last_filled_price": "0",
|
3184
|
+
# "maker_fee_rate": "0.0003",
|
3185
|
+
# "market": "BTCUSDT",
|
3186
|
+
# "market_type": "FUTURES",
|
3187
|
+
# "order_id": 137319868771,
|
3188
|
+
# "price": "61000",
|
3189
|
+
# "realized_pnl": "0",
|
3190
|
+
# "side": "buy",
|
3191
|
+
# "status": "open",
|
3192
|
+
# "taker_fee_rate": "0.0005",
|
3193
|
+
# "type": "limit",
|
3194
|
+
# "unfilled_amount": "0.0001",
|
3195
|
+
# "updated_at": 1714460987164
|
3196
|
+
# },
|
3197
|
+
# "message": "OK"
|
3198
|
+
# }
|
3199
|
+
#
|
3073
3200
|
else:
|
3074
|
-
response = self.
|
3075
|
-
|
3076
|
-
|
3077
|
-
|
3078
|
-
|
3079
|
-
|
3080
|
-
|
3081
|
-
|
3082
|
-
|
3083
|
-
|
3084
|
-
|
3085
|
-
|
3086
|
-
|
3087
|
-
|
3088
|
-
|
3089
|
-
|
3090
|
-
|
3091
|
-
|
3092
|
-
|
3093
|
-
|
3094
|
-
|
3095
|
-
|
3096
|
-
|
3097
|
-
|
3098
|
-
|
3099
|
-
|
3100
|
-
|
3101
|
-
|
3102
|
-
|
3103
|
-
|
3104
|
-
|
3105
|
-
|
3106
|
-
# "code": 0,
|
3107
|
-
# "data": {
|
3108
|
-
# "amount": "0.0005",
|
3109
|
-
# "client_id": "",
|
3110
|
-
# "create_time": 1651004578.618224,
|
3111
|
-
# "deal_asset_fee": "0.00000000000000000000",
|
3112
|
-
# "deal_fee": "0.00000000000000000000",
|
3113
|
-
# "deal_profit": "0.00000000000000000000",
|
3114
|
-
# "deal_stock": "0.00000000000000000000",
|
3115
|
-
# "effect_type": 1,
|
3116
|
-
# "fee_asset": "",
|
3117
|
-
# "fee_discount": "0.00000000000000000000",
|
3118
|
-
# "last_deal_amount": "0.00000000000000000000",
|
3119
|
-
# "last_deal_id": 0,
|
3120
|
-
# "last_deal_price": "0.00000000000000000000",
|
3121
|
-
# "last_deal_role": 0,
|
3122
|
-
# "last_deal_time": 0,
|
3123
|
-
# "last_deal_type": 0,
|
3124
|
-
# "left": "0.0005",
|
3125
|
-
# "leverage": "3",
|
3126
|
-
# "maker_fee": "0.00030",
|
3127
|
-
# "market": "BTCUSDT",
|
3128
|
-
# "order_id": 18221659097,
|
3129
|
-
# "position_id": 0,
|
3130
|
-
# "position_type": 1,
|
3131
|
-
# "price": "30000.00",
|
3132
|
-
# "side": 2,
|
3133
|
-
# "source": "api.v1",
|
3134
|
-
# "stop_id": 0,
|
3135
|
-
# "taker_fee": "0.00050",
|
3136
|
-
# "target": 0,
|
3137
|
-
# "type": 1,
|
3138
|
-
# "update_time": 1651004578.618224,
|
3139
|
-
# "user_id": 3620173
|
3140
|
-
# },
|
3141
|
-
# "message": "OK"
|
3142
|
-
# }
|
3143
|
-
#
|
3144
|
-
# Swap Stop
|
3145
|
-
#
|
3146
|
-
# {
|
3147
|
-
# "code": 0,
|
3148
|
-
# "data": {
|
3149
|
-
# "amount": "0.0005",
|
3150
|
-
# "client_id": "",
|
3151
|
-
# "create_time": 1651034023.008771,
|
3152
|
-
# "effect_type": 1,
|
3153
|
-
# "fee_asset": "",
|
3154
|
-
# "fee_discount": "0.00000000000000000000",
|
3155
|
-
# "maker_fee": "0.00030",
|
3156
|
-
# "market": "BTCUSDT",
|
3157
|
-
# "order_id": 18256915101,
|
3158
|
-
# "price": "31000.00",
|
3159
|
-
# "side": 2,
|
3160
|
-
# "source": "api.v1",
|
3161
|
-
# "state": 1,
|
3162
|
-
# "stop_price": "31500.00",
|
3163
|
-
# "stop_type": 1,
|
3164
|
-
# "taker_fee": "0.00050",
|
3165
|
-
# "target": 0,
|
3166
|
-
# "type": 1,
|
3167
|
-
# "update_time": 1651034397.193624,
|
3168
|
-
# "user_id": 3620173
|
3169
|
-
# },
|
3170
|
-
# "message":"OK"
|
3171
|
-
# }
|
3172
|
-
#
|
3173
|
-
data = self.safe_dict(response, 'data')
|
3201
|
+
response = self.v2PrivateGetSpotOrderStatus(self.extend(request, params))
|
3202
|
+
#
|
3203
|
+
# {
|
3204
|
+
# "code": 0,
|
3205
|
+
# "data": {
|
3206
|
+
# "amount": "0.0001",
|
3207
|
+
# "base_fee": "0",
|
3208
|
+
# "ccy": "BTC",
|
3209
|
+
# "client_id": "x-167673045-da918d6724e3af81",
|
3210
|
+
# "created_at": 1714461638958,
|
3211
|
+
# "discount_fee": "0",
|
3212
|
+
# "filled_amount": "0",
|
3213
|
+
# "filled_value": "0",
|
3214
|
+
# "last_fill_amount": "0",
|
3215
|
+
# "last_fill_price": "0",
|
3216
|
+
# "maker_fee_rate": "0.002",
|
3217
|
+
# "market": "BTCUSDT",
|
3218
|
+
# "market_type": "SPOT",
|
3219
|
+
# "order_id": 117492012985,
|
3220
|
+
# "price": "61000",
|
3221
|
+
# "quote_fee": "0",
|
3222
|
+
# "side": "buy",
|
3223
|
+
# "status": "open",
|
3224
|
+
# "taker_fee_rate": "0.002",
|
3225
|
+
# "type": "limit",
|
3226
|
+
# "unfilled_amount": "0.0001",
|
3227
|
+
# "updated_at": 1714461638958
|
3228
|
+
# },
|
3229
|
+
# "message": "OK"
|
3230
|
+
# }
|
3231
|
+
#
|
3232
|
+
data = self.safe_dict(response, 'data', {})
|
3174
3233
|
return self.parse_order(data, market)
|
3175
3234
|
|
3176
3235
|
def fetch_orders_by_status(self, status, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
@@ -5079,7 +5138,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
5079
5138
|
data = self.safe_value(data, 'data', [])
|
5080
5139
|
return self.parse_transactions(data, currency, since, limit)
|
5081
5140
|
|
5082
|
-
def parse_isolated_borrow_rate(self, info, market: Market = None):
|
5141
|
+
def parse_isolated_borrow_rate(self, info, market: Market = None) -> IsolatedBorrowRate:
|
5083
5142
|
#
|
5084
5143
|
# {
|
5085
5144
|
# "market": "BTCUSDT",
|
@@ -5112,7 +5171,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
5112
5171
|
'info': info,
|
5113
5172
|
}
|
5114
5173
|
|
5115
|
-
def fetch_isolated_borrow_rate(self, symbol: str, params={}):
|
5174
|
+
def fetch_isolated_borrow_rate(self, symbol: str, params={}) -> IsolatedBorrowRate:
|
5116
5175
|
"""
|
5117
5176
|
fetch the rate of interest to borrow a currency for margin trading
|
5118
5177
|
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account007_margin_account_settings
|
@@ -5149,7 +5208,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
5149
5208
|
data = self.safe_value(response, 'data', {})
|
5150
5209
|
return self.parse_isolated_borrow_rate(data, market)
|
5151
5210
|
|
5152
|
-
def fetch_isolated_borrow_rates(self, params={}):
|
5211
|
+
def fetch_isolated_borrow_rates(self, params={}) -> IsolatedBorrowRates:
|
5153
5212
|
"""
|
5154
5213
|
fetch the borrow interest rates of all currencies
|
5155
5214
|
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account007_margin_account_settings
|
@@ -5181,10 +5240,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
5181
5240
|
# }
|
5182
5241
|
#
|
5183
5242
|
data = self.safe_value(response, 'data', [])
|
5184
|
-
|
5185
|
-
for i in range(0, len(data)):
|
5186
|
-
rates.append(self.parse_isolated_borrow_rate(data[i]))
|
5187
|
-
return rates
|
5243
|
+
return self.parse_isolated_borrow_rates(data)
|
5188
5244
|
|
5189
5245
|
def fetch_borrow_interest(self, code: Str = None, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
5190
5246
|
self.load_markets()
|