add seat recommendations, bet advisor, and live whale/public trends
Prediction hero now shows ranked TOP PICK and 2ND PICK with EV per unit bet (P(win)*2.9 - 1). Bet Size Advisor panel shows Kelly criterion fraction (capped 25%), best chair with confidence, and historical bet rank insight (how often lowest/highest-bet chair wins). Live Market Sentiment section tracks whale trend (top 5 bettors by amount) and public trend (total pool distribution) in real-time via WebSocket, mirroring the live dashboard. Notes highlight agreement/divergence between model pick and crowd favorite. Historical crowd analysis cards show how often the most-bet, mid-bet, and least-bet chairs actually won across all games. Round result flash now includes whale/public pick accuracy alongside the model prediction result. user_bet WebSocket events are tracked to build per-round bettor profiles for whale analysis.
This commit is contained in:
19
app/db.py
19
app/db.py
@@ -1290,6 +1290,24 @@ def get_prediction_analysis() -> dict:
|
||||
suits = _suit_distribution(cards_data)
|
||||
winning_cards = _winning_card_patterns(cards_data)
|
||||
|
||||
# Bet rank analysis — how often the winning chair had high/mid/low bet
|
||||
rank_result = client.query("""
|
||||
SELECT
|
||||
countIf(winner_bet >= greatest(bet_a, bet_b, bet_c)) AS high,
|
||||
countIf(winner_bet > least(bet_a, bet_b, bet_c)
|
||||
AND winner_bet < greatest(bet_a, bet_b, bet_c)) AS mid,
|
||||
countIf(winner_bet <= least(bet_a, bet_b, bet_c)) AS low
|
||||
FROM (
|
||||
SELECT bet_a, bet_b, bet_c,
|
||||
multiIf(winner = 3, bet_a, winner = 2, bet_b, bet_c) AS winner_bet
|
||||
FROM games WHERE bet_a + bet_b + bet_c > 0
|
||||
)
|
||||
""")
|
||||
bet_rank = {"high": 0, "mid": 0, "low": 0}
|
||||
if rank_result.result_rows:
|
||||
r = rank_result.result_rows[0]
|
||||
bet_rank = {"high": r[0], "mid": r[1], "low": r[2]}
|
||||
|
||||
return {
|
||||
"total_games": len(winners),
|
||||
"last_winners": winners[-10:] if len(winners) >= 10 else winners,
|
||||
@@ -1302,6 +1320,7 @@ def get_prediction_analysis() -> dict:
|
||||
"chi_squared": chi_squared,
|
||||
"runs_test": runs_test,
|
||||
"backtest": backtest,
|
||||
"bet_rank": bet_rank,
|
||||
"card_values": card_values,
|
||||
"face_cards": face_cards,
|
||||
"suits": suits,
|
||||
|
||||
Reference in New Issue
Block a user