POST Run Maintenance

abstract

Manually trigger position maintenance for all accounts, a specific account, or a specific trade ticket — checks open positions against MT5 state and takes corrective action (close, adjust SL/TP, or alert).

🔒 Authentication

PropertyValue
MechanismNone
RequiredNo

Endpoints in this group (scheduler sub-routes)

MethodPathDescription
POST/api/v1/scheduler/run-maintenanceRun maintenance for ALL active accounts
POST/api/v1/scheduler/run-maintenance/{account_id}Run maintenance for one account
POST/api/v1/scheduler/run-maintenance/{account_id}/ticket/{ticket}Run maintenance for one specific trade

All return 202 Accepted — maintenance runs as a background task.


POST /api/v1/scheduler/run-maintenance

Fires the PositionMaintenanceService for all accounts where maintenance_task_enabled=True.

Logic Flow

Status: 202 Accepted


POST /api/v1/scheduler/run-maintenance//ticket/

Most granular — run maintenance on one specific trade identified by MT5 ticket number.

Use case: LLM noticed an anomaly in one trade during a pipeline run and requests a manual check.


RolePath
Routerbackend/api/routes/scheduler.py
Servicebackend/services/position_maintenance.py :: PositionMaintenanceService
DB TableDB - pipeline_runs
RoleLink
Related EndpointAPI-GET-v1-Scheduler
Frontend PagePage - Schedule
DB SchemaDB - pipeline_runs