|
|
@@ -538,8 +538,52 @@ class ArbitrageProcess:
|
|
|
try:
|
|
|
is_arrived = False
|
|
|
|
|
|
+ # 先進行快速提現判斷,如果不滿足條件就走後面的等待充值模式,雙模,這個步驟最多等待10分鐘
|
|
|
+ waiting_times = 10
|
|
|
+ while waiting_times > 0:
|
|
|
+ time.sleep(60)
|
|
|
+ deposit_list = mexc.wallet.get_deposit_list()
|
|
|
+
|
|
|
+ # 是否已經在列表中了,抹茶識別充值會稍微有點慢,所以要耐心等
|
|
|
+ is_list = False
|
|
|
+ # pending中的數量
|
|
|
+ pending_amount = Decimal(0)
|
|
|
+ for deposit in deposit_list:
|
|
|
+ # 不屬于該路徑需要監聽的代幣
|
|
|
+ if deposit['coin'] != self.coin:
|
|
|
+ continue
|
|
|
+
|
|
|
+ # 處理pending數量
|
|
|
+ pending_amount = pending_amount + Decimal(deposit['amount'])
|
|
|
+
|
|
|
+ # 檢查到沒到列表中
|
|
|
+ if deposit['transHash'] != self.arbitrage_details['chain_buy_tx_hash']:
|
|
|
+ continue
|
|
|
+ is_list = True
|
|
|
+
|
|
|
+ # 檢查是否滿足快速提現的條件
|
|
|
+ if is_list == True:
|
|
|
+ # 交易所代幣余额判断
|
|
|
+ balances = mexc.trade.get_account_info()['balances']
|
|
|
+ asset_balance = 0
|
|
|
+ for balance in balances:
|
|
|
+ if balance['asset'] == self.coin:
|
|
|
+ asset_balance = Decimal(balance['free'])
|
|
|
+
|
|
|
+ # 最終判斷
|
|
|
+ if asset_balance > pending_amount:
|
|
|
+ msg = f"【flash】资产可以進行快速提現。{last_deposit_state}"
|
|
|
+ logging.info(msg)
|
|
|
+ add_state_flow_entry(self.process_item, self.current_state, msg, "success")
|
|
|
+
|
|
|
+ self._set_state(self.STATE_TRANSFERRING_TO_CHAIN)
|
|
|
+ return
|
|
|
+
|
|
|
+ logging.info(f"正在檢查快速提現條件...({waiting_times}/10)")
|
|
|
+ waiting_times = waiting_times - 1
|
|
|
+
|
|
|
# 最多等待30分钟
|
|
|
- waiting_times = 60
|
|
|
+ waiting_times = 30
|
|
|
last_deposit_state = None
|
|
|
while waiting_times > 0:
|
|
|
deposit_list = mexc.wallet.get_deposit_list()
|
|
|
@@ -561,7 +605,7 @@ class ArbitrageProcess:
|
|
|
self._set_state(self.STATE_TRANSFERRING_TO_CHAIN)
|
|
|
return
|
|
|
|
|
|
- time.sleep(30)
|
|
|
+ time.sleep(60)
|
|
|
waiting_times = waiting_times - 1
|
|
|
|
|
|
msg = f"等待充值到账超时(超过30分钟): {last_deposit_state}"
|