26 lines
965 B
Python
26 lines
965 B
Python
import datetime as dt
|
|
import pandas as pd
|
|
|
|
from app.screener.engine import ScreenContext
|
|
from app.screener.nodes.rs_rating import RsRating
|
|
from app.screener._test_fixtures import make_master, make_prices, make_flow, make_kospi
|
|
|
|
|
|
def _ctx(master, prices, flow, kospi):
|
|
return ScreenContext(master=master, prices=prices, flow=flow,
|
|
kospi=kospi, asof=dt.date(2026, 5, 12))
|
|
|
|
|
|
def test_outperformer_gets_higher_score():
|
|
asof = dt.date(2026, 5, 12)
|
|
master = make_master(["UP", "DN"])
|
|
up = make_prices(["UP"], days=260, asof=asof, trend_pct=0.3)
|
|
dn = make_prices(["DN"], days=260, asof=asof, trend_pct=-0.1)
|
|
prices = pd.concat([up, dn], ignore_index=True)
|
|
flow = make_flow(["UP", "DN"], days=260, asof=asof)
|
|
kospi = make_kospi(days=260, asof=asof, trend_pct=0.0)
|
|
|
|
out = RsRating().compute(_ctx(master, prices, flow, kospi),
|
|
RsRating.default_params)
|
|
assert out["UP"] > out["DN"]
|