diff options
Diffstat (limited to 'components/overview.py')
| -rw-r--r-- | components/overview.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/components/overview.py b/components/overview.py index 27c4166..53358f0 100644 --- a/components/overview.py +++ b/components/overview.py @@ -7,6 +7,7 @@ import streamlit as st import streamlit.components.v1 as components from services.data_service import get_company_info, get_latest_price, get_price_history +from utils.security import json_for_script PERIODS = {"1mo": "1M", "3mo": "3M", "6mo": "6M", "1y": "1Y", "5y": "5Y"} SECTOR_ETF_MAP = { @@ -190,8 +191,6 @@ def _comparison_list(ticker: str, info: dict) -> list[dict]: def render_overview(ticker: str): - import json as _json - info = get_company_info(ticker) or {} if not info: st.error("Could not load data for this ticker.") @@ -271,8 +270,8 @@ def render_overview(ticker: str): "default_comparisons": ["^GSPC"], } - payload_js = "const OVERVIEW_DATA=" + _json.dumps(payload) + ";" - meta_js = "const OVERVIEW_META=" + _json.dumps(meta) + ";" + payload_js = "const OVERVIEW_DATA=" + json_for_script(payload) + ";" + meta_js = "const OVERVIEW_META=" + json_for_script(meta) + ";" if price is not None and prev_close is not None and prev_close > 0: chg_pct = (price - prev_close) / prev_close * 100.0 @@ -497,7 +496,7 @@ def render_overview(ticker: str): + "</script>" ) - height = 1480 + height = 1950 # extra ~470px buffer for responsive single-column collapse at <1100px doc = ( "<!doctype html><html><head><meta charset='utf-8'>" |
