Przeglądaj źródła

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

skyfffire 2 lat temu
rodzic
commit
0fd12d6f51

+ 1 - 1
exchange/kucoin_usdt_swap_rest.py

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

+ 5 - 1
exchange/kucoin_usdt_swap_ws.py

@@ -350,7 +350,11 @@ class KucoinUsdtSwapWs:
                             f"/contractMarket/tradeOrders:{self.symbol}",
                             f"/contractMarket/tradeOrders:{self.symbol}",
                         ]
                         ]
                     for i in channels:
                     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)
                         await _ws.send_str(sub_str)
                     while True:
                     while True:
                         # 接受消息
                         # 接受消息

+ 1 - 1
strategy.py

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