Fix lot preview crash and improve key monitor WeChat alerts.
Unpack margin_one_lot correctly for fixed-amount sizing, use exchange klines for breakout detection, and notify on pending auto orders. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -3083,6 +3083,8 @@ def install_trading(app, *, login_required, require_nav, get_db, get_setting, se
|
||||
schedule_ai_fn=schedule_ai_event_analysis,
|
||||
db_path=DB_PATH,
|
||||
)
|
||||
else:
|
||||
_notify(True, "委托已提交,待成交", entry=entry, sl=sl, tp=tp, lots=lots)
|
||||
_push_position_snapshot_async(fast=False)
|
||||
return True, "已下单" if filled else "委托已提交"
|
||||
except Exception as exc:
|
||||
|
||||
+1
-1
@@ -165,7 +165,7 @@ def fetch_closed_bar(
|
||||
p,
|
||||
db_path=db_path,
|
||||
trading_mode=trading_mode,
|
||||
prefer_ctp=True,
|
||||
prefer_ctp=False,
|
||||
)
|
||||
bars = data.get("bars") or []
|
||||
return last_closed_bar(bars, bar_period_minutes(p))
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ def calc_lots_by_amount(
|
||||
if lots < 1:
|
||||
return None, f"按固定金额 {budget:.0f} 元,当前止损距离下不足 1 手", info
|
||||
if cap > 0:
|
||||
margin_per_lot, _src = margin_one_lot(
|
||||
margin_per_lot, _src, _spec = margin_one_lot(
|
||||
ths_code, entry_f, direction=direction, trading_mode=trading_mode,
|
||||
)
|
||||
if margin_per_lot <= 0:
|
||||
|
||||
+6
-1
@@ -699,7 +699,12 @@
|
||||
stop_loss: sl,
|
||||
take_profit: tp
|
||||
})
|
||||
}).then(function (r) { return r.json(); }).then(function (data) {
|
||||
}).then(function (r) {
|
||||
return r.json().then(function (data) {
|
||||
if (!r.ok && data && !data.error) data.error = '请求失败 ' + r.status;
|
||||
return data;
|
||||
});
|
||||
}).then(function (data) {
|
||||
if (!data.ok) {
|
||||
if (isAmountMode()) {
|
||||
lotsCalc.value = '';
|
||||
|
||||
Reference in New Issue
Block a user