diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8601be4..02dd261 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ repos: # Ruff - fast Python linter - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.11.2 + rev: v0.15.8 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] @@ -11,10 +11,11 @@ repos: # Black - Python formatter - repo: https://github.com/psf/black - rev: 25.1.0 + rev: 26.3.1 hooks: - id: black files: ^(app|tests|scripts)/ + language_version: python3.12 # Type checking with mypy (optional, slower) # Uncomment to enable: diff --git a/app/components/charts.py b/app/components/charts.py index 41d945b..aef4fca 100644 --- a/app/components/charts.py +++ b/app/components/charts.py @@ -13,11 +13,9 @@ def _ensure_lightweight_charts_assets() -> None: global _CHARTS_SCRIPT_ADDED if _CHARTS_SCRIPT_ADDED: return - ui.add_head_html( - """ + ui.add_head_html(""" - """ - ) + """) _CHARTS_SCRIPT_ADDED = True @@ -48,8 +46,7 @@ class CandlestickChart: self._initialize_chart() def _initialize_chart(self) -> None: - ui.run_javascript( - f""" + ui.run_javascript(f""" (function() {{ const root = document.getElementById({json.dumps(self.chart_id)}); if (!root || typeof LightweightCharts === 'undefined') return; @@ -94,57 +91,48 @@ class CandlestickChart: indicators: {{}}, }}; }})(); - """ - ) + """) def set_candles(self, candles: list[dict[str, Any]]) -> None: payload = json.dumps(candles) - ui.run_javascript( - f""" + ui.run_javascript(f""" (function() {{ const ref = window.vaultDashCharts?.[{json.dumps(self.chart_id)}]; if (!ref) return; ref.candleSeries.setData({payload}); ref.chart.timeScale().fitContent(); }})(); - """ - ) + """) def update_price(self, candle: dict[str, Any]) -> None: payload = json.dumps(candle) - ui.run_javascript( - f""" + ui.run_javascript(f""" (function() {{ const ref = window.vaultDashCharts?.[{json.dumps(self.chart_id)}]; if (!ref) return; ref.candleSeries.update({payload}); }})(); - """ - ) + """) def set_volume(self, volume_points: list[dict[str, Any]]) -> None: payload = json.dumps(volume_points) - ui.run_javascript( - f""" + ui.run_javascript(f""" (function() {{ const ref = window.vaultDashCharts?.[{json.dumps(self.chart_id)}]; if (!ref) return; ref.volumeSeries.setData({payload}); }})(); - """ - ) + """) def update_volume(self, volume_point: dict[str, Any]) -> None: payload = json.dumps(volume_point) - ui.run_javascript( - f""" + ui.run_javascript(f""" (function() {{ const ref = window.vaultDashCharts?.[{json.dumps(self.chart_id)}]; if (!ref) return; ref.volumeSeries.update({payload}); }})(); - """ - ) + """) def set_indicator( self, @@ -156,8 +144,7 @@ class CandlestickChart: ) -> None: key = json.dumps(name) payload = json.dumps(points) - ui.run_javascript( - f""" + ui.run_javascript(f""" (function() {{ const ref = window.vaultDashCharts?.[{json.dumps(self.chart_id)}]; if (!ref) return; @@ -171,19 +158,16 @@ class CandlestickChart: }} ref.indicators[{key}].setData({payload}); }})(); - """ - ) + """) def update_indicator(self, name: str, point: dict[str, Any]) -> None: key = json.dumps(name) payload = json.dumps(point) - ui.run_javascript( - f""" + ui.run_javascript(f""" (function() {{ const ref = window.vaultDashCharts?.[{json.dumps(self.chart_id)}]; const series = ref?.indicators?.[{key}]; if (!series) return; series.update({payload}); }})(); - """ - ) + """) diff --git a/app/components/strategy_panel.py b/app/components/strategy_panel.py index 35f66a3..e1cb165 100644 --- a/app/components/strategy_panel.py +++ b/app/components/strategy_panel.py @@ -117,8 +117,7 @@ class StrategyComparisonPanel: scenario_class = ( "text-emerald-600 dark:text-emerald-400" if scenario >= 0 else "text-rose-600 dark:text-rose-400" ) - rows.append( - f""" + rows.append(f"""
| {row['symbol']} | {row['type'].upper()} | @@ -149,9 +148,7 @@ async def options_page() -> None:Δ {float(row.get('delta', 0.0)):+.3f} · Γ {float(row.get('gamma', 0.0)):.3f} · Θ {float(row.get('theta', 0.0)):+.3f} · V {float(row.get('vega', 0.0)):.3f} | Use quick-add buttons below |