Пример #1
0
# VRO case study
from Income import Income
from Tax import Tax
from Budget import Budget
from Expense import Expense
from Debt import Debt
from Assets import Assets
from Metrics import Metrics
import utils
from Analysis import tortoise_analyze

i = Income()
i.add("salary", 52000 * 12)
i.report()

t = Tax(i.data)
#t.calculate()
t.report()

d = Debt()
d.report()

e = Expense()
e.add("household", 20000)
e.add_yearly("premiums", 165000)
e.report()

b = Budget()
b.add(i, t, d, e)
b.report()
Пример #2
0
        else:
            output.info("You have surplus %.2f to invest." % (self.surplus))
        pie_n = [n for n, v in self.data.items() if (n != "income")]
        pie_v = [abs(v) for n, v in self.data.items() if (n != "income")]
        pie_n.append("surplus")
        pie_v.append(self.surplus)
        utils.piechart("Budget", "Budget Allocation", pie_n, pie_v)

    def get_monthly(self):
        return self.surplus


# Test
if __name__ == "__main__":
    i = Income()
    i.add("w2", 193000)
    i.deduct("401k", 19500)
    i.deduct("hsa", 7100)
    i.report()

    t = Tax(i.data)
    t.credit("child1", 500)
    t.credit("child2", 500)
    t.calculate()
    t.report()

    d = Debt()
    d.add_fixed("mortgage", 225000, 4.125, 30)
    d.add_variable("cc1", 4000, 10)
    d.add_variable("cc2", 10000, 10)
    p = d.calculate()
Пример #3
0
                                 format="%f")
st.info("Your monthly gross income is: %.2f" % (income / 12.0))
#deductions = st.sidebar.slider("Total pre-tax deductions (401k, HSA)", 0, min(income, 19500+7100), step=100, format="%d")
deductions = st.sidebar.number_input("Total pre-tax deductions",
                                     0.0,
                                     income,
                                     format="%f")
st.info("Your monthly pre-tax deductions: %.2f " % (deductions / 12.0))
st.info("Your monthly pre-tax income: %.2f" % ((income - deductions) / 12.0))
tax_status = st.sidebar.selectbox(
    "Tax filling status",
    ['single', 'married_separate', 'married_joint', 'head_household'], 2)
# st.write("Tax filling status: ", tax_status)

i = Income()
i.add("Paycheck", income)
i.deduct("deductions", deductions)

st.subheader("Monthly expenses")
t = Tax()
t.addIncome(i.data)
t.addFilling(tax_status)
t.calculate()

st.info("Your total tax outgo per month: %.2f" % (t.total / 12.0))
for n, v in t.taxes.items():
    st.info("%s : %.2f" % (n, v / 12.0))

# Expenses
st.sidebar.subheader("Expenses")