feat(stock): portfolio_health (집중도·현금·손익)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -213,3 +213,16 @@ def test_news_issues_flags_negative_sentiment(monkeypatch):
|
||||
assert "005930" in issues
|
||||
assert issues["005930"][0]["type"] == "news"
|
||||
assert issues["005930"][0]["severity"] in ("med", "high")
|
||||
|
||||
|
||||
def test_portfolio_health():
|
||||
holdings = [
|
||||
{"ticker": "005930", "quantity": 10, "avg_price": 70000, "current_price": 77000,
|
||||
"is_krx": True},
|
||||
{"ticker": "000660", "quantity": 5, "avg_price": 100000, "current_price": 90000,
|
||||
"is_krx": True},
|
||||
]
|
||||
h = hi.portfolio_health(holdings, total_cash=1000000)
|
||||
assert h["positions"] == 2
|
||||
assert 0 <= h["max_weight"] <= 1.0
|
||||
assert "total_eval" in h and "total_pnl" in h and "cash_ratio" in h
|
||||
|
||||
Reference in New Issue
Block a user