- executor: EXIT/SELL signals close the FULL held broker position (not a target_dollars-sized fresh order) and skip when flat
- executor: book realized P&L on the closing trade ((fill - avg_entry)*qty) so the dashboard P&L + win-rate populate; entries leave pnl=None
- exit scanner: wired into the bridge run loop on kevin_bridge_exit_scan_cron (daily ET gate; croniter intentionally not a dependency) plus an offsetting-SELL guard so it only emits exits for currently-held tickers
[ci skip]
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Kevin signals never placed orders: the executor sized only from
sentiment_context["current_price"] (None for Kevin) so qty=0, and orders
were always built SIMPLE (stop/take pcts ignored).
- TradeSignal gains `current_price`; the bridge now sets it on publish
- risk_manager honors `target_dollars` directly (no strength re-scale) and
resolves price from current_price then sentiment_context
- executor builds BRACKET orders for LONG entries carrying stop/take pcts;
EXIT/SELL signals stay SIMPLE (the bridge sets pcts even on exits)
[ci skip]
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Pipeline #46 surfaced two pre-existing CI bugs once fakeredis was
installed and tests could collect:
1. test_models.py:389 asserted "DISCOVERED" in status_col.type.enums,
but the model defines KevinVideoStatus with values_callable so
.enums returns the lowercase string values, not member names.
Asserting "discovered" instead.
2. Four test files use the db_session fixture which requires a real
Postgres on localhost:5432. CI has no Postgres, so 10 tests failed
with Connect call failed (errno 111). These genuinely need a DB —
mirroring tests/integration/* which already use
@pytest.mark.integration. Adding module-level
pytestmark = pytest.mark.integration to:
- tests/shared/models/test_meet_kevin_trading.py
- tests/services/kevin_signal_bridge/test_aggregator.py
- tests/services/kevin_signal_bridge/test_audit.py
- tests/services/kevin_signal_bridge/test_exit_scanner.py
CI runs with -m "not integration" so they're now deselected.
Local pytest still picks them up by default (no marker filter).
Composable: cursor/aggregator/strategy/publisher/audit_writer/broker
all injected. Master kill-switch (kevin_enable_trading=false) routes to
audit-only path. Cursor advances ONLY after XADD succeeds (race fix).
Concrete collaborators wired in subsequent tasks.
Also extends TradeSignal + SignalDirection.EXIT with the optional
fields Kevin paths need (strategy_id, target_dollars, stop_loss_pct,
take_profit_pct).