fix(lint): remove unused imports and reformat with black
This commit is contained in:
@@ -7,7 +7,6 @@ from app.core.pricing.black_scholes import (
|
|||||||
DEFAULT_RISK_FREE_RATE,
|
DEFAULT_RISK_FREE_RATE,
|
||||||
DEFAULT_VOLATILITY,
|
DEFAULT_VOLATILITY,
|
||||||
BlackScholesInputs,
|
BlackScholesInputs,
|
||||||
OptionType,
|
|
||||||
black_scholes_price_and_greeks,
|
black_scholes_price_and_greeks,
|
||||||
)
|
)
|
||||||
from app.models.option import OptionContract
|
from app.models.option import OptionContract
|
||||||
|
|||||||
@@ -412,11 +412,14 @@ def strategy_metrics_from_snapshot(
|
|||||||
]
|
]
|
||||||
|
|
||||||
scenario_price = spot * _pct_factor(scenario_pct)
|
scenario_price = spot * _pct_factor(scenario_pct)
|
||||||
scenario_gold_value = _as_money(gold_weight * PricePerWeight(
|
scenario_gold_value = _as_money(
|
||||||
|
gold_weight
|
||||||
|
* PricePerWeight(
|
||||||
amount=scenario_price,
|
amount=scenario_price,
|
||||||
currency=BaseCurrency.USD,
|
currency=BaseCurrency.USD,
|
||||||
per_unit=WeightUnit.OUNCE_TROY,
|
per_unit=WeightUnit.OUNCE_TROY,
|
||||||
))
|
)
|
||||||
|
)
|
||||||
current_gold_value = _as_money(gold_weight * current_spot)
|
current_gold_value = _as_money(gold_weight * current_spot)
|
||||||
unhedged_equity = scenario_gold_value - loan_amount
|
unhedged_equity = scenario_gold_value - loan_amount
|
||||||
scenario_payoff_per_unit = _strategy_option_payoff_per_unit(strategy, spot, scenario_price)
|
scenario_payoff_per_unit = _strategy_option_payoff_per_unit(strategy, spot, scenario_price)
|
||||||
|
|||||||
@@ -260,16 +260,24 @@ class PricePerWeight:
|
|||||||
adjusted_weight = other.to_unit(self._per_unit_typed)
|
adjusted_weight = other.to_unit(self._per_unit_typed)
|
||||||
return Money(amount=adjusted_weight.amount * self.amount, currency=self._currency_typed)
|
return Money(amount=adjusted_weight.amount * self.amount, currency=self._currency_typed)
|
||||||
if isinstance(other, Decimal):
|
if isinstance(other, Decimal):
|
||||||
return PricePerWeight(amount=self.amount * other, currency=self._currency_typed, per_unit=self._per_unit_typed)
|
return PricePerWeight(
|
||||||
|
amount=self.amount * other, currency=self._currency_typed, per_unit=self._per_unit_typed
|
||||||
|
)
|
||||||
if isinstance(other, int):
|
if isinstance(other, int):
|
||||||
return PricePerWeight(amount=self.amount * Decimal(other), currency=self._currency_typed, per_unit=self._per_unit_typed)
|
return PricePerWeight(
|
||||||
|
amount=self.amount * Decimal(other), currency=self._currency_typed, per_unit=self._per_unit_typed
|
||||||
|
)
|
||||||
return NotImplemented
|
return NotImplemented
|
||||||
|
|
||||||
def __rmul__(self, other: object) -> PricePerWeight:
|
def __rmul__(self, other: object) -> PricePerWeight:
|
||||||
if isinstance(other, bool):
|
if isinstance(other, bool):
|
||||||
return NotImplemented
|
return NotImplemented
|
||||||
if isinstance(other, Decimal):
|
if isinstance(other, Decimal):
|
||||||
return PricePerWeight(amount=self.amount * other, currency=self._currency_typed, per_unit=self._per_unit_typed)
|
return PricePerWeight(
|
||||||
|
amount=self.amount * other, currency=self._currency_typed, per_unit=self._per_unit_typed
|
||||||
|
)
|
||||||
if isinstance(other, int):
|
if isinstance(other, int):
|
||||||
return PricePerWeight(amount=self.amount * Decimal(other), currency=self._currency_typed, per_unit=self._per_unit_typed)
|
return PricePerWeight(
|
||||||
|
amount=self.amount * Decimal(other), currency=self._currency_typed, per_unit=self._per_unit_typed
|
||||||
|
)
|
||||||
return NotImplemented
|
return NotImplemented
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ from app.models.backtest import (
|
|||||||
from app.services.backtesting.databento_source import DatabentoHistoricalPriceSource, DatabentoSourceConfig
|
from app.services.backtesting.databento_source import DatabentoHistoricalPriceSource, DatabentoSourceConfig
|
||||||
from app.services.backtesting.fixture_source import (
|
from app.services.backtesting.fixture_source import (
|
||||||
FixtureBoundSyntheticHistoricalProvider,
|
FixtureBoundSyntheticHistoricalProvider,
|
||||||
SharedHistoricalFixtureSource,
|
|
||||||
build_backtest_ui_fixture_source,
|
build_backtest_ui_fixture_source,
|
||||||
)
|
)
|
||||||
from app.services.backtesting.historical_provider import (
|
from app.services.backtesting.historical_provider import (
|
||||||
|
|||||||
@@ -86,8 +86,7 @@ def calculate_true_pnl(
|
|||||||
|
|
||||||
|
|
||||||
def get_default_premium_for_product(
|
def get_default_premium_for_product(
|
||||||
underlying: str,
|
underlying: str, product_type: str = "default"
|
||||||
product_type: str = "default"
|
|
||||||
) -> tuple[Decimal | None, Decimal | None]:
|
) -> tuple[Decimal | None, Decimal | None]:
|
||||||
"""Get default premium/spread for common gold products.
|
"""Get default premium/spread for common gold products.
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
"""Tests for page validation functions and constants."""
|
"""Tests for page validation functions and constants."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from datetime import date, timedelta
|
from datetime import date, timedelta
|
||||||
|
|||||||
Reference in New Issue
Block a user