calculate the amount of money to buy stock

def __getCashToBuyStock(self):
        ''' calculate the amount of money to buy stock '''
        account=self.__strategy.getAccountCopy()

        if (account.buyingPower >= account.getTotalValue() / self.__buyingRatio):
            return account.getTotalValue() / self.__buyingRatio
        else:
            return 0