AVOLD / app.py
testrro's picture
Update app.py
178de2c verified
import streamlit as st
import numpy as np
import pandas as pd
st.set_page_config(page_title="Aviator Pattern Tracker Pro", layout="centered")
# ---------------------------
# Session State
# ---------------------------
if "history" not in st.session_state:
st.session_state.history = []
# ---------------------------
# Header
# ---------------------------
st.title("🎯 Aviator Pattern Tracker Pro")
st.caption("Pattern + Expected Multiplier + Risk Control (Bangla UI)")
# ---------------------------
# Input Section
# ---------------------------
st.subheader("📥 Multiplier Input")
new_val = st.number_input("নতুন multiplier দিন (example: 1.45)", min_value=1.0, step=0.01)
col1, col2 = st.columns(2)
with col1:
if st.button("➕ Add"):
st.session_state.history.append(round(new_val, 2))
with col2:
if st.button("🔁 Reset"):
st.session_state.history = []
# ---------------------------
# Data
# ---------------------------
data = st.session_state.history[-50:]
st.subheader("📊 Last 50 Rounds")
st.write(data)
if len(data) < 5:
st.warning("কমপক্ষে 5টা multiplier দিন")
st.stop()
# ---------------------------
# Pattern Calculation
# ---------------------------
low = [x for x in data if x < 1.5]
mid = [x for x in data if 1.5 <= x <= 3]
high = [x for x in data if x > 3]
low_ratio = len(low) / len(data)
high_ratio = len(high) / len(data)
mean = np.mean(data)
std = np.std(data)
# Chaos Index
chaos = (std * high_ratio) / (low_ratio + 0.1)
# Low streak
low_streak = 0
for x in reversed(data):
if x < 1.5:
low_streak += 1
else:
break
# Confidence
stability_score = max(0, 1 - std/5)
distribution_score = 1 - abs(low_ratio - 0.5)
confidence = ((low_streak/5) + stability_score + distribution_score) / 3
confidence = max(0, min(confidence, 1))
# ---------------------------
# Expected Multiplier
# ---------------------------
arr = np.array(data)
weights = np.linspace(1, 2, len(arr))
weighted_mean = np.average(arr, weights=weights)
median = np.median(arr)
sorted_arr = np.sort(arr)
trim = int(len(arr) * 0.1)
trimmed = sorted_arr[trim: len(arr)-trim] if len(arr) > 10 else arr
trimmed_mean = np.mean(trimmed)
expected = (weighted_mean * 0.5) + (median * 0.3) + (trimmed_mean * 0.2)
lower = expected - (std * 0.5)
upper = expected + (std * 0.5)
lower = max(1.01, lower)
# ---------------------------
# Decision Logic
# ---------------------------
if chaos > 1.2:
signal = "🔴 SKIP"
risk = "HIGH RISK"
elif low_streak >= 3 and std < 1.5:
signal = "🟢 ENTER (SMALL)"
risk = "LOW RISK"
else:
signal = "🟡 WAIT"
risk = "MEDIUM"
# refine by expected
if signal.startswith("🟢") and expected < 1.4:
signal = "🟡 WAIT (Expected Low)"
if signal.startswith("🟢") and expected > 2.0:
signal = "🟢 ENTER (GOOD ZONE)"
# ---------------------------
# OUTPUT UI
# ---------------------------
st.subheader("📈 Analysis")
c1, c2, c3 = st.columns(3)
c1.metric("Mean", round(mean,2))
c2.metric("Std Dev", round(std,2))
c3.metric("Chaos", round(chaos,2))
st.divider()
st.subheader("🎯 Expected Multiplier")
e1, e2 = st.columns(2)
e1.metric("Expected", round(expected,2))
e2.metric("Range", f"{round(lower,2)} - {round(upper,2)}")
st.divider()
st.subheader("🧠 Decision")
st.markdown(f"### {signal}")
st.markdown(f"**Confidence:** {round(confidence,2)}")
st.markdown(f"**Risk Level:** {risk}")
# ---------------------------
# Strategy Guide
# ---------------------------
st.divider()
st.subheader("📘 Strategy Guide")
st.markdown("""
**Entry Rule:**
- ছোট bet only
- auto cashout: 1.5x – 1.8x
**Stop Rule:**
- 2 loss in row → STOP
- 1 big win (>3x) → next 2 round skip
**Expected Guide:**
- <1.4 → weak
- 1.4–1.8 → safe
- 1.8–2.5 → medium
- >2.5 → volatile
⚠️ এটি কোনো নিশ্চিত জেতার tool না
""")