|
|
@ -45,18 +45,43 @@ def get_delta_blue(_blue_data): |
|
|
|
print(get_delta_blue(get_all_blue())) |
|
|
|
print(get_delta_blue(get_all_blue())) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_all_prv_blue_list(_all_data, _last_blue_list, _num): |
|
|
|
|
|
|
|
all_prv_blue_list = [] |
|
|
|
|
|
|
|
min_id, max_id = 1, _all_data[-1]['id'] # 获取最大和最小id |
|
|
|
|
|
|
|
for n in range(len(_last_blue_list)): |
|
|
|
|
|
|
|
# print(_last_blue_list[n]) |
|
|
|
|
|
|
|
for _data in _all_data: |
|
|
|
|
|
|
|
if _data['blue'] == _last_blue_list[n]: |
|
|
|
|
|
|
|
_id = _data['id'] + _num - n |
|
|
|
|
|
|
|
if min_id <= _id <= max_id: |
|
|
|
|
|
|
|
# print(f"{_data['id']} - {_id}") |
|
|
|
|
|
|
|
all_prv_blue_list.append(_id) |
|
|
|
|
|
|
|
return sorted(set(all_prv_blue_list)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 获取预测的数据 |
|
|
|
# 获取预测的数据 |
|
|
|
def get_blue_forecast(_blue_data, _method, _num): |
|
|
|
def get_blue_forecast(_all_data, _method, _num): |
|
|
|
last_blue = db_get_last_data()['blue'] |
|
|
|
last_blue = db_get_last_data()['blue'] |
|
|
|
if last_blue is False: |
|
|
|
if last_blue is False: |
|
|
|
return False |
|
|
|
return False |
|
|
|
if _method == 'prv': # 当前一期往前推num期,包含此期数据 |
|
|
|
blue_id_list = [] |
|
|
|
prv_blue_id_list = [] |
|
|
|
for _data in _all_data: |
|
|
|
for _data in _blue_data: |
|
|
|
|
|
|
|
if _data['blue'] == last_blue: |
|
|
|
if _data['blue'] == last_blue: |
|
|
|
print(_data) |
|
|
|
blue_id_list.append(_data['id']) |
|
|
|
prv_blue_id_list.append(_data['id']) |
|
|
|
print(blue_id_list) |
|
|
|
|
|
|
|
min_id, max_id = 1, _all_data[-1]['id'] # 获取最大和最小id |
|
|
|
|
|
|
|
""" |
|
|
|
|
|
|
|
当_num=3时 |
|
|
|
|
|
|
|
先取当前一期的蓝球号码,然后计算历史上相同蓝球出现的后一期蓝球 |
|
|
|
|
|
|
|
然后往前推一期,取这一期蓝球号码,统计这个号码后两期的蓝球(不包含后一期) |
|
|
|
|
|
|
|
然后再往前推一期,取这一期蓝球号码,统计这个号码后三期的蓝球(不包含后一期和后两期) |
|
|
|
|
|
|
|
""" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if _method == 'prv': # 当前一期往前推num期,包含此期数据 |
|
|
|
|
|
|
|
recent_blue_id_list = [d['blue'] for d in _all_data[-_num:]] |
|
|
|
|
|
|
|
prv_blue_id_list = get_all_prv_blue_list(_all_data, recent_blue_id_list, _num) |
|
|
|
print(prv_blue_id_list) |
|
|
|
print(prv_blue_id_list) |
|
|
|
|
|
|
|
|
|
|
|
elif _method == 'post': # 当前一期往后num期,不包含此期的数据 |
|
|
|
elif _method == 'post': # 当前一期往后num期,不包含此期的数据 |
|
|
|
pass |
|
|
|
pass |
|
|
|
else: |
|
|
|
else: |
|
|
|