|
2 | 2 |
|
3 | 3 | from tia.util.decorator import lazy_property
|
4 | 4 | from tia.analysis.model.interface import TxnColumns as TC
|
5 |
| -from tia.analysis.model.pl import Pl |
| 5 | +from tia.analysis.model.pl import ProfitAndLoss |
6 | 6 | from tia.analysis.model.ret import RoiiRetCalculator
|
7 | 7 | from tia.analysis.util import is_decrease, is_increase, crosses_zero
|
8 | 8 |
|
@@ -68,8 +68,8 @@ def __init__(self, trades, pricer, ret_calc=None):
|
68 | 68 | self.ret_calc = ret_calc or RoiiRetCalculator()
|
69 | 69 |
|
70 | 70 | pids = property(lambda self: self.frame[TC.PID].unique())
|
71 |
| - pl = lazy_property(lambda self: Pl(self), 'pl') |
72 |
| - rets = lazy_property(lambda self: self.ret_calc.compute(self), 'rets') |
| 71 | + pl = lazy_property(lambda self: ProfitAndLoss(self), 'pl') |
| 72 | + performance = lazy_property(lambda self: self.ret_calc.compute(self), 'performance') |
73 | 73 |
|
74 | 74 | @lazy_property
|
75 | 75 | def frame(self):
|
@@ -136,9 +136,9 @@ def subset(self, pids):
|
136 | 136 | # build the object
|
137 | 137 | result = Txns(trds, self.pricer, self.ret_calc)
|
138 | 138 | result._frame = self.frame.ix[pmask]
|
139 |
| - if hasattr(self, '_pl'): |
140 |
| - pl = self.pl |
141 |
| - result._pl = pl.subset(result) |
| 139 | + if hasattr(self, '_profit_and_loss'): |
| 140 | + pl = self.profit_and_loss |
| 141 | + result._profit_and_loss = pl.subset(result) |
142 | 142 | return result
|
143 | 143 |
|
144 | 144 |
|
|
0 commit comments