feat(PORT-002): add alert status and history
This commit is contained in:
30
tests/test_settings.py
Normal file
30
tests/test_settings.py
Normal file
@@ -0,0 +1,30 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from app.models.portfolio import PortfolioConfig
|
||||
from app.services.settings_status import save_status_text
|
||||
|
||||
|
||||
class CallableMarginCallPriceConfig:
|
||||
def __init__(self, config: PortfolioConfig) -> None:
|
||||
self.entry_basis_mode = config.entry_basis_mode
|
||||
self.gold_value = config.gold_value
|
||||
self.entry_price = config.entry_price
|
||||
self.gold_ounces = config.gold_ounces
|
||||
self.current_ltv = config.current_ltv
|
||||
self._margin_call_price = config.margin_call_price
|
||||
|
||||
def margin_call_price(self) -> float:
|
||||
return self._margin_call_price
|
||||
|
||||
|
||||
def test_save_status_text_uses_margin_call_price_api() -> None:
|
||||
config = PortfolioConfig(gold_value=215_000.0, entry_price=215.0, loan_amount=145_000.0)
|
||||
|
||||
status = save_status_text(CallableMarginCallPriceConfig(config))
|
||||
|
||||
assert "Saved: basis=value_price" in status
|
||||
assert "start=$215,000" in status
|
||||
assert "entry=$215.00/oz" in status
|
||||
assert "weight=1,000.00 oz" in status
|
||||
assert "LTV=67.4%" in status
|
||||
assert "trigger=$193.33/oz" in status
|
||||
Reference in New Issue
Block a user