complete paper trading: auto-close on stop/target + My Trades realized record
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:
+4
-1
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user