Esempio n. 1
0
    def initialise_balance_sheet(self, iMethod):
        """Initialise the balance sheet, based on the bank lending and the parameters

        Two approaches to determining the size of the balance sheet: through the assets and through the liabilities.
        In both cases bank borrowing and lending are predetermined, and we have the desired capital ratio and cash ratio.
        Then we either specify the external asset ratio or the financial liability ratio.
        Finally, we do some adjustments to make sure that nothing is negative.
        """
        capitalRatio = self.get_param('capitalRatio', required=True)
        cashRatio = self.get_param('cashRatio', required=True)
        loans = network.bank_lending(self.simInfo, self)
        borrowings = network.bank_borrowing(self.simInfo, self)

        if iMethod == "assets":
            financialAssetRatio = self.get_param('financialAssetRatio', required=True)
            externalAssets = loans * (1 - financialAssetRatio) / financialAssetRatio
            totalAssets = loans + externalAssets
            self.cash = cashRatio * totalAssets
            initialInvestments = externalAssets - self.cash
            initialCapital = capitalRatio * totalAssets
            self.deposits = totalAssets - borrowings - initialCapital
            if self.deposits < 0:
                # can't have negative deposits. Make them zero, and increase cash by the same amount.
                self.cash -= self.deposits
                self.deposits = 0
                # this will change all the ratios.
        elif iMethod == "liabilities":
            financialLiabilityRatio = self.get_param('financialLiabilityRatio', required=True)
            self.deposits = borrowings / financialLiabilityRatio - borrowings
            initialCapital = (self.deposits + borrowings) * capitalRatio / (1 - capitalRatio)
            self.cash = cashRatio * (self.deposits + borrowings + initialCapital)
            initialInvestments = initialCapital + borrowings + self.deposits - loans - self.cash
            if initialInvestments < 0:
                # can't have negative investments. Make them zero, and increase deposits by the same amount
                self.deposits -= initialInvestments
                initialInvestments = 0
        else:
            msg = "balanceSheetMethod %r not recognised" % iMethod
            logger.error(msg)
            raise ParameterError(msg)

        self.initialise_investments(initialInvestments)
        self.record_state()
Esempio n. 2
0
 def total_borrowing(self):
     return network.bank_borrowing(self.simInfo, self)