Count exit fees in live/SIM net PnL as entry fee x2.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -45,7 +45,7 @@ class _FakeClient:
|
||||
return -1.5
|
||||
|
||||
|
||||
def test_enrich_live_unrealized_no_est_close_fee() -> None:
|
||||
def test_enrich_live_unrealized_entry_fee_times_two() -> None:
|
||||
base = {
|
||||
"has_position": True,
|
||||
"group_id": "G1",
|
||||
@@ -73,7 +73,8 @@ def test_enrich_live_unrealized_no_est_close_fee() -> None:
|
||||
assert out["option_upl"] == 5.0
|
||||
assert out["fees_paid"] == 0.5
|
||||
assert out["funding_usdt"] == -1.5
|
||||
assert out["est_close_fees"] == 0.0
|
||||
# 8 + 5 - 0.5 + (-1.5) = 11
|
||||
assert abs(out["net_pnl"] - 11.0) < 1e-9
|
||||
# 离场费按入场估算
|
||||
assert out["est_close_fees"] == 0.5
|
||||
# 8 + 5 - 0.5*2 + (-1.5) = 10.5
|
||||
assert abs(out["net_pnl"] - 10.5) < 1e-9
|
||||
assert out["pnl_source"] == "live_exchange"
|
||||
|
||||
Reference in New Issue
Block a user