| 12345678910111213141516171819202122232425262728 |
- import sqlite3
- from datetime import datetime
- conn = sqlite3.connect('data/trading_data_20251103.db')
- cursor = conn.cursor()
- print('=== Price Data (最新10条) ===')
- cursor.execute('SELECT * FROM price_data ORDER BY timestamp DESC LIMIT 10')
- rows = cursor.fetchall()
- for row in rows:
- ts = datetime.fromtimestamp(row[1]).strftime('%Y-%m-%d %H:%M:%S')
- print(f"时间: {ts}, 标的: {row[3]}, Binance: {row[5]}, Lighter: {row[4]}, 价差: {row[6]} bps")
- print('\n=== Trading Events (最新10条) ===')
- cursor.execute('SELECT * FROM trading_events ORDER BY timestamp DESC LIMIT 10')
- rows = cursor.fetchall()
- for row in rows:
- ts = datetime.fromtimestamp(row[1]).strftime('%Y-%m-%d %H:%M:%S')
- print(f"时间: {ts}, 标的: {row[3]}, 事件: {row[4]}, 价格: {row[5]}, 状态: {row[8]}")
- print('\n=== 数据统计 ===')
- cursor.execute('SELECT COUNT(*) FROM price_data')
- print(f"价格数据总数: {cursor.fetchone()[0]}")
- cursor.execute('SELECT COUNT(*) FROM trading_events')
- print(f"交易事件总数: {cursor.fetchone()[0]}")
- conn.close()
|