调整金额
This commit is contained in:
@@ -63,6 +63,15 @@ def get_history_records(data_dirs):
|
||||
return all_records
|
||||
|
||||
|
||||
def generate_time_series(start, end):
|
||||
current = start
|
||||
series = []
|
||||
while current <= end:
|
||||
series.append(current)
|
||||
current += timedelta(minutes=5)
|
||||
return series
|
||||
|
||||
|
||||
def main(next_period_time, df):
|
||||
entry = {
|
||||
"id": next_period_time.strftime('%Y%m%d%H%M'),
|
||||
@@ -77,22 +86,37 @@ def main(next_period_time, df):
|
||||
if next_period_time.strftime('%H:%M:%S') in EMPTY_TIME_WINDOWS:
|
||||
return entry
|
||||
|
||||
result = []
|
||||
predictor = LotteryPredictorV14Profit()
|
||||
|
||||
next_period_time = pd.to_datetime(next_period_time)
|
||||
recent_x = df[df['time'] < next_period_time].tail(10000)
|
||||
predictor.check_init_daily_pnl_tracker(next_period_time)
|
||||
predictions = predictor.predict(next_period_time, recent_x)
|
||||
start_time, _ = predictor.check_init_daily_pnl_tracker(next_period_time)
|
||||
time_series = generate_time_series(start_time, next_period_time)
|
||||
|
||||
for pos, nums_bet in predictions.items():
|
||||
if not nums_bet:
|
||||
continue
|
||||
entry['result'][pos] = nums_bet
|
||||
for dt in time_series:
|
||||
entry = {
|
||||
"id": dt.strftime('%Y%m%d%H%M'),
|
||||
"time": dt.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
"result": {i: {n: None for n in range(1, 11)} for i in range(10)},
|
||||
"result_detail": {i: {"单": None, "双": None, "大": None, "小": None} for i in range(10)},
|
||||
"winner": {},
|
||||
"GD1": {"冠亚大": None, "冠亚小": None},
|
||||
"GD2": {"冠亚单": None, "冠亚双": None},
|
||||
"GLH_result": {}
|
||||
}
|
||||
current_time = pd.to_datetime(dt)
|
||||
recent_x = df[df['time'] < current_time].tail(10000)
|
||||
predictions = predictor.predict(current_time, recent_x)
|
||||
|
||||
last_result = df[df['time'] == next_period_time]
|
||||
if last_result.size != 0:
|
||||
predictor.update_result(last_result, entry)
|
||||
return entry
|
||||
for pos, nums_bet in predictions.items():
|
||||
if not nums_bet:
|
||||
continue
|
||||
entry['result'][pos] = nums_bet
|
||||
|
||||
last_result = df[df['time'] == current_time]
|
||||
if last_result.size != 0:
|
||||
predictor.update_result(last_result, entry)
|
||||
result.append(entry)
|
||||
return result[-1]
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
@@ -101,7 +125,7 @@ if __name__ == "__main__":
|
||||
all_records = get_history_records(data_dirs)
|
||||
parser = argparse.ArgumentParser(description="下一期时间 next_period_time, 例: 2026-01-02 06:00:00")
|
||||
# 必选位置参数(直接传入值,无需前缀)
|
||||
parser.add_argument("--next_period_time", type=str, help="下一期时间, 例: 2026-01-02 06:00:00", default="2026-01-02 06:00:00")
|
||||
parser.add_argument("--next_period_time", type=str, help="下一期时间, 例: 2026-01-02 06:00:00", default="2026-01-02 07:05:00")
|
||||
args = parser.parse_args()
|
||||
fmt = "%Y-%m-%d %H:%M:%S"
|
||||
next_period_time = datetime.strptime(args.next_period_time, fmt)
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
[init]
|
||||
ODDS = 9.599
|
||||
BASE_BET_UNIT = 100
|
||||
BET_THIS_ROUND = 100
|
||||
INITIAL_CAPITAL = 20000
|
||||
BASE_BET_UNIT = 20
|
||||
DAILY_STOP_LOSS_RATE = 0.30
|
||||
|
||||
[dynamic]
|
||||
|
||||
@@ -19,7 +19,7 @@ class LotteryPredictorV14Profit:
|
||||
ODDS = float(conf["init"]["ODDS"])
|
||||
REBATE_RATE = float(conf["dynamic"]["REBATE_RATE"])
|
||||
BASE_BET_UNIT = int(conf["init"]["BASE_BET_UNIT"])
|
||||
_bet_this_round = int(conf["init"]["BET_THIS_ROUND"])
|
||||
_bet_this_round = BASE_BET_UNIT
|
||||
SAFE_BET_LEVEL_1 = 0.05
|
||||
SAFE_BET_LEVEL_2 = 0.10
|
||||
SAFE_BET_LEVEL_3 = 0.15
|
||||
@@ -28,7 +28,7 @@ class LotteryPredictorV14Profit:
|
||||
RADICAL_BET_LEVEL_0 = 0.05
|
||||
RADICAL_BET_LEVEL_1 = 0.1
|
||||
RADICAL_BET_LEVEL_2 = 0.2
|
||||
INITIAL_CAPITAL = int(conf["init"]["INITIAL_CAPITAL"])
|
||||
INITIAL_CAPITAL = BASE_BET_UNIT * 200
|
||||
DAILY_STOP_LOSS_RATE = float(conf["init"]["DAILY_STOP_LOSS_RATE"]) # 绝佳熔断点:6000元熔断
|
||||
POSITION_LOOKBACK_PERIODS = int(conf["dynamic"]["POSITION_LOOKBACK_PERIODS"])
|
||||
OMISSIONS_LEVEL_1 = int(conf["dynamic"]["OMISSIONS_LEVEL_1"])
|
||||
@@ -126,10 +126,17 @@ class LotteryPredictorV14Profit:
|
||||
start_time, end_time = date_range
|
||||
if start_time <= current_date <= end_time:
|
||||
_date_range = (start_time, end_time)
|
||||
break
|
||||
|
||||
if not _date_range:
|
||||
current_date_start_time = pd.to_datetime(current_date.date()) + timedelta(hours=7, minutes=5)
|
||||
current_date_end_time = current_date_start_time + timedelta(hours=22, minutes=55)
|
||||
|
||||
if current_date.hour <= 6:
|
||||
current_date_start_time = pd.to_datetime(current_date.date()) + timedelta(days=-1, hours=7, minutes=5)
|
||||
current_date_end_time = current_date_start_time + timedelta(hours=22, minutes=55)
|
||||
else:
|
||||
current_date_start_time = pd.to_datetime(current_date.date()) + timedelta(hours=7, minutes=5)
|
||||
current_date_end_time = current_date_start_time + timedelta(hours=22, minutes=55)
|
||||
|
||||
_date_range = (current_date_start_time, current_date_end_time)
|
||||
|
||||
self.daily_pnl_tracker[_date_range] = {'pnl': 0, 'bets': 0, 'miss_count': 0}
|
||||
|
||||
Reference in New Issue
Block a user