以实际情况为准!以实际情况为准!以实际情况为准!
重要的事情说三遍!!
一、前景表述
风险提示:
1.彩票无规律可循
2.所有测试数据仅供参考
3.一切以娱乐为主
4.彩票有风险!有风险!小编亲测
二、代码模块
代码解析
1.使用模块
import json
import os
import random
from itertools import combinations
import time
import requests
2.拉取初始数据
headers = {
'user-agent': 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.114 Mobile Safari/537.36 Edg/103.0.1264.62'
}
access_token = requests.get(
"https://webapi.sporttery.cn/gateway/lottery/getHistoryPageListV1.qry?gameNo=85&provinceId=0&pageSize=100&isVerify"
"=1&pageNo=1",
headers=headers)
access_token_data = access_token.json()
print("抓取数据:", len(access_token_data['value']['list']))
3.制作喂养数据
# 喂养数据100条
desktop_path = os.path.join(os.path.join(os.path.join(os.environ['USERPROFILE']), 'Desktop'), '数据喂养')
os.makedirs(desktop_path, exist_ok=True)
file_path = os.path.join(desktop_path, '1.json')
with open(file_path, 'w') as file:
json.dump(access_token_data['value']['list'], file)
# 打开文件并读取内容
with open(file_path, 'r') as file:
content = file.read()
result_list = json.loads(content)
print("数据读取:", len(result_list))
print("***START***")
4.核心算法(伪仿生)
def suanfa():
# 定义选择
random_number = random.randint(0, 1)
if random_number:
front_zone_1 = random.sample(range(1, 10), 1)
front_zone_2 = random.sample(range(10, 25), 3)
front_zone_3 = random.sample(range(25, 36), 1)
front_zone = front_zone_1 + front_zone_2 + front_zone_3
front_zone.sort()
back_zone = random.sample(range(1, 13), 2)
back_zone.sort()
max_s = front_zone + back_zone
return max_s
else:
front_zone = random.sample(range(1, 36), 5)
front_zone.sort()
back_zone = random.sample(range(1, 13), 2)
back_zone.sort()
max_s = front_zone + back_zone
return max_s
5.中奖查询算法
def suanshu(max_s, zt_num):
global qb_yl
try:
string = max_s[0:6]
string_num = max_s[6:]
# print(zt_num)
numbers = tuple(map(int, zt_num.split()))
# print(numbers)
combinations_list = list(combinations(string, 5))
data_s = {}
for i, combination in enumerate(combinations_list):
# print(numbers[0:5])
# print(combination)
intersection = set(string).intersection(set(numbers[0:5]))
count = len(intersection)
# print(count)
intersection_hou = set(tuple(string_num)).intersection(set(numbers[5:]))
count_hou = len(intersection_hou)
cs_st = f'{count}+{count_hou}'
# print(cs_st)
if str(cs_st) == "5+2":
dict_data = {
'profit': 1000000,
'result': f'{count}+{count_hou}',
'number': [combination, tuple(string_num)]
}
elif str(cs_st) == "5+1":
dict_data = {
'profit': 100000,
'result': f'{count}+{count_hou}',
'number': [combination, tuple(string_num)]
}
elif str(cs_st) == "5+0":
dict_data = {
'profit': 10000,
'result': f'{count}+{count_hou}',
'number': [combination, tuple(string_num)]
}
elif str(cs_st) == "4+2":
dict_data = {
'profit': 3000,
'result': f'{count}+{count_hou}',
'number': [combination, tuple(string_num)]
}
elif str(cs_st) == "4+1":
dict_data = {
'profit': 300,
'result': f'{count}+{count_hou}',
'number': [combination, tuple(string_num)]
}
elif str(cs_st) == "3+2":
dict_data = {
'profit': 200,
'result': f'{count}+{count_hou}',
'number': [combination, tuple(string_num)]
}
elif str(cs_st) == "4+0":
dict_data = {
'profit': 100,
'result': f'{count}+{count_hou}',
'number': [combination, tuple(string_num)]
}
elif str(cs_st) == "3+1" or str(cs_st) == "2+2":
dict_data = {
'profit': 15,
'result': f'{count}+{count_hou}',
'number': [combination, tuple(string_num)]
}
elif str(cs_st) == "3+0" or str(cs_st) == "1+2" or str(cs_st) == "2+1" or str(cs_st) == "0+2":
dict_data = {
'profit': 5,
'result': f'{count}+{count_hou}',
'number': [combination, tuple(string_num)]
}
else:
dict_data = {
'profit': 0,
'result': f'{count}+{count_hou}',
'number': [combination, tuple(string_num)]
}
data_s[f'data_{i + 1}'] = dict_data
data = {
'message': "200",
'api_num': string_num,
'version': 'AMM_1.0',
'api_max': data_s["data_1"]["profit"] + data_s["data_2"]["profit"] + data_s["data_3"]["profit"] +
data_s["data_4"]["profit"] + data_s["data_5"]["profit"] + data_s["data_6"]["profit"],
'ammbox': data_s
}
json_data = json.dumps(data)
# print(json_data)
# print("状态:", data['api_max'])
qb_yl = qb_yl + data['api_max']
except:
print('****执行错误****')
6.测试模块(追号版)
ix_s = 0
ix_s_70 = 0
ix_s_1000 = 0
# print(sum_x)
for iq in range(100):
qb = 12000
qb_s = 12000
qb_yl = 0
sum_x = [suanfa() for _ in range(100)]
for i in result_list[0:48]:
qb = qb - 2
# time.sleep(0.05)
for im in range(1):
# print(im)
suanshu(sum_x[im], i['lotteryDrawResult'])
print("***第" + str(iq + 1) + "轮算法记录***")
# print("钱包:", qb+qb_yl)
# print("成本支出:", qb_s-qb)
print("算法收获:", qb_yl)
# print("分析:", qb_yl-qb_s+qb)
rate = qb_yl / (qb_s - qb)
percentage = rate * 100
if percentage > 100:
ix_s = ix_s + 1
if percentage > 1000:
ix_s_1000 = ix_s_1000 + 1
if percentage < 70:
ix_s_70 = ix_s_70 + 1
print("利率: {:.2f}%".format(percentage))
print("*****测试*****")
print("1000以上次数:" + str(ix_s_1000))
print("100以上次数:" + str(ix_s))
print("70以下次数:" + str(ix_s_70))
7.测试模块(数据碰撞版)
ix_s = 0
ix_s_70 = 0
ix_s_1000 = 0
# print(sum_x)
for iq in range(100):
qb = 12000
qb_s = 12000
qb_yl = 0
for i in result_list[0:48]:
qb = qb - 2
# time.sleep(0.05)
for im in range(1):
# print(im)
suanshu(suanfa(), i['lotteryDrawResult'])
print("***第" + str(iq + 1) + "轮算法记录***")
# print("钱包:", qb+qb_yl)
# print("成本支出:", qb_s-qb)
print("算法收获:", qb_yl)
# print("分析:", qb_yl-qb_s+qb)
rate = qb_yl / (qb_s - qb)
percentage = rate * 100
if percentage > 100:
ix_s = ix_s + 1
if percentage > 1000:
ix_s_1000 = ix_s_1000 + 1
if percentage < 70:
ix_s_70 = ix_s_70 + 1
print("利率: {:.2f}%".format(percentage))
print("*****测试*****")
print("1000以上次数:" + str(ix_s_1000))
print("100以上次数:" + str(ix_s))
print("70以下次数:" + str(ix_s_70))
三、算法预测
1.数据模拟
1.随机碰撞
描述:16次测试,单次跑250条数据,追期100期
抓取数据: 100
数据读取: 100
***START***
***第1轮算法记录***
算法收获: 127560
利率: 255.12%
***第2轮算法记录***
算法收获: 67980
利率: 135.96%
***第3轮算法记录***
算法收获: 66420
利率: 132.84%
***第4轮算法记录***
算法收获: 669660
利率: 1339.32%
***第5轮算法记录***
算法收获: 71820
利率: 143.64%
***第6轮算法记录***
算法收获: 61920
利率: 123.84%
***第7轮算法记录***
算法收获: 58110
利率: 116.22%
***第8轮算法记录***
算法收获: 127590
利率: 255.18%
***第9轮算法记录***
算法收获: 72600
利率: 145.20%
***第10轮算法记录***
算法收获: 71490
利率: 142.98%
***第11轮算法记录***
算法收获: 72660
利率: 145.32%
***第12轮算法记录***
算法收获: 124950
利率: 249.90%
***第13轮算法记录***
算法收获: 75390
利率: 150.78%
***第14轮算法记录***
算法收获: 1263750
利率: 2527.50%
***第15轮算法记录***
算法收获: 133260
利率: 266.52%
***第16轮算法记录***
算法收获: 723270
利率: 1446.54%
分析:测试结果无亏损(数据仅供参考)
2.追号碰撞
描述:10次测试,单次跑250条数据,追期100期
抓取数据: 100
数据读取: 100
***START***
***第1轮算法记录***
算法收获: 127950
利率: 255.90%
***第2轮算法记录***
算法收获: 117300
利率: 234.60%
***第3轮算法记录***
算法收获: 124410
利率: 248.82%
***第4轮算法记录***
算法收获: 72870
利率: 145.74%
***第5轮算法记录***
算法收获: 61260
利率: 122.52%
***第6轮算法记录***
算法收获: 68460
利率: 136.92%
***第7轮算法记录***
算法收获: 62130
利率: 124.26%
***第8轮算法记录***
算法收获: 125550
利率: 251.10%
***第9轮算法记录***
算法收获: 134010
利率: 268.02%
***第10轮算法记录***
算法收获: 138720
利率: 277.44%
分析:测试结果无亏损(数据仅供参考)
解释:
由于文章篇幅问题,仅挑选部分数据,具体数据以实际情况为准。