QTrade/tests/temp/check_precision.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

54 lines
1.4 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.

"""验证159915.SZ的数据精度"""
import pymysql
conn = pymysql.connect(
host="localhost", user="root", password="1234", database="qtrade_backtest"
)
cursor = conn.cursor()
# 查看159915.SZ的1m数据样例
print("159915.SZ的1m数据样例(最近10条):")
cursor.execute("""
SELECT timestamp, open, high, low, close
FROM klines_1m
WHERE symbol='159915.SZ'
ORDER BY timestamp DESC
LIMIT 10
""")
rows = cursor.fetchall()
for row in rows:
print(f"时间: {row[0]}, 开: {row[1]}, 高: {row[2]}, 低: {row[3]}, 收: {row[4]}")
# 查看159915.SZ的1d数据样例
print("\n159915.SZ的1d数据样例(最近10条):")
cursor.execute("""
SELECT timestamp, open, high, low, close
FROM klines_1d
WHERE symbol='159915.SZ'
ORDER BY timestamp DESC
LIMIT 10
""")
rows = cursor.fetchall()
for row in rows:
print(f"时间: {row[0]}, 开: {row[1]}, 高: {row[2]}, 低: {row[3]}, 收: {row[4]}")
# 检查是否有3位小数的价格
print("\n检查是否有3位小数的价格(例如 x.xx5, x.xx1 等):")
cursor.execute("""
SELECT timestamp, close
FROM klines_1m
WHERE symbol='159915.SZ'
AND (close * 1000) % 10 != 0
LIMIT 5
""")
rows = cursor.fetchall()
if rows:
print("找到3位小数的价格:")
for row in rows:
print(f" 时间: {row[0]}, 收盘: {row[1]}")
else:
print("未找到3位小数的价格,可能数据被截断了")
conn.close()