ccxt 4.4.37__py2.py3-none-any.whl → 4.4.38__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 CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
  # ----------------------------------------------------------------------------
24
24
 
25
- __version__ = '4.4.37'
25
+ __version__ = '4.4.38'
26
26
 
27
27
  # ----------------------------------------------------------------------------
28
28
 
ccxt/abstract/bingx.py CHANGED
@@ -35,7 +35,6 @@ class ImplicitAPI:
35
35
  swap_v1_public_get_market_markpriceklines = swapV1PublicGetMarketMarkPriceKlines = Entry('market/markPriceKlines', ['swap', 'v1', 'public'], 'GET', {'cost': 1})
36
36
  swap_v1_public_get_trade_multiassetsrules = swapV1PublicGetTradeMultiAssetsRules = Entry('trade/multiAssetsRules', ['swap', 'v1', 'public'], 'GET', {'cost': 1})
37
37
  swap_v1_private_get_positionside_dual = swapV1PrivateGetPositionSideDual = Entry('positionSide/dual', ['swap', 'v1', 'private'], 'GET', {'cost': 5})
38
- swap_v1_private_get_market_markpriceklines = swapV1PrivateGetMarketMarkPriceKlines = Entry('market/markPriceKlines', ['swap', 'v1', 'private'], 'GET', {'cost': 1})
39
38
  swap_v1_private_get_trade_batchcancelreplace = swapV1PrivateGetTradeBatchCancelReplace = Entry('trade/batchCancelReplace', ['swap', 'v1', 'private'], 'GET', {'cost': 5})
40
39
  swap_v1_private_get_trade_fullorder = swapV1PrivateGetTradeFullOrder = Entry('trade/fullOrder', ['swap', 'v1', 'private'], 'GET', {'cost': 2})
41
40
  swap_v1_private_get_maintmarginratio = swapV1PrivateGetMaintMarginRatio = Entry('maintMarginRatio', ['swap', 'v1', 'private'], 'GET', {'cost': 2})
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.4.37'
7
+ __version__ = '4.4.38'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # -----------------------------------------------------------------------------
4
4
 
5
- __version__ = '4.4.37'
5
+ __version__ = '4.4.38'
6
6
 
7
7
  # -----------------------------------------------------------------------------
8
8
 
@@ -1592,7 +1592,6 @@ class binance(Exchange, ImplicitAPI):
1592
1592
  'takeProfitPrice': True,
1593
1593
  'attachedStopLossTakeProfit': None, # not supported
