فهرست منبع

为kucoin做的单独修改,本地修改把代理还是什么加进去之后改炸了。

skyfffire 2 سال پیش
والد
کامیت
0fd12d6f51
3فایلهای تغییر یافته به همراه7 افزوده شده و 3 حذف شده
  1. 1 1
      exchange/kucoin_usdt_swap_rest.py
  2. 5 1
      exchange/kucoin_usdt_swap_ws.py
  3. 1 1
      strategy.py

+ 1 - 1
exchange/kucoin_usdt_swap_rest.py

@@ -189,7 +189,7 @@ class KucoinUsdtSwapRest:
                 'tradeType':'TRADE',
             }
             response, error = await self._request('GET', '/api/v1/orders', params=params, auth=1)
-            if response is not None:
+            if response is not None and response['data']['items'] is not None:
                 for i in response['data']['items']:
                     res = await self.cancel_order(order_id=i["id"])
                     self.logger.info(res)

+ 5 - 1
exchange/kucoin_usdt_swap_ws.py

@@ -350,7 +350,11 @@ class KucoinUsdtSwapWs:
                             f"/contractMarket/tradeOrders:{self.symbol}",
                         ]
                     for i in channels:
-                        sub_str = ujson.dumps({"topic": i, "type":"subscribe"})
+                        sub_str = ujson.dumps({"topic": i, "type": "subscribe"})
+                        if "/contractMarket/level2Depth50" not in i and "/contractMarket/execution" not in i:
+                            sub_str = ujson.dumps(
+                                {"topic": i, "type": "subscribe", "privateChannel": True, "response": True}
+                            )
                         await _ws.send_str(sub_str)
                     while True:
                         # 接受消息

+ 1 - 1
strategy.py

@@ -48,7 +48,7 @@ class Strategy:
         self.total_amount = 0.0
         self.ready = 0
         self._is_print = is_print
-        self._min_amount_value = 30.0  # 最小下单额 防止下单失败
+        self._min_amount_value = 5.0  # 最小下单额 防止下单失败
         self._max_amount_value = 10000.0  # 最大下单额 防止下单过重 平不掉就很悲剧
         self.local_time = time.time()
         self.local_start_time = time.time()