Example #1
0
 def get_annual_return(self):
     # get a list of all transactions and dividend payments sorted by date
     transactions = []
     for ta in self.transactions:
         transactions.append((ta.date, ta.total))
     for div in self.dividends:
         transactions.append((div.date, div.total))
     # append current value
     transactions.append((self.asset.date.date(), self.current_value))
     transactions.sort()
     return math.xirr(transactions)
Example #2
0
 def get_annual_return(self):
     # get a list of all transactionsm and dividend payments sorted by date
     transactions = []
     for position in self.positions:
         for ta in position.transactions:
             transactions.append((ta.date, ta.total))
         for div in position.dividends:
             transactions.append((div.date, div.total))
     # append current value
     if self.last_update:
         transactions.append((self.last_update.date(),
                              self.get_current_value()))
     transactions.sort()
     return math.xirr(transactions)