Example #1
0
from Investor import Investor
from Calendar import Calendar
from PropertyObj import PropertyObj

MONTHS_IN_PERIOD = 600
Y_RANGE = [0, 1000000]
DOWN_PAYMENT_PERCENTAGE = 20

calendar = Calendar()
investor = Investor(DOWN_PAYMENT_PERCENTAGE)
property_obj = PropertyObj()

# every month, money comes in and money goes out
for month in range(0, MONTHS_IN_PERIOD):
    calendar.nextMonth()
    property_obj.updateValue()
    investor.earnIncome()
    investor.payPropertyPayments(property_obj)
    investor.updateNetWorth(property_obj)
    if (investor.canAffordProperty(property_obj) and len(investor.loans) < 1):
        investor.buyProperty(property_obj)


# function which takes the raw data and makes traces for the chart
# TODO: this function is too large. break it up, it smells
def mapTraces(investor):
    down_payment_percentage = investor.down_payment_percentage
    x_axis_months = [0]
    for month in range(0, MONTHS_IN_PERIOD):
        x_axis_months.append(month)