Skip to content

Commit ed129e5

Browse files
committed
Address dynamic RSI indicator review
1 parent c82b316 commit ed129e5

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

src/quant_platform_kit/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""QuantPlatformKit public package surface."""
22

3-
__version__ = "0.7.19"
3+
__version__ = "0.7.20"
44

55
from .common.models import (
66
ExecutionReport,

src/quant_platform_kit/common/runtime_inputs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def build_semiconductor_rotation_indicators_from_history(
7575
rsi_threshold_history = (
7676
soxx_rsi_history.rolling(
7777
rsi_quantile_window,
78-
min_periods=max(60, min(rsi_quantile_window, 126) // 2),
78+
min_periods=min(rsi_quantile_window, max(60, min(rsi_quantile_window, 126) // 2)),
7979
)
8080
.quantile(rsi_quantile)
8181
.shift(1)

tests/test_ibkr_runtime_inputs.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,16 @@ def test_build_semiconductor_rotation_indicators_from_history_is_generic(self) -
144144
self.assertEqual(set(wrapped), {"derived_indicators"})
145145
self.assertEqual(wrapped["derived_indicators"]["soxl"]["price"], 269.0)
146146

147+
def test_build_semiconductor_rotation_indicators_accepts_short_dynamic_rsi_window(self) -> None:
148+
indicators = build_semiconductor_rotation_indicators_from_history(
149+
soxl_history=[100.0 + idx for idx in range(170)],
150+
soxx_history=[200.0 + idx for idx in range(170)],
151+
trend_ma_window=140,
152+
dynamic_rsi_quantile_window=20,
153+
)
154+
155+
self.assertEqual(indicators["soxx"]["rsi14_dynamic_threshold"], 100.0)
156+
147157
def test_build_semiconductor_rotation_inputs_wraps_derived_indicators(self) -> None:
148158
def fake_loader(_ib, symbol, duration="2 Y", bar_size="1 day"):
149159
if symbol == "SOXL":

0 commit comments

Comments
 (0)