添加投注定时器脚本

This commit is contained in:
2026-01-23 09:19:21 +08:00
parent 9c2153b05b
commit 96afd7fd27
4 changed files with 71 additions and 145 deletions

View File

@@ -55,7 +55,7 @@ def generate_time_series(start_str, end_str):
return series
def main():
predictor = LotteryPredictorV6('data_test_predict/aggregated_stats_v7.json')
predictor = LotteryPredictorV6('data_test_predict/aggregated_stats_v7.py')
with open("full_history_time_performance.json", "r", encoding="utf-8") as f:
time_windows = json.load(f)

View File

@@ -1,143 +0,0 @@
{
"by_time": {
"00:05:00": {
"result_pos_prob": {
"pos_0": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
"pos_1": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
"pos_2": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
"pos_3": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
"pos_4": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
"pos_5": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
"pos_6": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
"pos_7": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
"pos_8": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
"pos_9": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1}
},
"result_pos_detail_prob": {
"pos_0": {
"big_small": {"大": 0.5, "小": 0.5},
"odd_even": {"单": 0.5, "双": 0.5}
},
"pos_1": {
"big_small": {"大": 0.5, "小": 0.5},
"odd_even": {"单": 0.5, "双": 0.5}
},
"pos_2": {
"big_small": {"大": 0.5, "小": 0.5},
"odd_even": {"单": 0.5, "双": 0.5}
},
"pos_3": {
"big_small": {"大": 0.5, "小": 0.5},
"odd_even": {"单": 0.5, "双": 0.5}
},
"pos_4": {
"big_small": {"大": 0.5, "小": 0.5},
"odd_even": {"单": 0.5, "双": 0.5}
},
"pos_5": {
"big_small": {"大": 0.5, "小": 0.5},
"odd_even": {"单": 0.5, "双": 0.5}
},
"pos_6": {
"big_small": {"大": 0.5, "小": 0.5},
"odd_even": {"单": 0.5, "双": 0.5}
},
"pos_7": {
"big_small": {"大": 0.5, "小": 0.5},
"odd_even": {"单": 0.5, "双": 0.5}
},
"pos_8": {
"big_small": {"大": 0.5, "小": 0.5},
"odd_even": {"单": 0.5, "双": 0.5}
},
"pos_9": {
"big_small": {"大": 0.5, "小": 0.5},
"odd_even": {"单": 0.5, "双": 0.5}
}
},
"winner_prob": {
"3": 0.05, "4": 0.05, "5": 0.05, "6": 0.05, "7": 0.05, "8": 0.05, "9": 0.05, "10": 0.05, "11": 0.1,
"12": 0.05, "13": 0.05, "14": 0.05, "15": 0.05, "16": 0.05, "17": 0.05, "18": 0.05, "19": 0.05
},
"GD1_prob": {"冠亚大": 0.5, "冠亚小": 0.5},
"GD2_prob": {"冠亚单": 0.5, "冠亚双": 0.5},
"GLH_pos_prob": {
"pos_0": {"龙": 0.5, "虎": 0.5},
"pos_1": {"龙": 0.5, "虎": 0.5},
"pos_2": {"龙": 0.5, "虎": 0.5},
"pos_3": {"龙": 0.5, "虎": 0.5},
"pos_4": {"龙": 0.5, "虎": 0.5}
}
}
},
"by_date": {
"1": {
"result_pos_prob": {
"pos_0": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
"pos_1": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
"pos_2": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
"pos_3": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
"pos_4": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
"pos_5": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
"pos_6": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
"pos_7": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
"pos_8": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
"pos_9": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1}
},
"result_pos_detail_prob": {
"pos_0": {
"big_small": {"大": 0.5, "小": 0.5},
"odd_even": {"单": 0.5, "双": 0.5}
}
},
"winner_prob": {
"3": 0.05, "4": 0.05, "5": 0.05, "6": 0.05, "7": 0.05, "8": 0.05, "9": 0.05, "10": 0.05, "11": 0.1,
"12": 0.05, "13": 0.05, "14": 0.05, "15": 0.05, "16": 0.05, "17": 0.05, "18": 0.05, "19": 0.05
},
"GD1_prob": {"冠亚大": 0.5, "冠亚小": 0.5},
"GD2_prob": {"冠亚单": 0.5, "冠亚双": 0.5},
"GLH_pos_prob": {
"pos_0": {"龙": 0.5, "虎": 0.5},
"pos_1": {"龙": 0.5, "虎": 0.5},
"pos_2": {"龙": 0.5, "虎": 0.5},
"pos_3": {"龙": 0.5, "虎": 0.5},
"pos_4": {"龙": 0.5, "虎": 0.5}
}
}
},
"by_week": {
"0": {
"result_pos_prob": {
"pos_0": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
"pos_1": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
"pos_2": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
"pos_3": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
"pos_4": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
"pos_5": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
"pos_6": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
"pos_7": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
"pos_8": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1},
"pos_9": {"1": 0.1, "2": 0.1, "3": 0.1, "4": 0.1, "5": 0.1, "6": 0.1, "7": 0.1, "8": 0.1, "9": 0.1, "10": 0.1}
},
"result_pos_detail_prob": {
"pos_0": {
"big_small": {"大": 0.5, "小": 0.5},
"odd_even": {"单": 0.5, "双": 0.5}
}
},
"winner_prob": {
"3": 0.05, "4": 0.05, "5": 0.05, "6": 0.05, "7": 0.05, "8": 0.05, "9": 0.05, "10": 0.05, "11": 0.1,
"12": 0.05, "13": 0.05, "14": 0.05, "15": 0.05, "16": 0.05, "17": 0.05, "18": 0.05, "19": 0.05
},
"GD1_prob": {"冠亚大": 0.5, "冠亚小": 0.5},
"GD2_prob": {"冠亚单": 0.5, "冠亚双": 0.5},
"GLH_pos_prob": {
"pos_0": {"龙": 0.5, "虎": 0.5},
"pos_1": {"龙": 0.5, "虎": 0.5},
"pos_2": {"龙": 0.5, "虎": 0.5},
"pos_3": {"龙": 0.5, "虎": 0.5},
"pos_4": {"龙": 0.5, "虎": 0.5}
}
}
}
}

