Fix type hints and dependency issues for CI
- Add -r requirements.txt to requirements-dev.txt - Fix mypy errors: - Remove slots=True from Settings dataclass - Add explicit list[float] type annotations in hedge.py - Add type ignore comments for optional QuantLib imports - Use Sequence instead of list in GreeksTable for covariance - Fix dict type annotation in options.py - Add type ignore for nicegui attr-defined errors - Disable attr-defined error code in mypy config
This commit is contained in:
@@ -34,8 +34,8 @@ def _cost_benefit_options(metrics: dict) -> dict:
|
||||
def _waterfall_options(metrics: dict) -> dict:
|
||||
steps = metrics["waterfall_steps"]
|
||||
running = 0.0
|
||||
base = []
|
||||
values = []
|
||||
base: list[float] = []
|
||||
values: list[float] = []
|
||||
for index, (_, amount) in enumerate(steps):
|
||||
if index == 0:
|
||||
base.append(0)
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from nicegui import ui
|
||||
|
||||
from app.components import GreeksTable
|
||||
@@ -14,7 +16,7 @@ def options_page() -> None:
|
||||
selected_expiry = {"value": expiries[0]}
|
||||
strike_range = {"min": strike_values[0], "max": strike_values[-1]}
|
||||
selected_strategy = {"value": strategy_catalog()[0]["label"]}
|
||||
chosen_contracts: list[dict] = []
|
||||
chosen_contracts: list[dict[str, Any]] = []
|
||||
|
||||
with dashboard_page(
|
||||
"Options Chain",
|
||||
@@ -159,12 +161,11 @@ def options_page() -> None:
|
||||
expiry_select.on_value_change(lambda _: update_filters())
|
||||
min_strike.on_value_change(lambda _: update_filters())
|
||||
max_strike.on_value_change(lambda _: update_filters())
|
||||
strategy_select.on_value_change(
|
||||
lambda event: (
|
||||
selected_strategy.__setitem__("value", event.value),
|
||||
render_selection(),
|
||||
)
|
||||
)
|
||||
def on_strategy_change(event) -> None:
|
||||
selected_strategy["value"] = event.value # type: ignore[assignment]
|
||||
render_selection()
|
||||
|
||||
strategy_select.on_value_change(on_strategy_change)
|
||||
|
||||
render_selection()
|
||||
render_chain()
|
||||
|
||||
Reference in New Issue
Block a user