File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -671,15 +671,22 @@ def is_short(self):
671
671
672
672
@property
673
673
def pl (self ):
674
- """Trade profit (positive) or loss (negative) in cash units."""
674
+ """
675
+ Trade profit (positive) or loss (negative) in cash units.
676
+ Commissions are reflected only after the Trade is closed.
677
+ """
675
678
price = self .__exit_price or self .__broker .last_price
676
- return self .__size * (price - self .__entry_price )
679
+ return ( self .__size * (price - self .__entry_price )) - self . _commissions
677
680
678
681
@property
679
682
def pl_pct (self ):
680
683
"""Trade profit (positive) or loss (negative) in percent."""
681
684
price = self .__exit_price or self .__broker .last_price
682
- return copysign (1 , self .__size ) * (price / self .__entry_price - 1 )
685
+ gross_pl_pct = copysign (1 , self .__size ) * (price / self .__entry_price - 1 )
686
+
687
+ # Total commission across the entire trade size to individual units
688
+ commission_pct = self ._commissions / (abs (self .__size ) * self .__entry_price )
689
+ return gross_pl_pct - commission_pct
683
690
684
691
@property
685
692
def value (self ):
You can’t perform that action at this time.
0 commit comments