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.getCash() >= account.getTotalValue() / self.buying_ratio):
            return account.getTotalValue() / self.buying_ratio
        else:
            return 0