Deduct round-trip taker fees from estimated perp PnL.
Unify hub/instance TP profit, calc_pnl, and push/accounting to net of 0.05% per side; leave exchange floating PnL unchanged. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -143,8 +143,16 @@ def reward_at_tp_usdt(
|
||||
cs = float(contract_size or 1.0)
|
||||
direction = (direction or "long").strip().lower()
|
||||
if direction == "short":
|
||||
return (float(avg) - float(take_profit)) * float(qty) * cs
|
||||
return (float(take_profit) - float(avg)) * float(qty) * cs
|
||||
gross = (float(avg) - float(take_profit)) * float(qty) * cs
|
||||
else:
|
||||
gross = (float(take_profit) - float(avg)) * float(qty) * cs
|
||||
try:
|
||||
from lib.trade.trade_fee_lib import net_pnl_after_fee
|
||||
|
||||
net = net_pnl_after_fee(gross, avg, take_profit, qty, cs)
|
||||
return float(net) if net is not None else gross
|
||||
except Exception:
|
||||
return gross
|
||||
|
||||
|
||||
def roll_fib_trigger_crossed(
|
||||
|
||||
Reference in New Issue
Block a user