ccxt 4.1.81__py2.py3-none-any.whl → 4.1.83__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/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +2 -2
- ccxt/async_support/bingx.py +1 -1
- ccxt/async_support/bitget.py +1 -1
- ccxt/async_support/bybit.py +1 -1
- ccxt/async_support/cex.py +27 -12
- ccxt/async_support/coinex.py +155 -64
- ccxt/async_support/cryptocom.py +43 -0
- ccxt/async_support/htx.py +12 -10
- ccxt/async_support/lbank.py +67 -38
- ccxt/async_support/okx.py +99 -7
- ccxt/base/exchange.py +2 -2
- ccxt/bingx.py +1 -1
- ccxt/bitget.py +1 -1
- ccxt/bybit.py +1 -1
- ccxt/cex.py +27 -12
- ccxt/coinex.py +155 -64
- ccxt/cryptocom.py +43 -0
- ccxt/htx.py +12 -10
- ccxt/lbank.py +67 -38
- ccxt/okx.py +99 -7
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/binance.py +1 -1
- ccxt/pro/bingx.py +1 -1
- ccxt/pro/bitget.py +1 -1
- ccxt/pro/bybit.py +1 -1
- ccxt/pro/cex.py +1 -1
- ccxt/pro/coinbasepro.py +1 -1
- ccxt/pro/cryptocom.py +1 -1
- ccxt/pro/gate.py +1 -1
- ccxt/pro/kucoin.py +1 -1
- ccxt/pro/kucoinfutures.py +1 -1
- ccxt/pro/okx.py +1 -1
- {ccxt-4.1.81.dist-info → ccxt-4.1.83.dist-info}/METADATA +5 -5
- {ccxt-4.1.81.dist-info → ccxt-4.1.83.dist-info}/RECORD +38 -38
- {ccxt-4.1.81.dist-info → ccxt-4.1.83.dist-info}/WHEEL +0 -0
- {ccxt-4.1.81.dist-info → ccxt-4.1.83.dist-info}/top_level.txt +0 -0
ccxt/coinex.py
CHANGED
@@ -470,6 +470,8 @@ class coinex(Exchange, ImplicitAPI):
|
|
470
470
|
def fetch_markets(self, params={}):
|
471
471
|
"""
|
472
472
|
retrieves data on all markets for coinex
|
473
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market002_all_market_info
|
474
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http006_market_list
|
473
475
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
474
476
|
:returns dict[]: an array of objects representing market data
|
475
477
|
"""
|
@@ -736,6 +738,8 @@ class coinex(Exchange, ImplicitAPI):
|
|
736
738
|
def fetch_ticker(self, symbol: str, params={}) -> Ticker:
|
737
739
|
"""
|
738
740
|
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
741
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market007_single_market_ticker
|
742
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http008_market_ticker
|
739
743
|
:param str symbol: unified symbol of the market to fetch the ticker for
|
740
744
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
741
745
|
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
|
@@ -745,8 +749,11 @@ class coinex(Exchange, ImplicitAPI):
|
|
745
749
|
request = {
|
746
750
|
'market': market['id'],
|
747
751
|
}
|
748
|
-
|
749
|
-
|
752
|
+
response = None
|
753
|
+
if market['swap']:
|
754
|
+
response = self.perpetualPublicGetMarketTicker(self.extend(request, params))
|
755
|
+
else:
|
756
|
+
response = self.publicGetMarketTicker(self.extend(request, params))
|
750
757
|
#
|
751
758
|
# Spot
|
752
759
|
#
|
@@ -814,13 +821,16 @@ class coinex(Exchange, ImplicitAPI):
|
|
814
821
|
"""
|
815
822
|
self.load_markets()
|
816
823
|
symbols = self.market_symbols(symbols)
|
817
|
-
market
|
824
|
+
market = None
|
818
825
|
if symbols is not None:
|
819
826
|
symbol = self.safe_value(symbols, 0)
|
820
827
|
market = self.market(symbol)
|
821
828
|
marketType, query = self.handle_market_type_and_params('fetchTickers', market, params)
|
822
|
-
|
823
|
-
|
829
|
+
response = None
|
830
|
+
if marketType == 'swap':
|
831
|
+
response = self.perpetualPublicGetMarketTickerAll(query)
|
832
|
+
else:
|
833
|
+
response = self.publicGetMarketTickerAll()
|
824
834
|
#
|
825
835
|
# Spot
|
826
836
|
#
|
@@ -899,6 +909,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
899
909
|
def fetch_time(self, params={}):
|
900
910
|
"""
|
901
911
|
fetches the current integer timestamp in milliseconds from the exchange server
|
912
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http005_system_time
|
902
913
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
903
914
|
:returns int: the current integer timestamp in milliseconds from the exchange server
|
904
915
|
"""
|
@@ -915,6 +926,8 @@ class coinex(Exchange, ImplicitAPI):
|
|
915
926
|
def fetch_order_book(self, symbol: str, limit=20, params={}):
|
916
927
|
"""
|
917
928
|
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
|
929
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market004_market_depth
|
930
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http010_market_depth
|
918
931
|
:param str symbol: unified symbol of the market to fetch the order book for
|
919
932
|
:param int [limit]: the maximum amount of order book entries to return
|
920
933
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -929,8 +942,11 @@ class coinex(Exchange, ImplicitAPI):
|
|
929
942
|
'merge': '0',
|
930
943
|
'limit': str(limit),
|
931
944
|
}
|
932
|
-
|
933
|
-
|
945
|
+
response = None
|
946
|
+
if market['swap']:
|
947
|
+
response = self.perpetualPublicGetMarketDepth(self.extend(request, params))
|
948
|
+
else:
|
949
|
+
response = self.publicGetMarketDepth(self.extend(request, params))
|
934
950
|
#
|
935
951
|
# Spot
|
936
952
|
#
|
@@ -1099,6 +1115,8 @@ class coinex(Exchange, ImplicitAPI):
|
|
1099
1115
|
def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
|
1100
1116
|
"""
|
1101
1117
|
get the list of most recent trades for a particular symbol
|
1118
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market005_market_deals
|
1119
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http011_market_deals
|
1102
1120
|
:param str symbol: unified symbol of the market to fetch trades for
|
1103
1121
|
:param int [since]: timestamp in ms of the earliest trade to fetch
|
1104
1122
|
:param int [limit]: the maximum amount of trades to fetch
|
@@ -1113,8 +1131,11 @@ class coinex(Exchange, ImplicitAPI):
|
|
1113
1131
|
}
|
1114
1132
|
if limit is not None:
|
1115
1133
|
request['limit'] = limit
|
1116
|
-
|
1117
|
-
|
1134
|
+
response = None
|
1135
|
+
if market['swap']:
|
1136
|
+
response = self.perpetualPublicGetMarketDeals(self.extend(request, params))
|
1137
|
+
else:
|
1138
|
+
response = self.publicGetMarketDeals(self.extend(request, params))
|
1118
1139
|
#
|
1119
1140
|
# Spot and Swap
|
1120
1141
|
#
|
@@ -1138,6 +1159,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
1138
1159
|
def fetch_trading_fee(self, symbol: str, params={}):
|
1139
1160
|
"""
|
1140
1161
|
fetch the trading fees for a market
|
1162
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market003_single_market_info
|
1141
1163
|
:param str symbol: unified market symbol
|
1142
1164
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1143
1165
|
:returns dict: a `fee structure <https://docs.ccxt.com/#/?id=fee-structure>`
|
@@ -1170,6 +1192,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
1170
1192
|
def fetch_trading_fees(self, params={}):
|
1171
1193
|
"""
|
1172
1194
|
fetch the trading fees for multiple markets
|
1195
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market002_all_market_info
|
1173
1196
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1174
1197
|
:returns dict: a dictionary of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>` indexed by market symbols
|
1175
1198
|
"""
|
@@ -1239,6 +1262,8 @@ class coinex(Exchange, ImplicitAPI):
|
|
1239
1262
|
def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
|
1240
1263
|
"""
|
1241
1264
|
fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
1265
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market006_market_kline
|
1266
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http012_market_kline
|
1242
1267
|
:param str symbol: unified symbol of the market to fetch OHLCV data for
|
1243
1268
|
:param str timeframe: the length of time each candle represents
|
1244
1269
|
:param int [since]: timestamp in ms of the earliest candle to fetch
|
@@ -1254,8 +1279,11 @@ class coinex(Exchange, ImplicitAPI):
|
|
1254
1279
|
}
|
1255
1280
|
if limit is not None:
|
1256
1281
|
request['limit'] = limit
|
1257
|
-
|
1258
|
-
|
1282
|
+
response = None
|
1283
|
+
if market['swap']:
|
1284
|
+
response = self.perpetualPublicGetMarketKline(self.extend(request, params))
|
1285
|
+
else:
|
1286
|
+
response = self.publicGetMarketKline(self.extend(request, params))
|
1259
1287
|
#
|
1260
1288
|
# Spot
|
1261
1289
|
#
|
@@ -2390,6 +2418,10 @@ class coinex(Exchange, ImplicitAPI):
|
|
2390
2418
|
def cancel_order(self, id: str, symbol: Str = None, params={}):
|
2391
2419
|
"""
|
2392
2420
|
cancels an open order
|
2421
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade018_cancle_stop_pending_order
|
2422
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade015_cancel_order
|
2423
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http023_cancel_stop_order
|
2424
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http021_cancel_order
|
2393
2425
|
:param str id: order id
|
2394
2426
|
:param str symbol: unified symbol of the market the order was made in
|
2395
2427
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -2406,12 +2438,6 @@ class coinex(Exchange, ImplicitAPI):
|
|
2406
2438
|
}
|
2407
2439
|
idRequest = 'order_id' if swap else 'id'
|
2408
2440
|
request[idRequest] = id
|
2409
|
-
method = 'perpetualPrivatePostOrderCancel' if swap else 'privateDeleteOrderPending'
|
2410
|
-
if stop:
|
2411
|
-
if swap:
|
2412
|
-
method = 'perpetualPrivatePostOrderCancelStop'
|
2413
|
-
else:
|
2414
|
-
method = 'privateDeleteOrderStopPendingId'
|
2415
2441
|
accountId = self.safe_integer(params, 'account_id')
|
2416
2442
|
defaultType = self.safe_string(self.options, 'defaultType')
|
2417
2443
|
if defaultType == 'margin':
|
@@ -2419,7 +2445,17 @@ class coinex(Exchange, ImplicitAPI):
|
|
2419
2445
|
raise BadRequest(self.id + ' cancelOrder() requires an account_id parameter for margin orders')
|
2420
2446
|
request['account_id'] = accountId
|
2421
2447
|
query = self.omit(params, ['stop', 'account_id'])
|
2422
|
-
response =
|
2448
|
+
response = None
|
2449
|
+
if stop:
|
2450
|
+
if swap:
|
2451
|
+
response = self.perpetualPrivatePostOrderCancelStop(self.extend(request, query))
|
2452
|
+
else:
|
2453
|
+
response = self.privateDeleteOrderStopPendingId(self.extend(request, query))
|
2454
|
+
else:
|
2455
|
+
if swap:
|
2456
|
+
response = self.perpetualPrivatePostOrderCancel(self.extend(request, query))
|
2457
|
+
else:
|
2458
|
+
response = self.privateDeleteOrderPending(self.extend(request, query))
|
2423
2459
|
#
|
2424
2460
|
# Spot and Margin
|
2425
2461
|
#
|
@@ -2532,6 +2568,10 @@ class coinex(Exchange, ImplicitAPI):
|
|
2532
2568
|
def cancel_all_orders(self, symbol: Str = None, params={}):
|
2533
2569
|
"""
|
2534
2570
|
cancel all open orders in a market
|
2571
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade018_cancle_stop_pending_order
|
2572
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade015_cancel_order
|
2573
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http024_cancel_stop_all
|
2574
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http022_cancel_all
|
2535
2575
|
:param str symbol: unified market symbol of the market to cancel orders in
|
2536
2576
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2537
2577
|
:returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
@@ -2549,18 +2589,19 @@ class coinex(Exchange, ImplicitAPI):
|
|
2549
2589
|
}
|
2550
2590
|
swap = market['swap']
|
2551
2591
|
stop = self.safe_value(params, 'stop')
|
2552
|
-
|
2592
|
+
params = self.omit(params, ['stop', 'account_id'])
|
2593
|
+
response = None
|
2553
2594
|
if swap:
|
2554
|
-
method = 'perpetualPrivatePostOrderCancelAll'
|
2555
2595
|
if stop:
|
2556
|
-
|
2596
|
+
response = self.perpetualPrivatePostOrderCancelStopAll(self.extend(request, params))
|
2597
|
+
else:
|
2598
|
+
response = self.perpetualPrivatePostOrderCancelAll(self.extend(request, params))
|
2557
2599
|
else:
|
2558
|
-
method = 'privateDeleteOrderPending'
|
2559
|
-
if stop:
|
2560
|
-
method = 'privateDeleteOrderStopPending'
|
2561
2600
|
request['account_id'] = accountId
|
2562
|
-
|
2563
|
-
|
2601
|
+
if stop:
|
2602
|
+
response = self.privateDeleteOrderStopPending(self.extend(request, params))
|
2603
|
+
else:
|
2604
|
+
response = self.privateDeleteOrderPending(self.extend(request, params))
|
2564
2605
|
#
|
2565
2606
|
# Spot and Margin
|
2566
2607
|
#
|
@@ -2575,6 +2616,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
2575
2616
|
def fetch_order(self, id: str, symbol: Str = None, params={}):
|
2576
2617
|
"""
|
2577
2618
|
fetches information on an order made by the user
|
2619
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http028_stop_status
|
2620
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http026_order_status
|
2621
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade007_order_status
|
2578
2622
|
:param str symbol: unified symbol of the market the order was made in
|
2579
2623
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2580
2624
|
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
@@ -2585,6 +2629,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
2585
2629
|
market = self.market(symbol)
|
2586
2630
|
swap = market['swap']
|
2587
2631
|
stop = self.safe_value(params, 'stop')
|
2632
|
+
params = self.omit(params, 'stop')
|
2588
2633
|
request = {
|
2589
2634
|
'market': market['id'],
|
2590
2635
|
# 'id': id, # SPOT
|
@@ -2592,13 +2637,14 @@ class coinex(Exchange, ImplicitAPI):
|
|
2592
2637
|
}
|
2593
2638
|
idRequest = 'order_id' if swap else 'id'
|
2594
2639
|
request[idRequest] = id
|
2595
|
-
|
2640
|
+
response = None
|
2596
2641
|
if swap:
|
2597
|
-
|
2642
|
+
if stop:
|
2643
|
+
response = self.perpetualPrivateGetOrderStopStatus(self.extend(request, params))
|
2644
|
+
else:
|
2645
|
+
response = self.perpetualPrivateGetOrderStatus(self.extend(request, params))
|
2598
2646
|
else:
|
2599
|
-
|
2600
|
-
params = self.omit(params, 'stop')
|
2601
|
-
response = getattr(self, method)(self.extend(request, params))
|
2647
|
+
response = self.privateGetOrderStatus(self.extend(request, params))
|
2602
2648
|
#
|
2603
2649
|
# Spot
|
2604
2650
|
#
|
@@ -2717,31 +2763,41 @@ class coinex(Exchange, ImplicitAPI):
|
|
2717
2763
|
market = self.market(symbol)
|
2718
2764
|
request['market'] = market['id']
|
2719
2765
|
marketType, query = self.handle_market_type_and_params('fetchOrdersByStatus', market, params)
|
2720
|
-
|
2766
|
+
accountId = self.safe_integer(params, 'account_id')
|
2767
|
+
defaultType = self.safe_string(self.options, 'defaultType')
|
2768
|
+
if defaultType == 'margin':
|
2769
|
+
if accountId is None:
|
2770
|
+
raise BadRequest(self.id + ' fetchOpenOrders() and fetchClosedOrders() require an account_id parameter for margin orders')
|
2771
|
+
request['account_id'] = accountId
|
2772
|
+
params = self.omit(query, 'account_id')
|
2773
|
+
response = None
|
2721
2774
|
if marketType == 'swap':
|
2722
2775
|
if symbol is None:
|
2723
2776
|
raise ArgumentsRequired(self.id + ' fetchOrdersByStatus() requires a symbol argument for swap markets')
|
2724
|
-
method = 'perpetualPrivateGetOrder' + self.capitalize(status)
|
2725
|
-
if stop:
|
2726
|
-
method = 'perpetualPrivateGetOrderStopPending'
|
2727
2777
|
if side is not None:
|
2728
2778
|
request['side'] = side
|
2729
2779
|
else:
|
2730
2780
|
request['side'] = 0
|
2731
2781
|
request['offset'] = 0
|
2732
|
-
else:
|
2733
|
-
method = 'privateGetOrder' + self.capitalize(status)
|
2734
2782
|
if stop:
|
2735
|
-
|
2783
|
+
response = self.perpetualPrivateGetOrderStopPending(self.extend(request, params))
|
2784
|
+
else:
|
2785
|
+
if status == 'finished':
|
2786
|
+
response = self.perpetualPrivateGetOrderFinished(self.extend(request, params))
|
2787
|
+
elif status == 'pending':
|
2788
|
+
response = self.perpetualPrivateGetOrderPending(self.extend(request, params))
|
2789
|
+
else:
|
2736
2790
|
request['page'] = 1
|
2737
|
-
|
2738
|
-
|
2739
|
-
|
2740
|
-
|
2741
|
-
|
2742
|
-
|
2743
|
-
|
2744
|
-
|
2791
|
+
if status == 'finished':
|
2792
|
+
if stop:
|
2793
|
+
response = self.privateGetOrderStopFinished(self.extend(request, params))
|
2794
|
+
else:
|
2795
|
+
response = self.privateGetOrderFinished(self.extend(request, params))
|
2796
|
+
elif status == 'pending':
|
2797
|
+
if stop:
|
2798
|
+
response = self.privateGetOrderStopPending(self.extend(request, params))
|
2799
|
+
else:
|
2800
|
+
response = self.privateGetOrderPending(self.extend(request, params))
|
2745
2801
|
#
|
2746
2802
|
# Spot and Margin
|
2747
2803
|
#
|
@@ -2900,6 +2956,10 @@ class coinex(Exchange, ImplicitAPI):
|
|
2900
2956
|
def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
2901
2957
|
"""
|
2902
2958
|
fetch all unfilled currently open orders
|
2959
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http027_query_pending_stop
|
2960
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http025_query_pending
|
2961
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade013_stop_pending_order
|
2962
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade011_pending_order
|
2903
2963
|
:param str symbol: unified market symbol
|
2904
2964
|
:param int [since]: the earliest time in ms to fetch open orders for
|
2905
2965
|
:param int [limit]: the maximum number of open orders structures to retrieve
|
@@ -2911,6 +2971,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
2911
2971
|
def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
2912
2972
|
"""
|
2913
2973
|
fetches information on multiple closed orders made by the user
|
2974
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http029_query_finished
|
2975
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade010_stop_finished_order
|
2976
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade012_finished_order
|
2914
2977
|
:param str symbol: unified market symbol of the market orders were made in
|
2915
2978
|
:param int [since]: the earliest time in ms to fetch orders for
|
2916
2979
|
:param int [limit]: the maximum number of orde structures to retrieve
|
@@ -2922,6 +2985,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
2922
2985
|
def create_deposit_address(self, code: str, params={}):
|
2923
2986
|
"""
|
2924
2987
|
create a currency deposit address
|
2988
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account019_update_deposit_address
|
2925
2989
|
:param str code: unified currency code of the currency for the deposit address
|
2926
2990
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2927
2991
|
:returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
|
@@ -2951,6 +3015,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
2951
3015
|
def fetch_deposit_address(self, code: str, params={}):
|
2952
3016
|
"""
|
2953
3017
|
fetch the deposit address for a currency associated with self account
|
3018
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account020_query_deposit_address
|
2954
3019
|
:param str code: unified currency code
|
2955
3020
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2956
3021
|
:returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
|
@@ -3035,6 +3100,8 @@ class coinex(Exchange, ImplicitAPI):
|
|
3035
3100
|
def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
3036
3101
|
"""
|
3037
3102
|
fetch all trades made by the user
|
3103
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http013_user_deals
|
3104
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade014_user_deals
|
3038
3105
|
:param str symbol: unified market symbol
|
3039
3106
|
:param int [since]: the earliest time in ms to fetch trades for
|
3040
3107
|
:param int [limit]: the maximum number of trades structures to retrieve
|
@@ -3061,9 +3128,15 @@ class coinex(Exchange, ImplicitAPI):
|
|
3061
3128
|
if type != 'spot' and symbol is None:
|
3062
3129
|
raise ArgumentsRequired(self.id + ' fetchMyTrades() requires a symbol argument for non-spot markets')
|
3063
3130
|
swap = (type == 'swap')
|
3064
|
-
|
3131
|
+
accountId = self.safe_integer(params, 'account_id')
|
3132
|
+
defaultType = self.safe_string(self.options, 'defaultType')
|
3133
|
+
if defaultType == 'margin':
|
3134
|
+
if accountId is None:
|
3135
|
+
raise BadRequest(self.id + ' fetchMyTrades() requires an account_id parameter for margin trades')
|
3136
|
+
request['account_id'] = accountId
|
3137
|
+
params = self.omit(params, 'account_id')
|
3138
|
+
response = None
|
3065
3139
|
if swap:
|
3066
|
-
method = 'perpetualPublicGetMarketUserDeals'
|
3067
3140
|
side = self.safe_integer(params, 'side')
|
3068
3141
|
if side is None:
|
3069
3142
|
raise ArgumentsRequired(self.id + ' fetchMyTrades() requires a side parameter for swap markets')
|
@@ -3071,17 +3144,10 @@ class coinex(Exchange, ImplicitAPI):
|
|
3071
3144
|
request['start_time'] = since
|
3072
3145
|
request['side'] = side
|
3073
3146
|
params = self.omit(params, 'side')
|
3147
|
+
response = self.perpetualPublicGetMarketUserDeals(self.extend(request, params))
|
3074
3148
|
else:
|
3075
|
-
method = 'privateGetOrderUserDeals'
|
3076
3149
|
request['page'] = 1
|
3077
|
-
|
3078
|
-
defaultType = self.safe_string(self.options, 'defaultType')
|
3079
|
-
if defaultType == 'margin':
|
3080
|
-
if accountId is None:
|
3081
|
-
raise BadRequest(self.id + ' fetchMyTrades() requires an account_id parameter for margin trades')
|
3082
|
-
request['account_id'] = accountId
|
3083
|
-
params = self.omit(params, 'account_id')
|
3084
|
-
response = getattr(self, method)(self.extend(request, params))
|
3150
|
+
response = self.privateGetOrderUserDeals(self.extend(request, params))
|
3085
3151
|
#
|
3086
3152
|
# Spot and Margin
|
3087
3153
|
#
|
@@ -3162,6 +3228,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
3162
3228
|
def fetch_positions(self, symbols: Strings = None, params={}):
|
3163
3229
|
"""
|
3164
3230
|
fetch all open positions
|
3231
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http033_pending_position
|
3165
3232
|
:param str[]|None symbols: list of unified market symbols
|
3166
3233
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3167
3234
|
:returns dict[]: a list of `position structure <https://docs.ccxt.com/#/?id=position-structure>`
|
@@ -3250,6 +3317,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
3250
3317
|
def fetch_position(self, symbol: str, params={}):
|
3251
3318
|
"""
|
3252
3319
|
fetch data on a single open contract trade position
|
3320
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http033_pending_position
|
3253
3321
|
:param str symbol: unified market symbol of the market the position is held in, default is None
|
3254
3322
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3255
3323
|
:returns dict: a `position structure <https://docs.ccxt.com/#/?id=position-structure>`
|
@@ -3430,6 +3498,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
3430
3498
|
def set_margin_mode(self, marginMode, symbol: Str = None, params={}):
|
3431
3499
|
"""
|
3432
3500
|
set margin mode to 'cross' or 'isolated'
|
3501
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http014_adjust_leverage
|
3433
3502
|
:param str marginMode: 'cross' or 'isolated'
|
3434
3503
|
:param str symbol: unified market symbol
|
3435
3504
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -3502,6 +3571,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
3502
3571
|
def fetch_leverage_tiers(self, symbols: Strings = None, params={}):
|
3503
3572
|
"""
|
3504
3573
|
retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
|
3574
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http007_market_limit
|
3505
3575
|
:param str[]|None symbols: list of unified market symbols
|
3506
3576
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3507
3577
|
:returns dict: a dictionary of `leverage tiers structures <https://docs.ccxt.com/#/?id=leverage-tiers-structure>`, indexed by market symbols
|
@@ -3660,6 +3730,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
3660
3730
|
def add_margin(self, symbol: str, amount, params={}):
|
3661
3731
|
"""
|
3662
3732
|
add margin
|
3733
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http032_adjust_position_margin
|
3663
3734
|
:param str symbol: unified market symbol
|
3664
3735
|
:param float amount: amount of margin to add
|
3665
3736
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -3670,6 +3741,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
3670
3741
|
def reduce_margin(self, symbol: str, amount, params={}):
|
3671
3742
|
"""
|
3672
3743
|
remove margin from a position
|
3744
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http032_adjust_position_margin
|
3673
3745
|
:param str symbol: unified market symbol
|
3674
3746
|
:param float amount: the amount of margin to remove
|
3675
3747
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -3680,6 +3752,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
3680
3752
|
def fetch_funding_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
3681
3753
|
"""
|
3682
3754
|
fetch the history of funding payments paid and received on self account
|
3755
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http034_funding_position
|
3683
3756
|
:param str symbol: unified market symbol
|
3684
3757
|
:param int [since]: the earliest time in ms to fetch funding history for
|
3685
3758
|
:param int [limit]: the maximum number of funding history structures to retrieve
|
@@ -3750,6 +3823,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
3750
3823
|
def fetch_funding_rate(self, symbol: str, params={}):
|
3751
3824
|
"""
|
3752
3825
|
fetch the current funding rate
|
3826
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http008_market_ticker
|
3753
3827
|
:param str symbol: unified market symbol
|
3754
3828
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3755
3829
|
:returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
@@ -3856,6 +3930,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
3856
3930
|
"""
|
3857
3931
|
* @method
|
3858
3932
|
fetch the current funding rates
|
3933
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http009_market_ticker_all
|
3859
3934
|
:param str[] symbols: unified market symbols
|
3860
3935
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3861
3936
|
:returns dict[]: an array of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
@@ -4159,6 +4234,8 @@ class coinex(Exchange, ImplicitAPI):
|
|
4159
4234
|
def transfer(self, code: str, amount, fromAccount, toAccount, params={}):
|
4160
4235
|
"""
|
4161
4236
|
transfer currency internally between wallets on the same account
|
4237
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account014_balance_contract_transfer
|
4238
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account013_margin_transfer
|
4162
4239
|
:param str code: unified currency code
|
4163
4240
|
:param float amount: amount to transfer
|
4164
4241
|
:param str fromAccount: account to transfer from
|
@@ -4173,11 +4250,13 @@ class coinex(Exchange, ImplicitAPI):
|
|
4173
4250
|
'amount': amountToPrecision,
|
4174
4251
|
'coin_type': currency['id'],
|
4175
4252
|
}
|
4176
|
-
|
4253
|
+
response = None
|
4177
4254
|
if (fromAccount == 'spot') and (toAccount == 'swap'):
|
4178
4255
|
request['transfer_side'] = 'in' # 'in' spot to swap, 'out' swap to spot
|
4256
|
+
response = self.privatePostContractBalanceTransfer(self.extend(request, params))
|
4179
4257
|
elif (fromAccount == 'swap') and (toAccount == 'spot'):
|
4180
4258
|
request['transfer_side'] = 'out' # 'in' spot to swap, 'out' swap to spot
|
4259
|
+
response = self.privatePostContractBalanceTransfer(self.extend(request, params))
|
4181
4260
|
else:
|
4182
4261
|
accountsById = self.safe_value(self.options, 'accountsById', {})
|
4183
4262
|
fromId = self.safe_string(accountsById, fromAccount, fromAccount)
|
@@ -4186,8 +4265,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
4186
4265
|
# spot is 0, use fetchBalance() to find the margin account id
|
4187
4266
|
request['from_account'] = int(fromId)
|
4188
4267
|
request['to_account'] = int(toId)
|
4189
|
-
|
4190
|
-
response = getattr(self, method)(self.extend(request, params))
|
4268
|
+
response = self.privatePostMarginTransfer(self.extend(request, params))
|
4191
4269
|
#
|
4192
4270
|
# {"code": 0, "data": null, "message": "Success"}
|
4193
4271
|
#
|
@@ -4263,6 +4341,8 @@ class coinex(Exchange, ImplicitAPI):
|
|
4263
4341
|
def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
4264
4342
|
"""
|
4265
4343
|
fetch a history of internal transfers made on an account
|
4344
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account025_margin_transfer_history
|
4345
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account024_contract_transfer_history
|
4266
4346
|
:param str code: unified currency code of the currency transferred
|
4267
4347
|
:param int [since]: the earliest time in ms to fetch transfers for
|
4268
4348
|
:param int [limit]: the maximum number of transfers structures to retrieve
|
@@ -4273,7 +4353,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
4273
4353
|
currency = None
|
4274
4354
|
request = {
|
4275
4355
|
'page': 1,
|
4276
|
-
'limit': limit,
|
4356
|
+
# 'limit': limit,
|
4277
4357
|
# 'asset': 'USDT',
|
4278
4358
|
# 'start_time': since,
|
4279
4359
|
# 'end_time': 1515806440,
|
@@ -4283,14 +4363,21 @@ class coinex(Exchange, ImplicitAPI):
|
|
4283
4363
|
if page is not None:
|
4284
4364
|
request['page'] = page
|
4285
4365
|
if code is not None:
|
4286
|
-
currency = self.
|
4366
|
+
currency = self.currency(code)
|
4287
4367
|
request['asset'] = currency['id']
|
4288
4368
|
if since is not None:
|
4289
4369
|
request['start_time'] = since
|
4370
|
+
if limit is not None:
|
4371
|
+
request['limit'] = limit
|
4372
|
+
else:
|
4373
|
+
request['limit'] = 100
|
4290
4374
|
params = self.omit(params, 'page')
|
4291
4375
|
defaultType = self.safe_string(self.options, 'defaultType')
|
4292
|
-
|
4293
|
-
|
4376
|
+
response = None
|
4377
|
+
if defaultType == 'margin':
|
4378
|
+
response = self.privateGetMarginTransferHistory(self.extend(request, params))
|
4379
|
+
else:
|
4380
|
+
response = self.privateGetContractTransferHistory(self.extend(request, params))
|
4294
4381
|
#
|
4295
4382
|
# Swap
|
4296
4383
|
#
|
@@ -4342,6 +4429,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
4342
4429
|
def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
|
4343
4430
|
"""
|
4344
4431
|
fetch all withdrawals made from an account
|
4432
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account026_withdraw_list
|
4345
4433
|
:param str code: unified currency code
|
4346
4434
|
:param int [since]: the earliest time in ms to fetch withdrawals for
|
4347
4435
|
:param int [limit]: the maximum number of withdrawals structures to retrieve
|
@@ -4403,6 +4491,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
4403
4491
|
def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
|
4404
4492
|
"""
|
4405
4493
|
fetch all deposits made to an account
|
4494
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account009_deposit_list
|
4406
4495
|
:param str code: unified currency code
|
4407
4496
|
:param int [since]: the earliest time in ms to fetch deposits for
|
4408
4497
|
:param int [limit]: the maximum number of deposits structures to retrieve
|
@@ -4497,6 +4586,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
4497
4586
|
def fetch_isolated_borrow_rate(self, symbol: str, params={}):
|
4498
4587
|
"""
|
4499
4588
|
fetch the rate of interest to borrow a currency for margin trading
|
4589
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account007_margin_account_settings
|
4500
4590
|
:param str symbol: unified symbol of the market to fetch the borrow rate for
|
4501
4591
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
4502
4592
|
:returns dict: an `isolated borrow rate structure <https://docs.ccxt.com/#/?id=isolated-borrow-rate-structure>`
|
@@ -4533,6 +4623,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
4533
4623
|
def fetch_isolated_borrow_rates(self, params={}):
|
4534
4624
|
"""
|
4535
4625
|
fetch the borrow interest rates of all currencies
|
4626
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account007_margin_account_settings
|
4536
4627
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
4537
4628
|
:returns dict: a list of `isolated borrow rate structures <https://github.com/ccxt/ccxt/wiki/Manual#isolated-borrow-rate-structure>`
|
4538
4629
|
"""
|
ccxt/cryptocom.py
CHANGED
@@ -48,6 +48,8 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
48
48
|
'cancelAllOrders': True,
|
49
49
|
'cancelOrder': True,
|
50
50
|
'cancelOrders': True,
|
51
|
+
'closeAllPositions': False,
|
52
|
+
'closePosition': True,
|
51
53
|
'createOrder': True,
|
52
54
|
'createOrders': True,
|
53
55
|
'fetchAccounts': True,
|
@@ -2683,6 +2685,47 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
2683
2685
|
returnString += str(value)
|
2684
2686
|
return returnString
|
2685
2687
|
|
2688
|
+
def close_position(self, symbol: str, side: OrderSide = None, params={}) -> Order:
|
2689
|
+
"""
|
2690
|
+
closes open positions for a market
|
2691
|
+
:see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-close-position
|
2692
|
+
:param str symbol: Unified CCXT market symbol
|
2693
|
+
:param str [marginMode]: not used by cryptocom.closePositions
|
2694
|
+
:param str [side]: not used by cryptocom.closePositions
|
2695
|
+
:param dict [params]: extra parameters specific to the okx api endpoint
|
2696
|
+
*
|
2697
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
2698
|
+
:param str [params.type]: LIMIT or MARKET
|
2699
|
+
:param number [params.price]: for limit orders only
|
2700
|
+
:returns dict[]: `A list of position structures <https://docs.ccxt.com/#/?id=position-structure>`
|
2701
|
+
"""
|
2702
|
+
self.load_markets()
|
2703
|
+
market = self.market(symbol)
|
2704
|
+
request = {
|
2705
|
+
'instrument_name': market['id'],
|
2706
|
+
'type': 'MARKET',
|
2707
|
+
}
|
2708
|
+
type = self.safe_string_upper(params, 'type')
|
2709
|
+
price = self.safe_string(params, 'price')
|
2710
|
+
if type is not None:
|
2711
|
+
request['type'] = type
|
2712
|
+
if price is not None:
|
2713
|
+
request['price'] = self.price_to_precision(market['symbol'], price)
|
2714
|
+
response = self.v1PrivatePostPrivateClosePosition(self.extend(request, params))
|
2715
|
+
#
|
2716
|
+
# {
|
2717
|
+
# "id" : 1700830813298,
|
2718
|
+
# "method" : "private/close-position",
|
2719
|
+
# "code" : 0,
|
2720
|
+
# "result" : {
|
2721
|
+
# "client_oid" : "179a909d-5614-655b-0d0e-9e85c9a25c85",
|
2722
|
+
# "order_id" : "6142909897021751347"
|
2723
|
+
# }
|
2724
|
+
# }
|
2725
|
+
#
|
2726
|
+
result = self.safe_value(response, 'result')
|
2727
|
+
return self.parse_order(result, market)
|
2728
|
+
|
2686
2729
|
def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
|
2687
2730
|
type = self.safe_string(api, 0)
|
2688
2731
|
access = self.safe_string(api, 1)
|