@@ -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)
@@ -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:
# 接受消息
@@ -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()