boglehead/portfolio.py
def rebalance(self):
        """rebalance the portfolio, without regard for tax consequences"""
        value = self.value()
        for fund, proportion in zip(self.funds, self.proportions):
            delta_value = fund.value() - value * proportion

            # when it is overvalued relative to the portfolio, sell it. when it
            # is undervalued, buy it
            fund.units *= 1.0 - delta_value / fund.value()

        if abs(value - self.value()) > EPSILON:
            raise ValueError("#rebalancefail")
rebalance the portfolio, without regard for tax consequences
rebalance the portfolio, without regard for tax consequences
rebalance the portfolio without regard for tax consequences
def rebalance(self):
        value = self.value()
        for fund, proportion in zip(self.funds, self.proportions):
            delta_value = fund.value() - value * proportion
            fund.units *= 1.0 - delta_value / fund.value()
        if abs(value - self.value()) > EPSILON:
            raise ValueError("#rebalancefail")
def rebalance ( self ) : value = self . value ( ) for fund , proportion in zip ( self . funds , self . proportions ) : delta_value = fund . value ( ) - value * proportion fund . units *= 1.0 - delta_value / fund . value ( ) if abs ( value - self . value ( ) ) > EPSILON : raise ValueError ( "#rebalancefail" )
rebalance the portfolio, without regard for tax consequences
rebalance the portfolio without regard for tax consequences
"""rebalance the portfolio, without regard for tax consequences""" # when it is overvalued relative to the portfolio, sell it. when it # is undervalued, buy it
self