1594
1594
  'timeInForce': {
1595
- 'GTC': True,
1596
1595
  'IOC': True,
1597
1596
  'FOK': True,
1598
1597
  'PO': True,
@@ -1659,7 +1658,6 @@ class binance(Exchange, ImplicitAPI):
1659
1658
  'takeProfitPrice': True,
1660
1659
  'attachedStopLossTakeProfit': None, # not supported
1661
1660
  'timeInForce': {
1662
- 'GTC': True,
1663
1661
  'IOC': True,
1664
1662
  'FOK': True,
1665
1663
  'PO': True,
@@ -96,7 +96,7 @@ class bingx(Exchange, ImplicitAPI):
96
96
  'fetchPositionHistory': False,
97
97
  'fetchPositionMode': True,
98
98
  'fetchPositions': True,
99
- 'fetchPositionsHistory': False,
99
+ 'fetchPositionsHistory': True,
100
100
  'fetchTicker': True,
101
101
  'fetchTickers': True,
102
102
  'fetchTime': True,
@@ -220,7 +220,6 @@ class bingx(Exchange, ImplicitAPI):
220
220
  'private': {
221
221
  'get': {
222
222
  'positionSide/dual': 5,
223
- 'market/markPriceKlines': 1,
224
223
  'trade/batchCancelReplace': 5,
225
224
  'trade/fullOrder': 2,
226
225
  'maintMarginRatio': 2,
@@ -554,7 +553,6 @@ class bingx(Exchange, ImplicitAPI):
554
553
  'limitPrice': True,
555
554
  },
556
555
  'timeInForce': {
557
- 'GTC': True,
558
556
  'IOC': True,
559
557
  'FOK': True,
560
558
  'PO': True,
@@ -1016,7 +1014,7 @@ class bingx(Exchange, ImplicitAPI):
1016
1014
  https://bingx-api.github.io/docs/#/swapV2/market-api.html#K-Line%20Data
1017
1015
  https://bingx-api.github.io/docs/#/spot/market-api.html#Candlestick%20chart%20data
1018
1016
  https://bingx-api.github.io/docs/#/swapV2/market-api.html#%20K-Line%20Data
1019
- https://bingx-api.github.io/docs/#/en-us/swapV2/market-api.html#K-Line%20Data%20-%20Mark%20Price
1017
+ https://bingx-api.github.io/docs/#/en-us/swapV2/market-api.html#Mark%20Price%20Kline/Candlestick%20Data
1020
1018
  https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Get%20K-line%20Data
1021
1019
 
1022
1020
  :param str symbol: unified symbol of the market to fetch OHLCV data for
@@ -1056,7 +1054,7 @@ class bingx(Exchange, ImplicitAPI):
1056
1054
  price = self.safe_string(params, 'price')
1057
1055
  params = self.omit(params, 'price')
1058
1056
  if price == 'mark':
1059
- response = await self.swapV1PrivateGetMarketMarkPriceKlines(self.extend(request, params))
1057
+ response = await self.swapV1PublicGetMarketMarkPriceKlines(self.extend(request, params))
1060
1058
  else:
1061
1059
  response = await self.swapV3PublicGetQuoteKlines(self.extend(request, params))
1062
1060
  #
@@ -2265,6 +2263,67 @@ class bingx(Exchange, ImplicitAPI):
2265
2263
  result[code] = account
2266
2264
  return self.safe_balance(result)
2267
2265
 
2266
+ async def fetch_position_history(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Position]:
2267
+ """
2268
+ fetches historical positions
2269
+
2270
+ https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Position%20History
2271
+
2272
+ :param str symbol: unified contract symbol
2273
+ :param int [since]: the earliest time in ms to fetch positions for
2274
+ :param int [limit]: the maximum amount of records to fetch
2275
+ :param dict [params]: extra parameters specific to the exchange api endpoint
2276
+ :param int [params.until]: the latest time in ms to fetch positions for
2277
+ :returns dict[]: a list of `position structures <https://docs.ccxt.com/#/?id=position-structure>`
2278
+ """
2279
+ await self.load_markets()
2280
+ market = self.market(symbol)
2281
+ request: dict = {
2282
+ 'symbol': market['id'],
2283
+ }
2284
+ if limit is not None:
2285
+ request['pageSize'] = limit
2286
+ if since is not None:
2287
+ request['startTs'] = since
2288
+ request, params = self.handle_until_option('endTs', request, params)
2289
+ response = None
2290
+ if market['linear']:
2291
+ response = await self.swapV1PrivateGetTradePositionHistory(self.extend(request, params))
2292
+ else:
2293
+ raise NotSupported(self.id + ' fetchPositionHistory() is not supported for inverse swap positions')
2294
+ #
2295
+ # {
2296
+ # "code": 0,
2297
+ # "msg": "",
2298
+ # "data": {
2299
+ # "positionHistory": [
2300
+ # {
2301
+ # "positionId": "1861675561156571136",
2302
+ # "symbol": "LTC-USDT",
2303
+ # "isolated": False,
2304
+ # "positionSide": "LONG",
2305
+ # "openTime": 1732693017000,
2306
+ # "updateTime": 1733310292000,
2307
+ # "avgPrice": "95.18",
2308
+ # "avgClosePrice": "129.48",
2309
+ # "realisedProfit": "102.89",
2310
+ # "netProfit": "99.63",
2311
+ # "positionAmt": "30.0",
2312
+ # "closePositionAmt": "30.0",
2313
+ # "leverage": 6,
2314
+ # "closeAllPositions": True,
2315
+ # "positionCommission": "-0.33699650000000003",
2316
+ # "totalFunding": "-2.921461693902908"
2317
+ # },
2318
+ # ]
2319
+ # }
2320
+ # }
2321
+ #
2322
+ data = self.safe_dict(response, 'data', {})
2323
+ records = self.safe_list(data, 'positionHistory', [])
2324
+ positions = self.parse_positions(records)
2325
+ return self.filter_by_symbol_since_limit(positions, symbol, since, limit)
2326
+
2268
2327
  async def fetch_positions(self, symbols: Strings = None, params={}):
2269
2328
  """
2270
2329
  fetch all open positions
@@ -2504,12 +2563,34 @@ class bingx(Exchange, ImplicitAPI):
2504
2563
  # "positionAmt": "1.20365912",
2505
2564
  # }
2506
2565
  #
2566
+ # linear swap fetchPositionHistory
2567
+ #
2568
+ # {
2569
+ # "positionId": "1861675561156571136",
2570
+ # "symbol": "LTC-USDT",
2571
+ # "isolated": False,
2572
+ # "positionSide": "LONG",
2573
+ # "openTime": 1732693017000,
2574
+ # "updateTime": 1733310292000,
2575
+ # "avgPrice": "95.18",
2576
+ # "avgClosePrice": "129.48",
2577
+ # "realisedProfit": "102.89",
2578
+ # "netProfit": "99.63",
2579
+ # "positionAmt": "30.0",
2580
+ # "closePositionAmt": "30.0",
2581
+ # "leverage": 6,
2582
+ # "closeAllPositions": True,
2583
+ # "positionCommission": "-0.33699650000000003",
2584
+ # "totalFunding": "-2.921461693902908"
2585
+ # }
2586
+ #
2507
2587
  marketId = self.safe_string(position, 'symbol', '')
2508
2588
  marketId = marketId.replace('/', '-') # standard return different format
2509
2589
  isolated = self.safe_bool(position, 'isolated')
2510
2590
  marginMode = None
2511
2591
  if isolated is not None:
2512
2592
  marginMode = 'isolated' if isolated else 'cross'
2593
+ timestamp = self.safe_integer(position, 'openTime')
2513
2594
  return self.safe_position({
2514
2595
  'info': position,
2515
2596
  'id': self.safe_string(position, 'positionId'),
@@ -2527,8 +2608,8 @@ class bingx(Exchange, ImplicitAPI):
2527
2608
  'lastPrice': None,
2528
2609
  'side': self.safe_string_lower(position, 'positionSide'),
2529
2610
  'hedged': None,
2530
- 'timestamp': None,
2531
- 'datetime': None,
2611
+ 'timestamp': timestamp,
2612
+ 'datetime': self.iso8601(timestamp),
2532
2613
  'lastUpdateTimestamp': self.safe_integer(position, 'updateTime'),
2533
2614
  'maintenanceMargin': None,
2534
2615
  'maintenanceMarginPercentage': None,
@@ -6089,7 +6170,7 @@ class bingx(Exchange, ImplicitAPI):
6089
6170
  body = self.json(parsedParams)
6090
6171
  else:
6091
6172
  query = self.urlencode(parsedParams)
6092
- url += '?' + query + '&signature=' + signature
6173
+ url += '?' + query + '&' + 'signature=' + signature
6093
6174
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
6094
6175
 
6095
6176
  def nonce(self):
@@ -1474,8 +1474,8 @@ class bitget(Exchange, ImplicitAPI):
1474
1474
  'index': False, # not on spot
1475
1475
  },
1476
1476
  'triggerDirection': False,
1477
- 'stopLossPrice': True, # but not yet implemented in spot
1478
- 'takeProfitPrice': True, # but not yet implemented in spot
1477
+ 'stopLossPrice': True, # todo: not yet implemented in spot
1478
+ 'takeProfitPrice': True, # todo: not yet implemented in spot
1479
1479
  'attachedStopLossTakeProfit': {
1480
1480
  'triggerPriceType': {
1481
1481
  'last': False,
@@ -1485,7 +1485,6 @@ class bitget(Exchange, ImplicitAPI):
1485
1485
  'limitPrice': True,
1486
1486
  },
1487
1487
  'timeInForce': {
1488
- 'GTC': True,
1489
1488
  'IOC': True,
1490
1489
  'FOK': True,
1491
1490
  'PO': True,
@@ -1556,7 +1555,6 @@ class bitget(Exchange, ImplicitAPI):
1556
1555
  'limitPrice': False,
1557
1556
  },
1558
1557
  'timeInForce': {
1559
- 'GTC': True,
1560
1558
  'IOC': True,
1561
1559
  'FOK': True,
1562
1560
  'PO': True,
@@ -1028,7 +1028,7 @@ class bithumb(Exchange, ImplicitAPI):
1028
1028
  'address': address,
1029
1029
  'currency': currency['id'],
1030
1030
  }
1031
- if code == 'XRP' or code == 'XMR' or code == 'EOS' or code == 'STEEM':
1031
+ if code == 'XRP' or code == 'XMR' or code == 'EOS' or code == 'STEEM' or code == 'TON':
1032
1032
  destination = self.safe_string(params, 'destination')
1033
1033
  if (tag is None) and (destination is None):
1034
1034
  raise ArgumentsRequired(self.id + ' ' + code + ' withdraw() requires a tag argument or an extra destination param')
@@ -704,6 +704,151 @@ class bitmart(Exchange, ImplicitAPI):
704
704
  'createMarketBuyOrderRequiresPrice': True,
705
705
  'brokerId': 'CCXTxBitmart000',
706
706
  },
707
+ 'features': {
708
+ 'default': {
709
+ 'sandbox': False,
710
+ 'createOrder': {
711
+ 'marginMode': True,
712
+ 'triggerPrice': False,
713
+ 'triggerPriceType': None,
714
+ 'triggerDirection': False,
715
+ 'stopLossPrice': False,
716
+ 'takeProfitPrice': False,
717
+ 'attachedStopLossTakeProfit': None,
718
+ 'timeInForce': {
719
+ 'IOC': True,
720
+ 'FOK': False,
721
+ 'PO': True,
722
+ 'GTD': False,
723
+ },
724
+ 'hedged': False,
725
+ 'trailing': False,
726
+ 'marketBuyRequiresPrice': True,
727
+ 'marketBuyByCost': True,
728
+ # exchange-supported features
729
+ # 'leverage': True,
730
+ # 'selfTradePrevention': False,
731
+ # 'twap': False,
732
+ # 'iceberg': False,
733
+ # 'oco': False,
734
+ },
735
+ 'createOrders': {
736
+ 'max': 10,
737
+ },
738
+ 'fetchMyTrades': {
739
+ 'marginMode': True,
740
+ 'limit': 200,
741
+ 'daysBack': None,
742
+ 'untilDays': 99999,
743
+ },
744
+ 'fetchOrder': {
745
+ 'marginMode': False,
746
+ 'trigger': False,
747
+ 'trailing': False,
748
+ },
749
+ 'fetchOpenOrders': {
750
+ 'marginMode': True,
751
+ 'limit': 200,
752
+ 'trigger': False,
753
+ 'trailing': False,
754
+ },
755
+ 'fetchOrders': None,
756
+ 'fetchClosedOrders': {
757
+ 'marginMode': True,
758
+ 'limit': 200,
759
+ 'daysBackClosed': None,
760
+ 'daysBackCanceled': None,
761
+ 'untilDays': None,
762
+ 'trigger': False,
763
+ 'trailing': False,
764
+ },
765
+ 'fetchOHLCV': {
766
+ 'limit': 1000, # variable timespans for recent endpoint, 200 for historical
767
+ },
768
+ },
769
+ 'forDerivatives': {
770
+ 'extends': 'default',
771
+ 'createOrder': {
772
+ 'marginMode': True,
773
+ 'triggerPrice': True,
774
+ 'triggerPriceType': {
775
+ 'last': True,
776
+ 'mark': True,
777
+ 'index': False,
778
+ },
779
+ 'triggerDirection': True, # todo: implementation broken
780
+ 'stopLossPrice': True,
781
+ 'takeProfitPrice': True,
782
+ 'attachedStopLossTakeProfit': {
783
+ 'triggerPriceType': {
784
+ 'last': True,
785
+ 'mark': True,
786
+ 'index': False,
787
+ },
788
+ 'limitPrice': False,
789
+ },
790
+ 'timeInForce': {
791
+ 'IOC': True,
792
+ 'FOK': True,
793
+ 'PO': True,
794
+ 'GTD': False,
795
+ },
796
+ 'hedged': False,
797
+ 'trailing': True,
798
+ 'marketBuyRequiresPrice': True,
799
+ 'marketBuyByCost': True,
800
+ # exchange-supported features
801
+ # 'selfTradePrevention': True,
802
+ # 'twap': False,
803
+ # 'iceberg': False,
804
+ # 'oco': False,
805
+ },
806
+ 'fetchMyTrades': {
807
+ 'marginMode': True,
808
+ 'limit': None,
809
+ 'daysBack': None,
810
+ 'untilDays': 99999,
811
+ },
812
+ 'fetchOrder': {
813
+ 'marginMode': False,
814
+ 'trigger': False,
815
+ 'trailing': True,
816
+ },
817
+ 'fetchOpenOrders': {
818
+ 'marginMode': False,
819
+ 'limit': 100,
820
+ 'trigger': True,
821
+ 'trailing': False,
822
+ },
823
+ 'fetchClosedOrders': {
824
+ 'marginMode': True,
825
+ 'limit': 200,
826
+ 'daysBackClosed': None,
827
+ 'daysBackCanceled': None,
828
+ 'untilDays': None,
829
+ 'trigger': False,
830
+ 'trailing': False,
831
+ },
832
+ 'fetchOHLCV': {
833
+ 'limit': 500,
834
+ },
835
+ },
836
+ 'spot': {
837
+ 'extends': 'default',
838
+ },
839
+ 'swap': {
840
+ 'linear': {
841
+ 'extends': 'forDerivatives',
842
+ },
843
+ 'inverse': {
844
+ 'extends': 'forDerivatives',
845
+ },
846
+ },
847
+ 'future': {
848
+ 'linear': None,
849
+ 'inverse': None,
850
+ },
851
+ },
707
852
  })
708
853
 
709
854
  async def fetch_time(self, params={}):
@@ -1906,10 +2051,11 @@ class bitmart(Exchange, ImplicitAPI):
1906
2051
  if marginMode == 'isolated':
1907
2052
  request['orderMode'] = 'iso_margin'
1908
2053
  options = self.safe_dict(self.options, 'fetchMyTrades', {})
1909
- defaultLimit = self.safe_integer(options, 'limit', 200)
2054
+ maxLimit = 200
2055
+ defaultLimit = self.safe_integer(options, 'limit', maxLimit)
1910
2056
  if limit is None:
1911
2057
  limit = defaultLimit
1912
- request['limit'] = limit
2058
+ request['limit'] = min(limit, maxLimit)
1913
2059
  if since is not None:
1914
2060
  request['startTime'] = since
1915
2061
  if until is not None:
@@ -2549,8 +2695,7 @@ class bitmart(Exchange, ImplicitAPI):
2549
2695
  """
2550
2696
  @ignore
2551
2697
  create a trade order
2552
- https://developer-pro.bitmart.com/en/futures/#submit-order-signed
2553
- https://developer-pro.bitmart.com/en/futures/#submit-plan-order-signed
2698
+ https://developer-pro.bitmart.com/en/futuresv2/#submit-order-signed
2554
2699
  https://developer-pro.bitmart.com/en/futuresv2/#submit-plan-order-signed
2555
2700
  https://developer-pro.bitmart.com/en/futuresv2/#submit-tp-or-sl-order-signed
2556
2701
  :param str symbol: unified symbol of the market to create an order in
@@ -2996,12 +3141,12 @@ class bitmart(Exchange, ImplicitAPI):
2996
3141
  if symbol is not None:
2997
3142
  market = self.market(symbol)
2998
3143
  request['symbol'] = market['id']
2999
- if limit is not None:
3000
- request['limit'] = limit
3001
3144
  type = None
3002
3145
  response = None
3003
3146
  type, params = self.handle_market_type_and_params('fetchOpenOrders', market, params)
3004
3147
  if type == 'spot':
3148
+ if limit is not None:
3149
+ request['limit'] = min(limit, 200)
3005
3150
  marginMode = None
3006
3151
  marginMode, params = self.handle_margin_mode_and_params('fetchOpenOrders', params)
3007
3152
  if marginMode == 'isolated':
@@ -3014,9 +3159,11 @@ class bitmart(Exchange, ImplicitAPI):
3014
3159
  request['endTime'] = until
3015
3160
  response = await self.privatePostSpotV4QueryOpenOrders(self.extend(request, params))
3016
3161
  elif type == 'swap':
3017
- isStop = self.safe_bool_2(params, 'stop', 'trigger')
3162
+ if limit is not None:
3163
+ request['limit'] = min(limit, 100)
3164
+ isTrigger = self.safe_bool_2(params, 'stop', 'trigger')
3018
3165
  params = self.omit(params, ['stop', 'trigger'])
3019
- if isStop:
3166
+ if isTrigger:
3020
3167
  response = await self.privateGetContractPrivateCurrentPlanOrder(self.extend(request, params))
3021
3168
  else:
3022
3169
  trailing = self.safe_bool(params, 'trailing', False)
@@ -3113,12 +3260,8 @@ class bitmart(Exchange, ImplicitAPI):
3113
3260
  if type != 'spot':
3114
3261
  if symbol is None:
3115
3262
  raise ArgumentsRequired(self.id + ' fetchClosedOrders() requires a symbol argument')
3116
- marginMode = None
3117
- marginMode, params = self.handle_margin_mode_and_params('fetchClosedOrders', params)
3118
- if marginMode == 'isolated':
3119
- request['orderMode'] = 'iso_margin'
3120
- startTimeKey = 'startTime' if (type == 'spot') else 'start_time'
3121
3263
  if since is not None:
3264
+ startTimeKey = 'startTime' if (type == 'spot') else 'start_time'
3122
3265
  request[startTimeKey] = since
3123
3266
  endTimeKey = 'endTime' if (type == 'spot') else 'end_time'
3124
3267
  until = self.safe_integer_2(params, 'until', endTimeKey)
@@ -3127,6 +3270,10 @@ class bitmart(Exchange, ImplicitAPI):
3127
3270
  request[endTimeKey] = until
3128
3271
  response = None
3129
3272
  if type == 'spot':
3273
+ marginMode = None
3274
+ marginMode, params = self.handle_margin_mode_and_params('fetchClosedOrders', params)
3275
+ if marginMode == 'isolated':
3276
+ request['orderMode'] = 'iso_margin'
3130
3277
  response = await self.privatePostSpotV4QueryHistoryOrders(self.extend(request, params))
3131
3278
  else:
3132
3279
  response = await self.privateGetContractPrivateOrderHistory(self.extend(request, params))
@@ -677,6 +677,9 @@ class bybit(Exchange, ImplicitAPI):
677
677
  '110071': ExchangeError, # Sorry, we're revamping the Unified Margin Account! Currently, new upgrades are not supported. If you have any questions, please contact our 24/7 customer support.
678
678
  '110072': InvalidOrder, # OrderLinkedID is duplicate
679
679
  '110073': ExchangeError, # Set margin mode failed
680
+ '110092': InvalidOrder, # expect Rising, but trigger_price[XXXXX] <= current[XXXXX]
681
+ '110093': InvalidOrder, # expect Falling, but trigger_price[XXXXX] >= current[XXXXX]
682
+ '110094': InvalidOrder, # Order notional value below the lower limit
680
683
  '130006': InvalidOrder, # {"ret_code":130006,"ret_msg":"The number of contracts exceeds maximum limit allowed: too large","ext_code":"","ext_info":"","result":null,"time_now":"1658397095.099030","rate_limit_status":99,"rate_limit_reset_ms":1658397095097,"rate_limit":100}
681
684
  '130021': InsufficientFunds, # {"ret_code":130021,"ret_msg":"orderfix price failed for CannotAffordOrderCost.","ext_code":"","ext_info":"","result":null,"time_now":"1644588250.204878","rate_limit_status":98,"rate_limit_reset_ms":1644588250200,"rate_limit":100} | {"ret_code":130021,"ret_msg":"oc_diff[1707966351], new_oc[1707966351] with ob[....]+AB[....]","ext_code":"","ext_info":"","result":null,"time_now":"1658395300.872766","rate_limit_status":99,"rate_limit_reset_ms":1658395300855,"rate_limit":100} caused issues/9149#issuecomment-1146559498
682
685
  '130074': InvalidOrder, # {"ret_code":130074,"ret_msg":"expect Rising, but trigger_price[190000000] \u003c= current[211280000]??LastPrice","ext_code":"","ext_info":"","result":null,"time_now":"1655386638.067076","rate_limit_status":97,"rate_limit_reset_ms":1655386638065,"rate_limit":100}
@@ -1116,7 +1119,6 @@ class bybit(Exchange, ImplicitAPI):
1116
1119
  'limitPrice': True,
1117
1120
  },
1118
1121
  'timeInForce': {
1119
- 'GTC': True,
1120
1122
  'IOC': True,
1121
1123
  'FOK': True,
1122
1124
  'PO': True,
@@ -1178,7 +1180,6 @@ class bybit(Exchange, ImplicitAPI):
1178
1180
  'limitPrice': True,
1179
1181
  },
1180
1182
  'timeInForce': {
1181
- 'GTC': True,
1182
1183
  'IOC': True,
1183
1184
  'FOK': True,
1184
1185
  'PO': True,
@@ -928,6 +928,7 @@ class kucoin(Exchange, ImplicitAPI):
928
928
  'TRUE': 'true',
929
929
  'CS': 'cs',
930
930
  'ORAI': 'orai',
931
+ 'BASE': 'base',
931
932
  # below will be uncommented after consensus
932
933
  # 'BITCOINDIAMON': 'bcd',
933
934
  # 'BITCOINGOLD': 'btg',
@@ -1003,6 +1004,74 @@ class kucoin(Exchange, ImplicitAPI):
1003
1004
  'spot': 'TRADE',
1004
1005
  },
1005
1006
  },
1007
+ 'features': {
1008
+ 'spot': {
1009
+ 'sandbox': False,
1010
+ 'createOrder': {
1011
+ 'marginMode': True,
1012
+ 'triggerPrice': True,
1013
+ 'triggerPriceType': None,
1014
+ 'triggerDirection': False,
1015
+ 'stopLossPrice': True,
1016
+ 'takeProfitPrice': True,
1017
+ 'attachedStopLossTakeProfit': None, # not supported
1018
+ 'timeInForce': {
1019
+ 'IOC': True,
1020
+ 'FOK': True,
1021
+ 'PO': True,
1022
+ 'GTD': True,
1023
+ },
1024
+ 'hedged': False,
1025
+ 'trailing': False,
1026
+ # exchange-supported features
1027
+ # 'iceberg': True,
1028
+ # 'selfTradePrevention': True,
1029
+ # 'twap': False,
1030
+ # 'oco': False,
1031
+ },
1032
+ 'createOrders': {
1033
+ 'max': 5,
1034
+ },
1035
+ 'fetchMyTrades': {
1036
+ 'marginMode': True,
1037
+ 'limit': None,
1038
+ 'daysBack': None,
1039
+ 'untilDays': 7, # per implementation comments
1040
+ },
1041
+ 'fetchOrder': {
1042
+ 'marginMode': False,
1043
+ 'trigger': True,
1044
+ 'trailing': False,
1045
+ },
1046
+ 'fetchOpenOrders': {
1047
+ 'marginMode': True,
1048
+ 'limit': 500,
1049
+ 'trigger': True,
1050
+ 'trailing': False,
1051
+ },
1052
+ 'fetchOrders': None,
1053
+ 'fetchClosedOrders': {
1054
+ 'marginMode': True,
1055
+ 'limit': 500,
1056
+ 'daysBackClosed': None,
1057
+ 'daysBackCanceled': None,
1058
+ 'untilDays': 7,
1059
+ 'trigger': True,
1060
+ 'trailing': False,
1061
+ },
1062
+ 'fetchOHLCV': {
1063
+ 'limit': 1500,
1064
+ },
1065
+ },
1066
+ 'swap': {
1067
+ 'linear': None,
1068
+ 'inverse': None,
1069
+ },
1070
+ 'future': {
1071
+ 'linear': None,
1072
+ 'inverse': None,
1073
+ },
1074
+ },
1006
1075
  })
