Swakakade commited on
Commit
17841ef
·
verified ·
1 Parent(s): 90f34e7

Update pages/VIBRATION(Price&Angle).py

Browse files
Files changed (1) hide show
  1. pages/VIBRATION(Price&Angle).py +9 -3
pages/VIBRATION(Price&Angle).py CHANGED
@@ -57,7 +57,10 @@ with left:
57
  is_swing=is_swing,
58
  swing_type=(swing_type if swing_type != "" else None),
59
  swing_date=datetime.now())
60
- # display
 
 
 
61
  zone = summary["zone"]
62
  color = {"Very Close": "✅", "Near": "⚠️", "Far": "🔴"}.get(zone, "ℹ️")
63
  st.metric(label=f"Angle ({color} {zone})", value=f"{summary['angle']:.4f}°" if summary["angle"] is not None else "N/A",
@@ -68,6 +71,7 @@ with left:
68
  st.markdown("**Explanation**")
69
  st.write(summary["explanation"])
70
 
 
71
  # CSV batch widget
72
  with right:
73
  st.subheader("Batch: Upload CSV (Stock + Price)")
@@ -179,13 +183,15 @@ def forward_price_angle_table(base_price: float, price_list: list):
179
  return df
180
 
181
  # --- UI for both tables (only show if we have summary) ---
182
- if 'summary' in locals() and summary is not None:
 
183
  st.markdown("---")
184
  st.subheader("🔯 Square-of-9 — Reverse (Angle → Price)")
185
 
186
- base_price = float(summary.get("price") or price_input or 0.0)
187
  base_angle = float(summary.get("angle")) if summary.get("angle") is not None else None
188
 
 
189
  # Reverse table controls
190
  std_angles = [0,45,90,135,180,225,270,315]
191
  use_std = st.checkbox("Use standard harmonics for reverse table", value=True)
 
57
  is_swing=is_swing,
58
  swing_type=(swing_type if swing_type != "" else None),
59
  swing_date=datetime.now())
60
+ # persist summary + base price so it survives reruns
61
+ st.session_state["gann_summary"] = summary
62
+ st.session_state["gann_base_price"] = float(price_input)
63
+ # display (same as before)
64
  zone = summary["zone"]
65
  color = {"Very Close": "✅", "Near": "⚠️", "Far": "🔴"}.get(zone, "ℹ️")
66
  st.metric(label=f"Angle ({color} {zone})", value=f"{summary['angle']:.4f}°" if summary["angle"] is not None else "N/A",
 
71
  st.markdown("**Explanation**")
72
  st.write(summary["explanation"])
73
 
74
+
75
  # CSV batch widget
76
  with right:
77
  st.subheader("Batch: Upload CSV (Stock + Price)")
 
183
  return df
184
 
185
  # --- UI for both tables (only show if we have summary) ---
186
+ if "summary" in st.session_state and st.session_state["gann_summary"] is not None:
187
+ summary = st.session_state["gann_summary"]
188
  st.markdown("---")
189
  st.subheader("🔯 Square-of-9 — Reverse (Angle → Price)")
190
 
191
+ base_price = float(st.session_state.get("gann_base_price", summary.get("price") or price_input or 0.0))
192
  base_angle = float(summary.get("angle")) if summary.get("angle") is not None else None
193
 
194
+
195
  # Reverse table controls
196
  std_angles = [0,45,90,135,180,225,270,315]
197
  use_std = st.checkbox("Use standard harmonics for reverse table", value=True)