initial-import: 2026-04-11 21:18:55

This commit is contained in:
cfdaily
2026-04-11 21:18:55 +08:00
commit 5e6b2d73eb
264 changed files with 117047 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
#!/usr/bin/env python3
"""
检查sqlite数据库中有多少bar数据
"""
import sqlite3
db_path = '/root/.vntrader/database.db'
conn = sqlite3.connect(db_path)
cursor = conn.cursor()
print(f"📊 数据库: {db_path}")
# 查看所有表
cursor.execute("SELECT name FROM sqlite_master WHERE type='table';")
tables = cursor.fetchall()
print(f"\n📋 所有表:")
for table in tables:
print(f" {table[0]}")
# 查看bar_data表
print(f"\n📊 bar_data表统计:")
try:
cursor.execute("SELECT COUNT(*) FROM bar_data;")
count = cursor.fetchone()[0]
print(f" 总共有 {count} 条bar数据")
# 查看所有symbol
cursor.execute("SELECT DISTINCT symbol, exchange FROM bar_data;")
symbols = cursor.fetchall()
print(f" 标的列表:")
for symbol, exchange in symbols:
cursor.execute("SELECT COUNT(*) FROM bar_data WHERE symbol = ? AND exchange = ?", (symbol, exchange))
cnt = cursor.fetchone()[0]
print(f" {symbol}.{exchange}: {cnt}")
# 看一下时间范围
cursor.execute("SELECT MIN(datetime), MAX(datetime) FROM bar_data WHERE symbol = ? AND exchange = ?", (symbol, exchange))
min_dt, max_dt = cursor.fetchone()
print(f" 时间范围: {min_dt} ~ {max_dt}")
except Exception as e:
print(f"❌ 查询失败: {e}")
conn.close()
print("\n✅ 查询完成")