1007
1076
 
1008
1077
  def nonce(self):
@@ -2616,7 +2685,7 @@ class kucoin(Exchange, ImplicitAPI):
2616
2685
  await self.load_markets()
2617
2686
  lowercaseStatus = status.lower()
2618
2687
  until = self.safe_integer(params, 'until')
2619
- stop = self.safe_bool_2(params, 'stop', 'trigger', False)
2688
+ trigger = self.safe_bool_2(params, 'stop', 'trigger', False)
2620
2689
  hf = None
2621
2690
  hf, params = self.handle_hf_and_params(params)
2622
2691
  if hf and (symbol is None):
@@ -2642,7 +2711,7 @@ class kucoin(Exchange, ImplicitAPI):
2642
2711
  request['endAt'] = until
2643
2712
  request['tradeType'] = self.safe_string(self.options['marginModes'], marginMode, 'TRADE')
2644
2713
  response = None
2645
- if stop:
2714
+ if trigger:
2646
2715
  response = await self.privateGetStopOrder(self.extend(request, query))
2647
2716
  elif hf:
2648
2717
  if lowercaseStatus == 'active':
@@ -3054,6 +3123,10 @@ class kucoin(Exchange, ImplicitAPI):
3054
3123
  response = None
3055
3124
  request, params = self.handle_until_option('endAt', request, params)
3056
3125
  if hf:
3126
+ # does not return trades earlier than 2019-02-18T00:00:00Z
3127
+ if since is not None:
3128
+ # only returns trades up to one week after the since param
3129
+ request['startAt'] = since
3057
3130
  response = await self.privateGetHfFills(self.extend(request, params))
3058
3131
  elif method == 'private_get_fills':
3059
3132
  # does not return trades earlier than 2019-02-18T00:00:00Z