Ver Fonte

利润展示方式更新

skyfffire há 3 meses atrás
pai
commit
7de4a8e0c0
3 ficheiros alterados com 8 adições e 5 exclusões
  1. 1 0
      as.py
  2. 4 4
      monitor.html
  3. 3 1
      s_erc20_to_mexc.py

+ 1 - 0
as.py

@@ -325,6 +325,7 @@ def handle_submit_process():
         process_id = str(uuid.uuid4()) # 生成唯一流程ID
         process_item = copy.deepcopy(data)
         process_item['id'] = process_id
+        process_item['profit'] = Decimal(0)
         process_item['creationTime'] = get_formatted_timestamp(), # 创建时间
         process_item['stateFlow'] = [] # 状态流转记录
         process_item['currentState'] = "PENDING_START"

+ 4 - 4
monitor.html

@@ -79,7 +79,7 @@
                             <tr>
                                 <th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">交易对</th>
                                 <th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">当前状态</th>
-                                <th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider hidden md:table-cell">利润/阈值</th>
+                                <th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider hidden md:table-cell">利润</th>
                                 <th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider hidden sm:table-cell">创建时间</th>
                                 <th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">操作</th>
                             </tr>
@@ -97,7 +97,7 @@
                            <tr>
                                 <th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">交易对</th>
                                 <th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">最终状态</th>
-                                <th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider hidden md:table-cell">利润/阈值</th>
+                                <th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider hidden md:table-cell">利润</th>
                                 <th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider hidden sm:table-cell">创建时间</th>
                                 <th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">操作</th>
                             </tr>
@@ -215,7 +215,7 @@
         function createTableRow(task) {
             const tr = document.createElement('tr');
             tr.className = 'hover:bg-gray-50 transition duration-150';
-            const profitText = task.profit && task.profitLimit ? `${task.profit} (${task.profitLimit})` : (task.profit || 'N/A');
+            const profitText = task.profit ? `${task.profit}` : ('N/A');
             
             tr.innerHTML = `
                 <td class="px-4 py-3 whitespace-nowrap text-sm font-medium text-gray-900">${task.symbol || 'N/A'}</td>
@@ -341,7 +341,7 @@
                 ["目标代币", `${task.toTokenAmountHuman || 'N/A'} ${task.toToken || ''}`],
                 ["创建时间", task.creationTime || 'N/A'],
                 ["利润", task.profit || 'N/A'],
-                ["利润阈值", task.profitLimit || 'N/A']
+                // ["利润阈值", task.profitLimit || 'N/A']
             ]);
             
             infoMap.forEach((value, label) => {

+ 3 - 1
s_erc20_to_mexc.py

@@ -435,7 +435,7 @@ class ArbitrageProcess:
                                     else:
                                         msg = f"交易所剩余{self.base_coin}: {free_balance}, 准备使用 {pseudo_value_to_buy}, fp {dex_price}, 挂单价格{ready_order_price},  余额校验通过。"
                                         logger.info(msg)
-                                        add_state_flow_entry(self.process_item, self.current_state, msg, "success")
+                                        # add_state_flow_entry(self.process_item, self.current_state, msg, "success")
                                         break
 
                         # 实际能购入的数量(可能会亏损导致买不回来, 所以要考虑实际有多少money)
@@ -526,6 +526,8 @@ class ArbitrageProcess:
             else:
                 msg = f"套利流程完成, 全部回补。最终利润: {realized_profit}, 总卖值: {self.sell_value}, 总买值: {self.buy_value}"
 
+            self.process_item['profit'] = realized_profit
+
             logger.info(msg)
             add_state_flow_entry(self.process_item, self.current_state, msg, "success")