feat: add purge-all for Pattern Library + clarify Trade Ideas in Data Management
Backend: DELETE /api/patterns/purge-all — removes all custom + backtested patterns (source != 'builtin'), leaves Pattern Lab run history intact. Frontend Config > Data Management: - New PurgeButton for Pattern Library (custom_patterns table) - Updated note: Trade Ideas are computed live from the Pattern Library (no separate table), so purging patterns resets trade idea generation on next cycle. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -61,6 +61,18 @@ def update_pattern(pat_id: str, req: PatternRequest):
|
||||
return {"id": pat_id, "status": "updated"}
|
||||
|
||||
|
||||
@router.delete("/purge-all")
|
||||
def purge_all_patterns():
|
||||
"""Delete ALL custom/backtested patterns from the pattern library."""
|
||||
from services.database import get_conn
|
||||
conn = get_conn()
|
||||
conn.execute("DELETE FROM custom_patterns WHERE source != 'builtin'")
|
||||
n = conn.total_changes
|
||||
conn.commit()
|
||||
conn.close()
|
||||
return {"deleted": n}
|
||||
|
||||
|
||||
@router.delete("/custom/{pat_id}")
|
||||
def delete_pattern(pat_id: str):
|
||||
delete_custom_pattern(pat_id)
|
||||
|
||||
Reference in New Issue
Block a user