Explorar el Código

refactor(market_data_recorder): 移除未使用的价格差异和交易量字段

清理不再使用的price_diff_pct和lighter_volume字段,简化数据结构
skyfffire hace 1 semana
padre
commit
ac4d444734
Se han modificado 1 ficheros con 3 adiciones y 11 borrados
  1. 3 11
      src/record/market_data_recorder.py

+ 3 - 11
src/record/market_data_recorder.py

@@ -116,8 +116,6 @@ def write_batch_to_questdb(data_batch):
             symbol = item['symbol']
             binance_price = item['binance_price']
             lighter_price = item['lighter_price']
-            price_diff_pct = item['price_diff_pct']
-            lighter_volume = item['lighter_volume']
             
             # 构建表名,使用前缀和交易对作为表名
             table_name = f"{QUESTDB_TABLE_PREFIX}_{symbol}"
@@ -127,9 +125,7 @@ def write_batch_to_questdb(data_batch):
             line_protocol = (
                 f"{table_name} "
                 f"binance_price={binance_price},"
-                f"lighter_price={lighter_price},"
-                f"price_diff_pct={price_diff_pct},"
-                f"lighter_volume={lighter_volume} "
+                f"lighter_price={lighter_price} "
                 f"{timestamp_ns}"
             )
             lines.append(line_protocol)
@@ -164,8 +160,7 @@ def process_data(lighter_data, binance_data):
         symbol = item.get('symbol')
         if symbol:
             lighter_symbols[symbol] = {
-                'price': item.get('last_trade_price', 0),
-                'daily_volume': item.get('daily_base_token_volume', 0)
+                'price': item.get('last_trade_price', 0)
             }
     
     # 从Binance数据中提取交易对并收集匹配的数据
@@ -178,15 +173,12 @@ def process_data(lighter_data, binance_data):
         if base_symbol in lighter_symbols:
             binance_price = float(item.get('price', 0))
             lighter_price = lighter_symbols[base_symbol]['price']
-            price_diff_pct = ((binance_price - lighter_price) / binance_price * 100) if binance_price > 0 else 0
             
             symbol_data = {
                 'symbol': base_symbol,
                 'binance_price': binance_price,
                 'lighter_price': lighter_price,
-                'binance_symbol': binance_symbol,
-                'lighter_volume': lighter_symbols[base_symbol]['daily_volume'],
-                'price_diff_pct': price_diff_pct
+                'binance_symbol': binance_symbol
             }
             batch_data.append(symbol_data)