import os
import time
import pandas as pd
from datetime import datetime
import datetime
import mysql.connector
from tkinter import messagebox
from tkinter.messagebox import *
class test_volumncurve():
def __init__(self):
print()
def main_test_volumncurve(self,volumncurve_var,TtVolumncurveSymbol):
print("volumncurve_var",volumncurve_var)
print("TtVolumncurveSymbol", TtVolumncurveSymbol)
showinfo(title="友情提示", message="请输入数量")
if volumncurve_var =='经纪test':
self.config = {
'host': '10.125.44.22',
'port': 3306, # MySQL服务端口
'user': 'root',
'password': '123456',
'database': 'test',
'charset': 'utf8', # 字符集设置,根据实际情况调整
}
else:
self.config = {
'host': 'localhost',
'port': 3306, # MySQL服务端口
'user': 'root',
'password': '123456',
'database': 'test',
'charset': 'utf8', # 字符集设置,根据实际情况调整
}
cnx = mysql.connector.connect(**self.config)
# 创建游标对象
cursor = cnx.cursor()
# 执行SQL查询
sql = "SELECT id,user FROM users where user=%s and passWord=%s"
cursor.execute(sql, (userNameValue, passWordValue))
# 获取所有行
rows = cursor.fetchall()
print("rows", rows)
# # for row in rows:
# # print(row)
cursor.close()
cnx.close()
# 检查volumncurvedata表的数据
# volumncurvedata表,000001.SZ当天的数据
aaa = [917268, 523987, 439624, 311270, 325598, 304803, 314221, 301505, 265800, 348953, 262623, 227062, 215540,
225147, 209004, 238312, 182994, 245231, 231321, 282082, 282581, 227432, 243168, 246796, 210974, 203723,
255599, 225492, 173490, 267084, 322959, 218665, 267273, 300051, 186563, 229221, 196113, 186932, 242212,
156116, 177858, 187943, 187494, 162598, 169450, 179007, 207601, 165106, 201355, 286998, 247138, 155797,
183460, 160739, 138651, 135281, 145064, 162237, 196638, 246706, 273104, 219991, 174984, 177183, 166038,
142803, 179377, 205407, 177266, 165668, 140245, 149183, 162575, 170260, 179682, 198712, 158617, 136921,
128916, 172654, 145081, 187564, 153603, 131795, 152593, 135464, 127257, 192869, 104983, 122233, 169471,
243499, 143325, 187773, 134343, 126938, 233997, 159396, 167657, 113834, 175400, 176560, 159995, 199260,
114716, 110912, 133846, 93244, 117466, 90813, 134352, 115200, 149922, 146329, 105488, 85250, 106862,
95146, 88592, 118186, 656, 531289, 201913, 152491, 121465, 168830, 141656, 157740, 130935, 177172,
119703, 143595, 192589, 134077, 109609, 96820, 147047, 110034, 124525, 112686, 89668, 135949, 149520,
124964, 143690, 90758, 120074, 102882, 131925, 126400, 106182, 139894, 132419, 122101, 111685, 133773,
128576, 121567, 109090, 117718, 165038, 130146, 150316, 140534, 148419, 126237, 115497, 191304, 133303,
107709, 121863, 126076, 141429, 116191, 108273, 114293, 95377, 107729, 118975, 127892, 169764, 149696,
125366, 144793, 155408, 154450, 143780, 120356, 132899, 129566, 148468, 147780, 90444, 127592, 135672,
120631, 132775, 151529, 152174, 145876, 150605, 136213, 148829, 116275, 164598, 125083, 119136, 127526,
109062, 138172, 157055, 153551, 226426, 178254, 142904, 142890, 183435, 193871, 165417, 126984, 145179,
232642, 172682, 181527, 182066, 137478, 205863, 250874, 204900, 259169, 210688, 243598, 273103, 286060,
251448, 246892, 304095, 261094, 1590, 0, 0, 703027]
vols_value1 = []
# dailyminutevolumndata表,000001.SZ前30个交易日的数据,但不是每个交易日都会落库,在tradecalendar表查询交易日
data = pd.read_csv('C:\\Users\\AXZQ\\Desktop\\1000\\新建文件夹\\dailyminutevolumndata_202403220941.csv',
encoding='gb2312')
print('data长度', len(data))
for j in range(242):
vols_value = 0
for i in range(len(data)):
vols = data["vols"][i].split(",")
vols_value = vols_value + int(vols[j].replace("'", ""))
vols_value1.append(vols_value / len(data))
print("vols_value1", vols_value1)
print("vols_value1长度", len(vols_value1))
# 对比,如果数据有误,会打印出i的值
for i in range(len(aaa)):
# print(aaa[i] - bbb[i])
if abs(aaa[i] - vols_value1[i]) > 1:
print("i", i)
break