Changed one of the visualizations to compare different APRs.
Demonstrate 3-5$ APR and compare with linear.
This commit is contained in:
parent
c646b1d80b
commit
9bdfbd8d85
33
econ-demo.py
33
econ-demo.py
@ -30,7 +30,7 @@ def ubi(balances, dividend=10, terms=3):
|
||||
new_bal.append(b)
|
||||
return new_bal
|
||||
|
||||
def get_balances_over_time(names, balances, func, terms=4):
|
||||
def get_balances_over_time(names, balances, func, terms=4, param=0):
|
||||
if func is None:
|
||||
print("Need a function!")
|
||||
return
|
||||
@ -44,7 +44,10 @@ def get_balances_over_time(names, balances, func, terms=4):
|
||||
df = pd.DataFrame(data)
|
||||
for t in range(1,terms):
|
||||
key = str(t)
|
||||
if param == 0:
|
||||
frame = func(balances, terms=t)
|
||||
else:
|
||||
frame = func(balances, terms=t, rate=param)
|
||||
if frame is not None:
|
||||
df[key] = frame
|
||||
return df
|
||||
@ -167,12 +170,34 @@ def visualize_inflation(terms=50):
|
||||
|
||||
plt.style.use('dark_background')
|
||||
plt.plot(
|
||||
x, total_supply_ubi, color="cyan", label="UBI (n=3, du=10)"
|
||||
x, total_supply_ubi, color="cyan", label="? (linear)"
|
||||
)
|
||||
plt.plot(
|
||||
x, total_supply_si, color="red", label="Debt (APY=5%)"
|
||||
x, total_supply_si, color="red", label="apy = 0.05"
|
||||
)
|
||||
plt.title("Money Supply over Time: UBI vs Compounding Interest")
|
||||
plt.plot(
|
||||
x,
|
||||
calc_total_supply(get_balances_over_time(
|
||||
participants,
|
||||
balances,
|
||||
compounding_interest,
|
||||
terms=terms,
|
||||
param=0.04
|
||||
)),
|
||||
color="orange", label="apy = 0.04"
|
||||
)
|
||||
plt.plot(
|
||||
x,
|
||||
calc_total_supply(get_balances_over_time(
|
||||
participants,
|
||||
balances,
|
||||
compounding_interest,
|
||||
terms=terms,
|
||||
param=0.03
|
||||
)),
|
||||
color="yellow", label="apy = 0.03"
|
||||
)
|
||||
plt.title("Supply of Money Over Time")
|
||||
plt.legend()
|
||||
plt.xlabel("Terms")
|
||||
plt.ylabel("Total Currency")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user