QTrade/tests/temp/check_tables.py
cuizhan a7776a5449 添加README.md和整理临时文件
新增:
- README.md: 完整的项目说明文档
  - 系统简介和核心特性
  - 技术栈和目录结构
  - 快速开始和配置说明
  - 使用示例和开发文档
  - 数据表设计和扩展指南
  - 更新日志和常见问题

整理:
- 移动临时测试脚本到 tests/temp/ 目录
  - check_1m_data.py
  - check_indicators.py
  - check_precision.py
  - check_tables.py
  - check_table_structure.py
  - test_calc_indicators.py
2025-12-17 23:06:02 +08:00

55 lines
1.5 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""检查数据库中的所有表"""
from src.database_manager.db_manager import DatabaseManager
def main():
db = DatabaseManager()
database = "qtrade_backtest"
# 获取所有表名
tables = db.list_tables(database)
# 分类统计
klines = []
indicators = []
business = []
old_format = [] # 旧格式的指标表(indicator_period 格式)
for table_name in tables:
if table_name.startswith("klines_"):
klines.append(table_name)
elif table_name.startswith("indicators_"):
indicators.append(table_name)
elif "_" in table_name and any(
table_name.startswith(ind)
for ind in ["macd", "kdj", "boll", "rsi", "ma", "ema"]
):
old_format.append(table_name)
else:
business.append(table_name)
print(f"总表数: {len(tables)}")
print(f"\n=== K线表 ({len(klines)}) ===")
for t in sorted(klines):
print(f" {t}")
print(f"\n=== 指标表(新格式: indicators_period_indicator)({len(indicators)}) ===")
for t in sorted(indicators):
print(f" {t}")
print(f"\n=== 旧格式指标表(indicator_period)({len(old_format)}) ===")
if old_format:
for t in sorted(old_format):
print(f" {t}")
else:
print(" (无)")
print(f"\n=== 业务表 ({len(business)}) ===")
for t in sorted(business):
print(f" {t}")
if __name__ == "__main__":
main()