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/async_support/coinex.py
CHANGED
@@ -471,6 +471,8 @@ class coinex(Exchange, ImplicitAPI):
|
|
471
471
|
async def fetch_markets(self, params={}):
|
472
472
|
"""
|
473
473
|
retrieves data on all markets for coinex
|
474
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market002_all_market_info
|
475
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http006_market_list
|
474
476
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
475
477
|
:returns dict[]: an array of objects representing market data
|
476
478
|
"""
|
@@ -737,6 +739,8 @@ class coinex(Exchange, ImplicitAPI):
|
|
737
739
|
async def fetch_ticker(self, symbol: str, params={}) -> Ticker:
|
738
740
|
"""
|
739
741
|
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
742
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market007_single_market_ticker
|
743
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http008_market_ticker
|
740
744
|
:param str symbol: unified symbol of the market to fetch the ticker for
|
741
745
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
742
746
|
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
|
@@ -746,8 +750,11 @@ class coinex(Exchange, ImplicitAPI):
|
|
746
750
|
request = {
|
747
751
|
'market': market['id'],
|
748
752
|
}
|
749
|
-
|
750
|
-
|
753
|
+
response = None
|
754
|
+
if market['swap']:
|
755
|
+
response = await self.perpetualPublicGetMarketTicker(self.extend(request, params))
|
756
|
+
else:
|
757
|
+
response = await self.publicGetMarketTicker(self.extend(request, params))
|
751
758
|
#
|
752
759
|
# Spot
|
753
760
|
#
|
@@ -815,13 +822,16 @@ class coinex(Exchange, ImplicitAPI):
|
|
815
822
|
"""
|
816
823
|
await self.load_markets()
|
817
824
|
symbols = self.market_symbols(symbols)
|
818
|
-
market
|
825
|
+
market = None
|
819
826
|
if symbols is not None:
|
820
827
|
symbol = self.safe_value(symbols, 0)
|
821
828
|
market = self.market(symbol)
|
822
829
|
marketType, query = self.handle_market_type_and_params('fetchTickers', market, params)
|
823
|
-
|
824
|
-
|
830
|
+
response = None
|
831
|
+
if marketType == 'swap':
|
832
|
+
response = await self.perpetualPublicGetMarketTickerAll(query)
|
833
|
+
else:
|
834
|
+
response = await self.publicGetMarketTickerAll()
|
825
835
|
#
|
826
836
|
# Spot
|
827
837
|
#
|
@@ -900,6 +910,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
900
910
|
async def fetch_time(self, params={}):
|
901
911
|
"""
|
902
912
|
fetches the current integer timestamp in milliseconds from the exchange server
|
913
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http005_system_time
|
903
914
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
904
915
|
:returns int: the current integer timestamp in milliseconds from the exchange server
|
905
916
|
"""
|
@@ -916,6 +927,8 @@ class coinex(Exchange, ImplicitAPI):
|
|
916
927
|
async def fetch_order_book(self, symbol: str, limit=20, params={}):
|
917
928
|
"""
|
918
929
|
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
|
930
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market004_market_depth
|
931
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http010_market_depth
|
919
932
|
:param str symbol: unified symbol of the market to fetch the order book for
|
920
933
|
:param int [limit]: the maximum amount of order book entries to return
|
921
934
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -930,8 +943,11 @@ class coinex(Exchange, ImplicitAPI):
|
|
930
943
|
'merge': '0',
|
931
944
|
'limit': str(limit),
|
932
945
|
}
|
933
|
-
|
934
|
-
|
946
|
+
response = None
|
947
|
+
if market['swap']:
|
948
|
+
response = await self.perpetualPublicGetMarketDepth(self.extend(request, params))
|
949
|
+
else:
|
950
|
+
response = await self.publicGetMarketDepth(self.extend(request, params))
|
935
951
|
#
|
936
952
|
# Spot
|
937
953
|
#
|
@@ -1100,6 +1116,8 @@ class coinex(Exchange, ImplicitAPI):
|
|
1100
1116
|
async def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
|
1101
1117
|
"""
|
1102
1118
|
get the list of most recent trades for a particular symbol
|
1119
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market005_market_deals
|
1120
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http011_market_deals
|
1103
1121
|
:param str symbol: unified symbol of the market to fetch trades for
|
1104
1122
|
:param int [since]: timestamp in ms of the earliest trade to fetch
|
1105
1123
|
:param int [limit]: the maximum amount of trades to fetch
|
@@ -1114,8 +1132,11 @@ class coinex(Exchange, ImplicitAPI):
|
|
1114
1132
|
}
|
1115
1133
|
if limit is not None:
|
1116
1134
|
request['limit'] = limit
|
1117
|
-
|
1118
|
-
|
1135
|
+
response = None
|
1136
|
+
if market['swap']:
|
1137
|
+
response = await self.perpetualPublicGetMarketDeals(self.extend(request, params))
|
1138
|
+
else:
|
1139
|
+
response = await self.publicGetMarketDeals(self.extend(request, params))
|
1119
1140
|
#
|
1120
1141
|
# Spot and Swap
|
1121
1142
|
#
|
@@ -1139,6 +1160,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
1139
1160
|
async def fetch_trading_fee(self, symbol: str, params={}):
|
1140
1161
|
"""
|
1141
1162
|
fetch the trading fees for a market
|
1163
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market003_single_market_info
|
1142
1164
|
:param str symbol: unified market symbol
|
1143
1165
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1144
1166
|
:returns dict: a `fee structure <https://docs.ccxt.com/#/?id=fee-structure>`
|
@@ -1171,6 +1193,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
1171
1193
|
async def fetch_trading_fees(self, params={}):
|
1172
1194
|
"""
|
1173
1195
|
fetch the trading fees for multiple markets
|
1196
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market002_all_market_info
|
1174
1197
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1175
1198
|
:returns dict: a dictionary of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>` indexed by market symbols
|
1176
1199
|
"""
|
@@ -1240,6 +1263,8 @@ class coinex(Exchange, ImplicitAPI):
|
|
1240
1263
|
async def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
|
1241
1264
|
"""
|
1242
1265
|
fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
1266
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market006_market_kline
|
1267
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http012_market_kline
|
1243
1268
|
:param str symbol: unified symbol of the market to fetch OHLCV data for
|
1244
1269
|
:param str timeframe: the length of time each candle represents
|
1245
1270
|
:param int [since]: timestamp in ms of the earliest candle to fetch
|
@@ -1255,8 +1280,11 @@ class coinex(Exchange, ImplicitAPI):
|
|
1255
1280
|
}
|
1256
1281
|
if limit is not None:
|
1257
1282
|
request['limit'] = limit
|
1258
|
-
|
1259
|
-
|
1283
|
+
response = None
|
1284
|
+
if market['swap']:
|
1285
|
+
response = await self.perpetualPublicGetMarketKline(self.extend(request, params))
|
1286
|
+
else:
|
1287
|
+
response = await self.publicGetMarketKline(self.extend(request, params))
|
1260
1288
|
#
|
1261
1289
|
# Spot
|
1262
1290
|
#
|
@@ -2391,6 +2419,10 @@ class coinex(Exchange, ImplicitAPI):
|
|
2391
2419
|
async def cancel_order(self, id: str, symbol: Str = None, params={}):
|
2392
2420
|
"""
|
2393
2421
|
cancels an open order
|
2422
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade018_cancle_stop_pending_order
|
2423
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade015_cancel_order
|
2424
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http023_cancel_stop_order
|
2425
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http021_cancel_order
|
2394
2426
|
:param str id: order id
|
2395
2427
|
:param str symbol: unified symbol of the market the order was made in
|
2396
2428
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -2407,12 +2439,6 @@ class coinex(Exchange, ImplicitAPI):
|
|
2407
2439
|
}
|
2408
2440
|
idRequest = 'order_id' if swap else 'id'
|
2409
2441
|
request[idRequest] = id
|
2410
|
-
method = 'perpetualPrivatePostOrderCancel' if swap else 'privateDeleteOrderPending'
|
2411
|
-
if stop:
|
2412
|
-
if swap:
|
2413
|
-
method = 'perpetualPrivatePostOrderCancelStop'
|
2414
|
-
else:
|
2415
|
-
method = 'privateDeleteOrderStopPendingId'
|
2416
2442
|
accountId = self.safe_integer(params, 'account_id')
|
2417
2443
|
defaultType = self.safe_string(self.options, 'defaultType')
|
2418
2444
|
if defaultType == 'margin':
|
@@ -2420,7 +2446,17 @@ class coinex(Exchange, ImplicitAPI):
|
|
2420
2446
|
raise BadRequest(self.id + ' cancelOrder() requires an account_id parameter for margin orders')
|
2421
2447
|
request['account_id'] = accountId
|
2422
2448
|
query = self.omit(params, ['stop', 'account_id'])
|
2423
|
-
response =
|
2449
|
+
response = None
|
2450
|
+
if stop:
|
2451
|
+
if swap:
|
2452
|
+
response = await self.perpetualPrivatePostOrderCancelStop(self.extend(request, query))
|
2453
|
+
else:
|
2454
|
+
response = await self.privateDeleteOrderStopPendingId(self.extend(request, query))
|
2455
|
+
else:
|
2456
|
+
if swap:
|
2457
|
+
response = await self.perpetualPrivatePostOrderCancel(self.extend(request, query))
|
2458
|
+
else:
|
2459
|
+
response = await self.privateDeleteOrderPending(self.extend(request, query))
|
2424
2460
|
#
|
2425
2461
|
# Spot and Margin
|
2426
2462
|
#
|
@@ -2533,6 +2569,10 @@ class coinex(Exchange, ImplicitAPI):
|
|
2533
2569
|
async def cancel_all_orders(self, symbol: Str = None, params={}):
|
2534
2570
|
"""
|
2535
2571
|
cancel all open orders in a market
|
2572
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade018_cancle_stop_pending_order
|
2573
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade015_cancel_order
|
2574
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http024_cancel_stop_all
|
2575
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http022_cancel_all
|
2536
2576
|
:param str symbol: unified market symbol of the market to cancel orders in
|
2537
2577
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2538
2578
|
:returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
@@ -2550,18 +2590,19 @@ class coinex(Exchange, ImplicitAPI):
|
|
2550
2590
|
}
|
2551
2591
|
swap = market['swap']
|
2552
2592
|
stop = self.safe_value(params, 'stop')
|
2553
|
-
|
2593
|
+
params = self.omit(params, ['stop', 'account_id'])
|
2594
|
+
response = None
|
2554
2595
|
if swap:
|
2555
|
-
method = 'perpetualPrivatePostOrderCancelAll'
|
2556
2596
|
if stop:
|
2557
|
-
|
2597
|
+
response = await self.perpetualPrivatePostOrderCancelStopAll(self.extend(request, params))
|
2598
|
+
else:
|
2599
|
+
response = await self.perpetualPrivatePostOrderCancelAll(self.extend(request, params))
|
2558
2600
|
else:
|
2559
|
-
method = 'privateDeleteOrderPending'
|
2560
|
-
if stop:
|
2561
|
-
method = 'privateDeleteOrderStopPending'
|
2562
2601
|
request['account_id'] = accountId
|
2563
|
-
|
2564
|
-
|
2602
|
+
if stop:
|
2603
|
+
response = await self.privateDeleteOrderStopPending(self.extend(request, params))
|
2604
|
+
else:
|
2605
|
+
response = await self.privateDeleteOrderPending(self.extend(request, params))
|
2565
2606
|
#
|
2566
2607
|
# Spot and Margin
|
2567
2608
|
#
|
@@ -2576,6 +2617,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
2576
2617
|
async def fetch_order(self, id: str, symbol: Str = None, params={}):
|
2577
2618
|
"""
|
2578
2619
|
fetches information on an order made by the user
|
2620
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http028_stop_status
|
2621
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http026_order_status
|
2622
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade007_order_status
|
2579
2623
|
:param str symbol: unified symbol of the market the order was made in
|
2580
2624
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2581
2625
|
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
@@ -2586,6 +2630,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
2586
2630
|
market = self.market(symbol)
|
2587
2631
|
swap = market['swap']
|
2588
2632
|
stop = self.safe_value(params, 'stop')
|
2633
|
+
params = self.omit(params, 'stop')
|
2589
2634
|
request = {
|
2590
2635
|
'market': market['id'],
|
2591
2636
|
# 'id': id, # SPOT
|
@@ -2593,13 +2638,14 @@ class coinex(Exchange, ImplicitAPI):
|
|
2593
2638
|
}
|
2594
2639
|
idRequest = 'order_id' if swap else 'id'
|
2595
2640
|
request[idRequest] = id
|
2596
|
-
|
2641
|
+
response = None
|
2597
2642
|
if swap:
|
2598
|
-
|
2643
|
+
if stop:
|
2644
|
+
response = await self.perpetualPrivateGetOrderStopStatus(self.extend(request, params))
|
2645
|
+
else:
|
2646
|
+
response = await self.perpetualPrivateGetOrderStatus(self.extend(request, params))
|
2599
2647
|
else:
|
2600
|
-
|
2601
|
-
params = self.omit(params, 'stop')
|
2602
|
-
response = await getattr(self, method)(self.extend(request, params))
|
2648
|
+
response = await self.privateGetOrderStatus(self.extend(request, params))
|
2603
2649
|
#
|
2604
2650
|
# Spot
|
2605
2651
|
#
|
@@ -2718,31 +2764,41 @@ class coinex(Exchange, ImplicitAPI):
|
|
2718
2764
|
market = self.market(symbol)
|
2719
2765
|
request['market'] = market['id']
|
2720
2766
|
marketType, query = self.handle_market_type_and_params('fetchOrdersByStatus', market, params)
|
2721
|
-
|
2767
|
+
accountId = self.safe_integer(params, 'account_id')
|
2768
|
+
defaultType = self.safe_string(self.options, 'defaultType')
|
2769
|
+
if defaultType == 'margin':
|
2770
|
+
if accountId is None:
|
2771
|
+
raise BadRequest(self.id + ' fetchOpenOrders() and fetchClosedOrders() require an account_id parameter for margin orders')
|
2772
|
+
request['account_id'] = accountId
|
2773
|
+
params = self.omit(query, 'account_id')
|
2774
|
+
response = None
|
2722
2775
|
if marketType == 'swap':
|
2723
2776
|
if symbol is None:
|
2724
2777
|
raise ArgumentsRequired(self.id + ' fetchOrdersByStatus() requires a symbol argument for swap markets')
|
2725
|
-
method = 'perpetualPrivateGetOrder' + self.capitalize(status)
|
2726
|
-
if stop:
|
2727
|
-
method = 'perpetualPrivateGetOrderStopPending'
|
2728
2778
|
if side is not None:
|
2729
2779
|
request['side'] = side
|
2730
2780
|
else:
|
2731
2781
|
request['side'] = 0
|
2732
2782
|
request['offset'] = 0
|
2733
|
-
else:
|
2734
|
-
method = 'privateGetOrder' + self.capitalize(status)
|
2735
2783
|
if stop:
|
2736
|
-
|
2784
|
+
response = await self.perpetualPrivateGetOrderStopPending(self.extend(request, params))
|
2785
|
+
else:
|
2786
|
+
if status == 'finished':
|
2787
|
+
response = await self.perpetualPrivateGetOrderFinished(self.extend(request, params))
|
2788
|
+
elif status == 'pending':
|
2789
|
+
response = await self.perpetualPrivateGetOrderPending(self.extend(request, params))
|
2790
|
+
else:
|
2737
2791
|
request['page'] = 1
|
2738
|
-
|
2739
|
-
|
2740
|
-
|
2741
|
-
|
2742
|
-
|
2743
|
-
|
2744
|
-
|
2745
|
-
|
2792
|
+
if status == 'finished':
|
2793
|
+
if stop:
|
2794
|
+
response = await self.privateGetOrderStopFinished(self.extend(request, params))
|
2795
|
+
else:
|
2796
|
+
response = await self.privateGetOrderFinished(self.extend(request, params))
|
2797
|
+
elif status == 'pending':
|
2798
|
+
if stop:
|
2799
|
+
response = await self.privateGetOrderStopPending(self.extend(request, params))
|
2800
|
+
else:
|
2801
|
+
response = await self.privateGetOrderPending(self.extend(request, params))
|
2746
2802
|
#
|
2747
2803
|
# Spot and Margin
|
2748
2804
|
#
|
@@ -2901,6 +2957,10 @@ class coinex(Exchange, ImplicitAPI):
|
|
2901
2957
|
async def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
2902
2958
|
"""
|
2903
2959
|
fetch all unfilled currently open orders
|
2960
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http027_query_pending_stop
|
2961
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http025_query_pending
|
2962
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade013_stop_pending_order
|
2963
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade011_pending_order
|
2904
2964
|
:param str symbol: unified market symbol
|
2905
2965
|
:param int [since]: the earliest time in ms to fetch open orders for
|
2906
2966
|
:param int [limit]: the maximum number of open orders structures to retrieve
|
@@ -2912,6 +2972,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
2912
2972
|
async def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
2913
2973
|
"""
|
2914
2974
|
fetches information on multiple closed orders made by the user
|
2975
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http029_query_finished
|
2976
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade010_stop_finished_order
|
2977
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade012_finished_order
|
2915
2978
|
:param str symbol: unified market symbol of the market orders were made in
|
2916
2979
|
:param int [since]: the earliest time in ms to fetch orders for
|
2917
2980
|
:param int [limit]: the maximum number of orde structures to retrieve
|
@@ -2923,6 +2986,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
2923
2986
|
async def create_deposit_address(self, code: str, params={}):
|
2924
2987
|
"""
|
2925
2988
|
create a currency deposit address
|
2989
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account019_update_deposit_address
|
2926
2990
|
:param str code: unified currency code of the currency for the deposit address
|
2927
2991
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2928
2992
|
:returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
|
@@ -2952,6 +3016,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
2952
3016
|
async def fetch_deposit_address(self, code: str, params={}):
|
2953
3017
|
"""
|
2954
3018
|
fetch the deposit address for a currency associated with self account
|
3019
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account020_query_deposit_address
|
2955
3020
|
:param str code: unified currency code
|
2956
3021
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2957
3022
|
:returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
|
@@ -3036,6 +3101,8 @@ class coinex(Exchange, ImplicitAPI):
|
|
3036
3101
|
async def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
3037
3102
|
"""
|
3038
3103
|
fetch all trades made by the user
|
3104
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http013_user_deals
|
3105
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade014_user_deals
|
3039
3106
|
:param str symbol: unified market symbol
|
3040
3107
|
:param int [since]: the earliest time in ms to fetch trades for
|
3041
3108
|
:param int [limit]: the maximum number of trades structures to retrieve
|
@@ -3062,9 +3129,15 @@ class coinex(Exchange, ImplicitAPI):
|
|
3062
3129
|
if type != 'spot' and symbol is None:
|
3063
3130
|
raise ArgumentsRequired(self.id + ' fetchMyTrades() requires a symbol argument for non-spot markets')
|
3064
3131
|
swap = (type == 'swap')
|
3065
|
-
|
3132
|
+
accountId = self.safe_integer(params, 'account_id')
|
3133
|
+
defaultType = self.safe_string(self.options, 'defaultType')
|
3134
|
+
if defaultType == 'margin':
|
3135
|
+
if accountId is None:
|
3136
|
+
raise BadRequest(self.id + ' fetchMyTrades() requires an account_id parameter for margin trades')
|
3137
|
+
request['account_id'] = accountId
|
3138
|
+
params = self.omit(params, 'account_id')
|
3139
|
+
response = None
|
3066
3140
|
if swap:
|
3067
|
-
method = 'perpetualPublicGetMarketUserDeals'
|
3068
3141
|
side = self.safe_integer(params, 'side')
|
3069
3142
|
if side is None:
|
3070
3143
|
raise ArgumentsRequired(self.id + ' fetchMyTrades() requires a side parameter for swap markets')
|
@@ -3072,17 +3145,10 @@ class coinex(Exchange, ImplicitAPI):
|
|
3072
3145
|
request['start_time'] = since
|
3073
3146
|
request['side'] = side
|
3074
3147
|
params = self.omit(params, 'side')
|
3148
|
+
response = await self.perpetualPublicGetMarketUserDeals(self.extend(request, params))
|
3075
3149
|
else:
|
3076
|
-
method = 'privateGetOrderUserDeals'
|
3077
3150
|
request['page'] = 1
|
3078
|
-
|
3079
|
-
defaultType = self.safe_string(self.options, 'defaultType')
|
3080
|
-
if defaultType == 'margin':
|
3081
|
-
if accountId is None:
|
3082
|
-
raise BadRequest(self.id + ' fetchMyTrades() requires an account_id parameter for margin trades')
|
3083
|
-
request['account_id'] = accountId
|
3084
|
-
params = self.omit(params, 'account_id')
|
3085
|
-
response = await getattr(self, method)(self.extend(request, params))
|
3151
|
+
response = await self.privateGetOrderUserDeals(self.extend(request, params))
|
3086
3152
|
#
|
3087
3153
|
# Spot and Margin
|
3088
3154
|
#
|
@@ -3163,6 +3229,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
3163
3229
|
async def fetch_positions(self, symbols: Strings = None, params={}):
|
3164
3230
|
"""
|
3165
3231
|
fetch all open positions
|
3232
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http033_pending_position
|
3166
3233
|
:param str[]|None symbols: list of unified market symbols
|
3167
3234
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3168
3235
|
:returns dict[]: a list of `position structure <https://docs.ccxt.com/#/?id=position-structure>`
|
@@ -3251,6 +3318,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
3251
3318
|
async def fetch_position(self, symbol: str, params={}):
|
3252
3319
|
"""
|
3253
3320
|
fetch data on a single open contract trade position
|
3321
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http033_pending_position
|
3254
3322
|
:param str symbol: unified market symbol of the market the position is held in, default is None
|
3255
3323
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3256
3324
|
:returns dict: a `position structure <https://docs.ccxt.com/#/?id=position-structure>`
|
@@ -3431,6 +3499,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
3431
3499
|
async def set_margin_mode(self, marginMode, symbol: Str = None, params={}):
|
3432
3500
|
"""
|
3433
3501
|
set margin mode to 'cross' or 'isolated'
|
3502
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http014_adjust_leverage
|
3434
3503
|
:param str marginMode: 'cross' or 'isolated'
|
3435
3504
|
:param str symbol: unified market symbol
|
3436
3505
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -3503,6 +3572,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
3503
3572
|
async def fetch_leverage_tiers(self, symbols: Strings = None, params={}):
|
3504
3573
|
"""
|
3505
3574
|
retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
|
3575
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http007_market_limit
|
3506
3576
|
:param str[]|None symbols: list of unified market symbols
|
3507
3577
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3508
3578
|
:returns dict: a dictionary of `leverage tiers structures <https://docs.ccxt.com/#/?id=leverage-tiers-structure>`, indexed by market symbols
|
@@ -3661,6 +3731,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
3661
3731
|
async def add_margin(self, symbol: str, amount, params={}):
|
3662
3732
|
"""
|
3663
3733
|
add margin
|
3734
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http032_adjust_position_margin
|
3664
3735
|
:param str symbol: unified market symbol
|
3665
3736
|
:param float amount: amount of margin to add
|
3666
3737
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -3671,6 +3742,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
3671
3742
|
async def reduce_margin(self, symbol: str, amount, params={}):
|
3672
3743
|
"""
|
3673
3744
|
remove margin from a position
|
3745
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http032_adjust_position_margin
|
3674
3746
|
:param str symbol: unified market symbol
|
3675
3747
|
:param float amount: the amount of margin to remove
|
3676
3748
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -3681,6 +3753,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
3681
3753
|
async def fetch_funding_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
3682
3754
|
"""
|
3683
3755
|
fetch the history of funding payments paid and received on self account
|
3756
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http034_funding_position
|
3684
3757
|
:param str symbol: unified market symbol
|
3685
3758
|
:param int [since]: the earliest time in ms to fetch funding history for
|
3686
3759
|
:param int [limit]: the maximum number of funding history structures to retrieve
|
@@ -3751,6 +3824,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
3751
3824
|
async def fetch_funding_rate(self, symbol: str, params={}):
|
3752
3825
|
"""
|
3753
3826
|
fetch the current funding rate
|
3827
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http008_market_ticker
|
3754
3828
|
:param str symbol: unified market symbol
|
3755
3829
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3756
3830
|
:returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
@@ -3857,6 +3931,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
3857
3931
|
"""
|
3858
3932
|
* @method
|
3859
3933
|
fetch the current funding rates
|
3934
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http009_market_ticker_all
|
3860
3935
|
:param str[] symbols: unified market symbols
|
3861
3936
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3862
3937
|
:returns dict[]: an array of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
@@ -4160,6 +4235,8 @@ class coinex(Exchange, ImplicitAPI):
|
|
4160
4235
|
async def transfer(self, code: str, amount, fromAccount, toAccount, params={}):
|
4161
4236
|
"""
|
4162
4237
|
transfer currency internally between wallets on the same account
|
4238
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account014_balance_contract_transfer
|
4239
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account013_margin_transfer
|
4163
4240
|
:param str code: unified currency code
|
4164
4241
|
:param float amount: amount to transfer
|
4165
4242
|
:param str fromAccount: account to transfer from
|
@@ -4174,11 +4251,13 @@ class coinex(Exchange, ImplicitAPI):
|
|
4174
4251
|
'amount': amountToPrecision,
|
4175
4252
|
'coin_type': currency['id'],
|
4176
4253
|
}
|
4177
|
-
|
4254
|
+
response = None
|
4178
4255
|
if (fromAccount == 'spot') and (toAccount == 'swap'):
|
4179
4256
|
request['transfer_side'] = 'in' # 'in' spot to swap, 'out' swap to spot
|
4257
|
+
response = await self.privatePostContractBalanceTransfer(self.extend(request, params))
|
4180
4258
|
elif (fromAccount == 'swap') and (toAccount == 'spot'):
|
4181
4259
|
request['transfer_side'] = 'out' # 'in' spot to swap, 'out' swap to spot
|
4260
|
+
response = await self.privatePostContractBalanceTransfer(self.extend(request, params))
|
4182
4261
|
else:
|
4183
4262
|
accountsById = self.safe_value(self.options, 'accountsById', {})
|
4184
4263
|
fromId = self.safe_string(accountsById, fromAccount, fromAccount)
|
@@ -4187,8 +4266,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
4187
4266
|
# spot is 0, use fetchBalance() to find the margin account id
|
4188
4267
|
request['from_account'] = int(fromId)
|
4189
4268
|
request['to_account'] = int(toId)
|
4190
|
-
|
4191
|
-
response = await getattr(self, method)(self.extend(request, params))
|
4269
|
+
response = await self.privatePostMarginTransfer(self.extend(request, params))
|
4192
4270
|
#
|
4193
4271
|
# {"code": 0, "data": null, "message": "Success"}
|
4194
4272
|
#
|
@@ -4264,6 +4342,8 @@ class coinex(Exchange, ImplicitAPI):
|
|
4264
4342
|
async def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
4265
4343
|
"""
|
4266
4344
|
fetch a history of internal transfers made on an account
|
4345
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account025_margin_transfer_history
|
4346
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account024_contract_transfer_history
|
4267
4347
|
:param str code: unified currency code of the currency transferred
|
4268
4348
|
:param int [since]: the earliest time in ms to fetch transfers for
|
4269
4349
|
:param int [limit]: the maximum number of transfers structures to retrieve
|
@@ -4274,7 +4354,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
4274
4354
|
currency = None
|
4275
4355
|
request = {
|
4276
4356
|
'page': 1,
|
4277
|
-
'limit': limit,
|
4357
|
+
# 'limit': limit,
|
4278
4358
|
# 'asset': 'USDT',
|
4279
4359
|
# 'start_time': since,
|
4280
4360
|
# 'end_time': 1515806440,
|
@@ -4284,14 +4364,21 @@ class coinex(Exchange, ImplicitAPI):
|
|
4284
4364
|
if page is not None:
|
4285
4365
|
request['page'] = page
|
4286
4366
|
if code is not None:
|
4287
|
-
currency = self.
|
4367
|
+
currency = self.currency(code)
|
4288
4368
|
request['asset'] = currency['id']
|
4289
4369
|
if since is not None:
|
4290
4370
|
request['start_time'] = since
|
4371
|
+
if limit is not None:
|
4372
|
+
request['limit'] = limit
|
4373
|
+
else:
|
4374
|
+
request['limit'] = 100
|
4291
4375
|
params = self.omit(params, 'page')
|
4292
4376
|
defaultType = self.safe_string(self.options, 'defaultType')
|
4293
|
-
|
4294
|
-
|
4377
|
+
response = None
|
4378
|
+
if defaultType == 'margin':
|
4379
|
+
response = await self.privateGetMarginTransferHistory(self.extend(request, params))
|
4380
|
+
else:
|
4381
|
+
response = await self.privateGetContractTransferHistory(self.extend(request, params))
|
4295
4382
|
#
|
4296
4383
|
# Swap
|
4297
4384
|
#
|
@@ -4343,6 +4430,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
4343
4430
|
async def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
|
4344
4431
|
"""
|
4345
4432
|
fetch all withdrawals made from an account
|
4433
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account026_withdraw_list
|
4346
4434
|
:param str code: unified currency code
|
4347
4435
|
:param int [since]: the earliest time in ms to fetch withdrawals for
|
4348
4436
|
:param int [limit]: the maximum number of withdrawals structures to retrieve
|
@@ -4404,6 +4492,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
4404
4492
|
async def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
|
4405
4493
|
"""
|
4406
4494
|
fetch all deposits made to an account
|
4495
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account009_deposit_list
|
4407
4496
|
:param str code: unified currency code
|
4408
4497
|
:param int [since]: the earliest time in ms to fetch deposits for
|
4409
4498
|
:param int [limit]: the maximum number of deposits structures to retrieve
|
@@ -4498,6 +4587,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
4498
4587
|
async def fetch_isolated_borrow_rate(self, symbol: str, params={}):
|
4499
4588
|
"""
|
4500
4589
|
fetch the rate of interest to borrow a currency for margin trading
|
4590
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account007_margin_account_settings
|
4501
4591
|
:param str symbol: unified symbol of the market to fetch the borrow rate for
|
4502
4592
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
4503
4593
|
:returns dict: an `isolated borrow rate structure <https://docs.ccxt.com/#/?id=isolated-borrow-rate-structure>`
|
@@ -4534,6 +4624,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
4534
4624
|
async def fetch_isolated_borrow_rates(self, params={}):
|
4535
4625
|
"""
|
4536
4626
|
fetch the borrow interest rates of all currencies
|
4627
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account007_margin_account_settings
|
4537
4628
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
4538
4629
|
:returns dict: a list of `isolated borrow rate structures <https://github.com/ccxt/ccxt/wiki/Manual#isolated-borrow-rate-structure>`
|
4539
4630
|
"""
|
ccxt/async_support/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
|
+
async 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
|
+
await 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 = await 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)
|