Fix linting issues: line length, import sorting, unused variables

- Set ruff/black line length to 120
- Reformatted code with black
- Fixed import ordering with ruff
- Disabled lint for UI component files with long CSS strings
- Updated pyproject.toml with proper tool configuration
This commit is contained in:
Bu5hm4nn
2026-03-22 10:30:12 +01:00
parent b037bf4c01
commit 874b4a5a02
25 changed files with 456 additions and 195 deletions

View File

@@ -3,10 +3,14 @@ from __future__ import annotations
from dataclasses import dataclass
from typing import Literal
from app.core.pricing.black_scholes import DEFAULT_GLD_PRICE, DEFAULT_RISK_FREE_RATE, DEFAULT_VOLATILITY
from app.core.pricing.black_scholes import (
DEFAULT_GLD_PRICE,
DEFAULT_RISK_FREE_RATE,
DEFAULT_VOLATILITY,
)
from app.models.portfolio import LombardPortfolio
from app.strategies.base import BaseStrategy, StrategyConfig
from app.strategies.laddered_put import LadderSpec, LadderedPutStrategy
from app.strategies.laddered_put import LadderedPutStrategy, LadderSpec
from app.strategies.lease import LeaseStrategy
from app.strategies.protective_put import ProtectivePutSpec, ProtectivePutStrategy
@@ -54,11 +58,21 @@ class StrategySelectionEngine:
ProtectivePutStrategy(config, ProtectivePutSpec(label="OTM_90", strike_pct=0.90, months=12)),
LadderedPutStrategy(
config,
LadderSpec(label="50_50_ATM_OTM95", weights=(0.5, 0.5), strike_pcts=(1.0, 0.95), months=12),
LadderSpec(
label="50_50_ATM_OTM95",
weights=(0.5, 0.5),
strike_pcts=(1.0, 0.95),
months=12,
),
),
LadderedPutStrategy(
config,
LadderSpec(label="33_33_33_ATM_OTM95_OTM90", weights=(1 / 3, 1 / 3, 1 / 3), strike_pcts=(1.0, 0.95, 0.90), months=12),
LadderSpec(
label="33_33_33_ATM_OTM95_OTM90",
weights=(1 / 3, 1 / 3, 1 / 3),
strike_pcts=(1.0, 0.95, 0.90),
months=12,
),
),
LeaseStrategy(config),
]
@@ -73,7 +87,10 @@ class StrategySelectionEngine:
protection_ltv = protection.get("hedged_ltv_at_threshold")
if protection_ltv is None:
duration_rows = protection.get("durations", [])
protection_ltv = min((row["hedged_ltv_at_threshold"] for row in duration_rows), default=1.0)
protection_ltv = min(
(row["hedged_ltv_at_threshold"] for row in duration_rows),
default=1.0,
)
comparisons.append(
{
"name": strategy.name,
@@ -140,7 +157,11 @@ class StrategySelectionEngine:
"recommended_strategy": recommendation["recommended_strategy"],
}
)
for spot_price in (DEFAULT_GLD_PRICE * 0.9, DEFAULT_GLD_PRICE, DEFAULT_GLD_PRICE * 1.1):
for spot_price in (
DEFAULT_GLD_PRICE * 0.9,
DEFAULT_GLD_PRICE,
DEFAULT_GLD_PRICE * 1.1,
):
engine = StrategySelectionEngine(
portfolio_value=self.portfolio_value,
loan_amount=self.loan_amount,