Define entry styles: trend/reversal x 3 patterns, plus messy other.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+13
-1
@@ -699,7 +699,13 @@ def register_routes(app: Flask) -> None:
|
||||
charts[tf] = database.get_bars(
|
||||
conn, trade["symbol"], tf, float(center) - window, float(center) + window
|
||||
)
|
||||
return render_template("record_detail.html", trade=trade, charts=charts)
|
||||
return render_template(
|
||||
"record_detail.html",
|
||||
trade=trade,
|
||||
charts=charts,
|
||||
entry_styles=database.ENTRY_STYLES,
|
||||
entry_patterns=database.ENTRY_PATTERN_TYPES,
|
||||
)
|
||||
|
||||
@app.post("/records/<int:tid>/annotate")
|
||||
@login_required
|
||||
@@ -707,11 +713,17 @@ def register_routes(app: Flask) -> None:
|
||||
u = current_user()
|
||||
entry_style = (request.form.get("entry_style") or "").strip()
|
||||
note = (request.form.get("review_note") or "").strip()
|
||||
allowed = set(database.ENTRY_STYLES)
|
||||
with database.get_db() as conn:
|
||||
trade = database.get_trade(conn, tid)
|
||||
if not trade or not database.user_can_access_account(u, trade.get("account_id")):
|
||||
flash("无权标注该记录", "error")
|
||||
return redirect(url_for("records_page"))
|
||||
# 允许清空;或保留已有旧标注值;新选必须在标准列表内
|
||||
prev = (trade.get("entry_style") or "").strip()
|
||||
if entry_style and entry_style not in allowed and entry_style != prev:
|
||||
flash("入场形式不在可选列表中", "error")
|
||||
return redirect(url_for("record_detail", tid=tid))
|
||||
conn.execute(
|
||||
"UPDATE trades SET entry_style=?, review_note=? WHERE id=?",
|
||||
(entry_style, note, tid),
|
||||
|
||||
Reference in New Issue
Block a user