complete paper trading: auto-close on stop/target + My Trades realized record
Deploy / lint (push) Successful in 7s
Deploy / test (push) Successful in 38s
Deploy / deploy (push) Successful in 25s

resolve_open_trades walks the daily bars after each open trade and closes it at
the target (target hit) or stop (stop/ambiguous), leaving undecided trades open.
Runs nightly inside the outcome evaluator (so it's coordinated with fresh OHLCV)
and on its manual trigger. New "My Trades" section at the top of Signals → Track
Record shows realized hit-rate, expectancy (avg R), total R, total P&L, and a
closed-trades table — your actual results, separate from the theoretical signal
record below it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-17 08:49:28 +02:00
parent 7e87a15a12
commit fb3b8d18d7
6 changed files with 220 additions and 3 deletions
+4 -1
View File
@@ -800,11 +800,14 @@ async def evaluate_outcomes() -> None:
summary = await evaluate_pending_setups(
db, max_bars=settings.outcome_evaluation_max_bars
)
from app.services import paper_trade_service
closed_trades = await paper_trade_service.resolve_open_trades(db)
_runtime_progress(job_name, processed=1, total=1)
_runtime_finish(
job_name, "completed", processed=1, total=1,
message=f"Evaluated {summary['evaluated']}, pending {summary['still_pending']}",
message=f"Evaluated {summary['evaluated']}, pending {summary['still_pending']}, "
f"{closed_trades} paper trade(s) closed",
)
logger.info(json.dumps({
"event": "job_complete",