Fix intraday profit amount and hide TP/SL cancel for day trades.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -7300,7 +7300,7 @@ def api_price_snapshot():
|
||||
leverage=leverage,
|
||||
exchange_notional=ex_metrics.get("notional") if ex_metrics else None,
|
||||
contracts=abs(_position_row_effective_contracts(prow)) if prow else None,
|
||||
contract_size=float(get_contract_size(r["symbol"])) if r["symbol"] else 1.0,
|
||||
contract_size=float(get_contract_size(ex_sym)) if ex_sym else 1.0,
|
||||
mark_price=ex_metrics.get("mark_price") if ex_metrics else price,
|
||||
avg_entry_price=avg_entry,
|
||||
funds_decimals=FUNDS_DECIMALS,
|
||||
@@ -7686,6 +7686,10 @@ def api_key_kline():
|
||||
@app.route("/api/order/<int:order_id>/cancel_tpsl", methods=["POST"])
|
||||
@login_required
|
||||
def api_order_cancel_tpsl(order_id):
|
||||
from lib.trade.trade_policy_lib import is_intraday_trading_profile
|
||||
|
||||
if is_intraday_trading_profile(TRADE_POLICY):
|
||||
return jsonify({"ok": False, "msg": "日内纪律账户禁止撤销交易所止盈止损"}), 403
|
||||
data = request.get_json(silent=True) or {}
|
||||
role = (data.get("role") or "").strip().lower()
|
||||
if role not in ("sl", "tp"):
|
||||
@@ -7771,6 +7775,7 @@ def api_order_place_tpsl(order_id):
|
||||
pass
|
||||
from lib.trade.order_monitor_display_lib import enrich_active_monitor_tpsl_json
|
||||
|
||||
ex_sym = resolve_monitor_exchange_symbol(row)
|
||||
display_extra = enrich_active_monitor_tpsl_json(
|
||||
row,
|
||||
stop_loss,
|
||||
@@ -7778,7 +7783,7 @@ def api_order_place_tpsl(order_id):
|
||||
slots,
|
||||
position_row=prow,
|
||||
exchange_notional=ex_metrics.get("notional") if ex_metrics else None,
|
||||
contract_size=float(get_contract_size(symbol)) if symbol else 1.0,
|
||||
contract_size=float(get_contract_size(ex_sym)) if ex_sym else 1.0,
|
||||
mark_price=live_price,
|
||||
calc_rr_ratio_fn=calc_rr_ratio,
|
||||
format_price_fn=format_price_for_symbol,
|
||||
|
||||
Reference in New Issue
Block a user