Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ requires-python = ">=3.11"
dependencies = [
"pandas>=2.0",
"pytz>=2024.1",
"quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@68c51590da8a5097b7de6d75b4ccb6a175318b48",
"quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@a90937621a7a05c9f72d0ca8a29be3fcb18a327c",
]

[tool.setuptools]
Expand Down
2 changes: 1 addition & 1 deletion qsl.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ bundle = "2026.09.1"
requires = [
"pandas>=2.0",
"pytz>=2024.1",
"quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@68c51590da8a5097b7de6d75b4ccb6a175318b48",
"quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@a90937621a7a05c9f72d0ca8a29be3fcb18a327c",
]
6 changes: 6 additions & 0 deletions src/us_equity_strategies/entrypoints/_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ def apply_risk_gate(
}
if "runtime_risk_limits" in capabilities:
qpk_kwargs["runtime_risk_limits"] = capabilities["runtime_risk_limits"]
if "small_account_hold_policy" in capabilities:
qpk_kwargs["small_account_hold_policy"] = capabilities["small_account_hold_policy"]
if "current_portfolio_weights" in capabilities:
qpk_kwargs["current_portfolio_weights"] = capabilities["current_portfolio_weights"]
if "cash_only_execution" in capabilities:
qpk_kwargs["cash_only_execution"] = capabilities["cash_only_execution"]
return _qpk_apply_risk_gate(
decision,
**qpk_kwargs,
Expand Down
33 changes: 33 additions & 0 deletions tests/test_entrypoint_risk_gate.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,39 @@ def _gate(decision, **kwargs):
assert captured["enforce_value_target_exposure"] is True


def test_apply_risk_gate_forwards_small_account_hold_capabilities(
monkeypatch,
) -> None:
captured: dict[str, object] = {}

def _gate(decision, **kwargs):
captured.update(kwargs)
return decision

hold_policy = object()
ctx = StrategyContext(
as_of=datetime(2026, 7, 9, tzinfo=timezone.utc),
portfolio=None,
market_data={},
state={},
runtime_config={},
capabilities={
"small_account_hold_policy": hold_policy,
"cash_only_execution": True,
"current_portfolio_weights": {"SOXL": 0.9},
},
)
monkeypatch.setattr(common, "_qpk_apply_risk_gate", _gate)
decision = StrategyDecision(
positions=(PositionTarget(symbol="SOXL", target_weight=0.9),)
)

assert apply_risk_gate(decision, ctx=ctx) is decision
assert captured["small_account_hold_policy"] is hold_policy
assert captured["cash_only_execution"] is True
assert captured["current_portfolio_weights"] == {"SOXL": 0.9}


def test_apply_risk_gate_omits_runtime_risk_limits_kwarg_when_capability_absent(
monkeypatch,
) -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_qsl_compat_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


ROOT = Path(__file__).resolve().parents[1]
QPK_REVISION = "68c51590da8a5097b7de6d75b4ccb6a175318b48"
QPK_REVISION = "a90937621a7a05c9f72d0ca8a29be3fcb18a327c"
QPK_URL = (
"quant-platform-kit @ git+https://github.com/QuantStrategyLab/"
f"QuantPlatformKit.git@{QPK_REVISION}"
Expand Down
4 changes: 2 additions & 2 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.