Fix intraday profit amount and hide TP/SL cancel for day trades.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -115,6 +115,28 @@ def test_apply_order_price_display_fields_live_sl():
|
||||
assert payload["reward_at_tp_usdt"] > 0
|
||||
|
||||
|
||||
def test_apply_order_price_display_fields_gate_contract_size():
|
||||
payload = {}
|
||||
apply_order_price_display_fields(
|
||||
payload,
|
||||
direction="short",
|
||||
entry_price=62063.4,
|
||||
initial_stop_loss=62650,
|
||||
stop_loss=62650,
|
||||
take_profit=61200,
|
||||
calc_rr_ratio_fn=_calc_rr,
|
||||
exchange_tpsl={},
|
||||
symbol="BTC/USDT:USDT",
|
||||
margin_capital=48,
|
||||
leverage=10,
|
||||
contracts=78.0,
|
||||
contract_size=0.0001,
|
||||
avg_entry_price=62063.4,
|
||||
)
|
||||
assert payload["reward_at_tp_usdt"] is not None
|
||||
assert abs(payload["reward_at_tp_usdt"] - 6.73) < 0.1
|
||||
|
||||
|
||||
def test_calc_latest_risk_amount_long():
|
||||
rf = calc_risk_fraction("long", 100, 95)
|
||||
assert rf is not None and abs(rf - 0.05) < 1e-9
|
||||
|
||||
Reference in New Issue
Block a user