Beispiel #1
0
def main(argv):
    configure_logger()

    logging.info('{} {}\n'.format(__NAME, __VERSION))

    inputfile = parse_args(argv)
    # If path to input file is provided, create output log file in the same folder
    if inputfile:
        location = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(inputfile)))
        filepath = os.path.join(location, 'analyse_immo.log')
        add_logger_file_handler(filepath)

    input_data = load_file(inputfile)

    achat_data = input_data['achat']
    defaut_data = input_data['defaut']
    lots_data = input_data['lots']
    credit_data = input_data['credit']
    impot_data = input_data['impot']

    database = Database()
    defaut = Factory.make_defaut(defaut_data)

    bien_immo = Factory.make_bien_immo(achat_data, lots_data, defaut)
    credit = Factory.make_credit(credit_data, bien_immo)
    rendement = Rendement(bien_immo, credit)

    # Impot
    annee_achat = achat_data['annee']
    credit_duree = credit_data['duree_annee']

    # IRPP + 2044
    irpp_2044_list = list()

    for i_annee in range(credit_duree):
        annee_revenu = annee_achat + i_annee
        irpp = Factory.make_irpp(database, impot_data, annee_revenu)

        irpp.annexe_2044 = Factory.make_annexe_2044(database, bien_immo, credit, i_annee + 1)
        irpp_2044_list.append(irpp)

    # IRPP + Micro foncier
    irpp_micro_foncier_list = list()

    for i_annee in range(credit_duree):
        annee_revenu = annee_achat + i_annee
        irpp = Factory.make_irpp(database, impot_data, annee_revenu)

        irpp.micro_foncier = Factory.make_micro_foncier(database, bien_immo)
        irpp_micro_foncier_list.append(irpp)

    # Rapport
    generate_rapport(bien_immo, credit, annee_achat, irpp_2044_list, irpp_micro_foncier_list, rendement)
Beispiel #2
0
    def setUp(self):
        __location__ = os.path.realpath(
            os.path.join(os.getcwd(), os.path.dirname(__file__)))
        __DATA_TEST_PATHNAME = os.path.join(__location__, 'data',
                                            'input_test_simulation_B.json')
        with open(__DATA_TEST_PATHNAME, 'r') as file:
            input_data = json.load(file)

        self.achat_data = input_data['achat']
        self.lots_data = input_data['lots']
        self.credit_data = input_data['credit']

        self.bi = Factory.make_bien_immo(self.achat_data, self.lots_data)
        self.credit = Factory.make_credit(self.credit_data, self.bi)
        self.rdt = Rendement(self.bi, self.credit)
Beispiel #3
0
    def testCashflowMensuel(self):
        self.achat_data['prix_net_vendeur'] = 136000
        self.lots_data[0]['loyer_nu_mensuel'] = 1000
        self.lots_data[0]['charges']['taxe_fonciere'] = 1500
        self.lots_data[0]['charges']['PNO'] = 100
        self.lots_data[0]['charges']['travaux_provision_taux'] = 0.05
        self.credit_data['duree_annee'] = 20
        self.credit_data['taux_interet'] = 0.018
        self.credit_data['taux_assurance'] = 0.0036
        self.credit_data['mode'] = 'fixe_ci'

        bi = Factory.make_bien_immo(self.achat_data, self.lots_data)
        cred = Factory.make_credit(self.credit_data, bi)
        rdt = Rendement(bi, cred)

        self.assertAlmostEqual(rdt.cashflow_net_mensuel, 100.67, 2)