修复gate盈亏比

This commit is contained in:
dekun
2026-05-25 11:07:47 +08:00
parent 5f4f33cc10
commit dccd490a46
4 changed files with 40 additions and 11 deletions
+7 -5
View File
@@ -1865,17 +1865,19 @@ if(addOrderForm){
}
const sl = Number((document.getElementById("order-sl")||{}).value);
const tp = Number((document.getElementById("order-tp")||{}).value);
let entry = sl;
if(!symbol){
if(rejectManualOrderRr(calcClientRr(direction, entry, sl, tp))) return;
allowManualOrderSubmit(addOrderForm);
alert("请先填写币种,以便按市价校验盈亏比");
return;
}
fetch(`/api/order_defaults?symbol=${encodeURIComponent(symbol)}&direction=${encodeURIComponent(direction)}`)
.then(r=>r.json())
.then(data=>{
const px = data.last_price || data.price;
if(px) entry = Number(px);
const px = data.last_price ?? data.price;
const entry = Number(px);
if(!Number.isFinite(entry) || entry <= 0){
alert("无法获取市价,请稍后重试");
return;
}
if(rejectManualOrderRr(calcClientRr(direction, entry, sl, tp))) return;
allowManualOrderSubmit(addOrderForm);
})