View File

@@ -0,0 +1,69 @@
package com.tem.bocai.schedules;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
@Component
public class BetSchedule {
// 从6:15分开始每隔5分钟投注一次6:15, 6:20, 6:25...23:25
@Scheduled(cron = "0 15/5 6-23 * * ?")
public void placeBet() {
LocalDateTime now = LocalDateTime.now();
int hour = now.getHour();
int minute = now.getMinute();
// 检查是否在6:15到23:25之间
if ((hour < 6) || (hour == 6 && minute < 15) ||
(hour > 23) || (hour == 23 && minute > 25)) {
String currentTime = now.format(
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")
);
System.out.println(currentTime + " - 不在投注时间范围内,跳过执行");
return;
}
String currentTime = now.format(
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")
);
System.out.println(currentTime + " - 开始执行投注...");
try {
// 模拟投注逻辑
executeBet();
System.out.println(currentTime + " - 投注执行完成");
} catch (Exception e) {
System.err.println(currentTime + " - 投注执行失败:");
e.printStackTrace();
}
}
/**
* 执行投注逻辑
*/
private void executeBet() {
// 这里实现具体的投注逻辑
// 1. 获取投注号码
// 2. 计算投注金额
// 3. 执行投注操作
// 4. 记录投注结果
// 模拟投注过程
System.out.println(" - 生成投注号码...");
System.out.println(" - 计算投注金额...");
System.out.println(" - 提交投注...");
System.out.println(" - 记录投注结果...");
// 模拟网络延迟
try {
Thread.sleep(1000); // 模拟1秒的处理时间
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
}

View File

@@ -23,7 +23,7 @@ public class CrawlerSchedule {
// 每天凌晨2点执行爬取开奖结果
//@Scheduled(cron = "0 0 2 * * ?")
// 每7秒执行一次爬取开奖结果
//@Scheduled(cron = "*/9 * * * * ?")
@Scheduled(cron = "*/9 * * * * ?")
public void executeLotteryDraw() {
System.out.println("开始爬取开奖结果...");
int retryCount = 0;