def __init__(self, amount, interest, date=None, name=None, meta={}): self._date_start = validate.valid_date(date) self._name = validate.valid_name(name) self._meta = meta # check for problems assert ((isinstance(amount, int) or (isinstance(amount, float)))) if interest > 1.: interest = interest / 100. ## generic variables, which are basically used in any class ## ## that inherits from account ## # setting up the report and the semantics self._report = Report(name=self._name) self._account = int(amount * 100) # amount of money to start with self._interest = interest # interest rate self._current_date = self._date_start # current date of the simulation self._caccount = self._account # current account, this variable # is used in all subclasses # sum helper variables for interest calculation and keep self._sum_interest = 0
def __init__(self, property_value, amount, loan, date=None, name=None, meta={}): """ For a property with a given value (property_value), the current amount that is transfered to the owner (amount) is reflected by the amount of money that has been transfered to the loan. Loan must here of class loan property_value : value of the property amount : amount of money that represents the ownership. if amount=property_value, the property totally belongs to the owner, if amount<property_value, the property partly belongs to the loan holder loan : object of type loan, that is linked to this property date : date, for which this property starts to exist name : name of this property meta : meta-information """ assert isinstance( loan, Loan), 'loan must be of type Loan, but is in fact of type ' + str( type(loan)) assert property_value >= amount, 'property_value must be greater than amount' self._name = validate.valid_name(name) self._date_start = validate.valid_date(date) self._meta = meta self._property_value = int(property_value * 100) self._account = int(amount * 100) # amount of money already invested self._caccount = self._account self._loan = loan # setting up the report and the semantics self._report = Report(name=self._name) self._report.add_semantics('account', 'saving_abs') self._report.add_semantics('property_value', 'none') self._current_date = self._date_start self.make_report()
def __init__(self, *accounts, name=None, date=None, meta=None): """ Simulations can be initialized with names, to make differentiate between different simulations """ # check for errors in the input of accounts for account in accounts: if not isinstance(account, Account): raise TypeError( str(account) + " is not of type or subtype Account") if name is None: self._name = 'Simulation ' + str(datetime.now()) else: self._name = name # a simuation can also store meta information self._meta = meta self._report = Report(self._name) self._report.add_semantics('from_acc', 'none') self._report.add_semantics('to_acc', 'none') self._report.add_semantics('value', 'input_cum') self._report.add_semantics('kind', 'none') self._report.add_semantics('name', 'none') self._report.add_semantics('code', 'none') self._report.add_semantics('message', 'none') self._payments = PaymentList() self._payments_iter = None self._next_pay = None self._date_start = validate.valid_date(date) self._day = 0 self._current_date = self._date_start # list of accounts to manage self._accounts = list(accounts) # list of controller-functions executed before day-simulation. # controller functions are executed before the day to check custom # states of the accounts and perform actions self._controller = []
def __init__(self, guthaben, bausparsumme, punkte, tarif, date=None, name=None): if tarif not in tarife: raise TypeError( "Contract type not found in contract list: {}".format(tarif)) self._tarif = tarife[tarif] self._date_start = self.valid_date(date) self._name = self.valid_name(name) self._report = Report(name=self._name + ' - ' + str(self._date_start.strftime(C_format_date))) self._report.add_semantics('account', 'saving_abs') self._report.add_semantics('loan', 'debt_abs') self._report.add_semantics('loan_interest', 'cost_cum') self._report.add_semantics('account_interest', 'win_cum') self._report.add_semantics('points', 'none') self._report.add_semantics('payments', 'debtpayment_cum') self._report.add_semantics('agio', 'cost_cum') self._report.add_semantics('insurance', 'cost_cum') self._report.add_semantics('entgelt', 'cost_cum') self._guthaben = int(guthaben * 100) self._bausparsumme = int(bausparsumme * 100) self._darlehen = self._bausparsumme - np.max([ self._bausparsumme * self._tarif['bausparanteil'], self._guthaben ]) self._punkte = punkte self._payments = Payments() self._payments_iter = None self._sum_interest = 0 # this value is used because it is inherited from account self._sum_loan_interest = 0 # but we need an extra variable for the loan interest self._sum_loan_insurance = 0 self._day = -1 self._current_date = self._date_start self._caccount = self._guthaben self._cdarlehen = self._darlehen self._next_pay = None self._interest_paydate = {'month': 12, 'day': 31} # this function determines, in which phase of the product we are self._phase = self.saving_phase # reporting functionality self._record = { 'loan_interest': 0, 'account_interest': 0, 'payments': 0, 'entgelt': 0, 'insurance': 0, 'agio': 0 }