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
35
econ-demo.py
35
econ-demo.py
@ -30,7 +30,7 @@ def ubi(balances, dividend=10, terms=3):
|
|||||||
new_bal.append(b)
|
new_bal.append(b)
|
||||||
return new_bal
|
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:
|
if func is None:
|
||||||
print("Need a function!")
|
print("Need a function!")
|
||||||
return
|
return
|
||||||
@ -44,7 +44,10 @@ def get_balances_over_time(names, balances, func, terms=4):
|
|||||||
df = pd.DataFrame(data)
|
df = pd.DataFrame(data)
|
||||||
for t in range(1,terms):
|
for t in range(1,terms):
|
||||||
key = str(t)
|
key = str(t)
|
||||||
frame = func(balances, terms=t)
|
if param == 0:
|
||||||
|
frame = func(balances, terms=t)
|
||||||
|
else:
|
||||||
|
frame = func(balances, terms=t, rate=param)
|
||||||
if frame is not None:
|
if frame is not None:
|
||||||
df[key] = frame
|
df[key] = frame
|
||||||
return df
|
return df
|
||||||
@ -167,12 +170,34 @@ def visualize_inflation(terms=50):
|
|||||||
|
|
||||||
plt.style.use('dark_background')
|
plt.style.use('dark_background')
|
||||||
plt.plot(
|
plt.plot(
|
||||||
x, total_supply_ubi, color="cyan", label="UBI (n=3, du=10)"
|
x, total_supply_ubi, color="cyan", label="? (linear)"
|
||||||
)
|
)
|
||||||
plt.plot(
|
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.legend()
|
||||||
plt.xlabel("Terms")
|
plt.xlabel("Terms")
|
||||||
plt.ylabel("Total Currency")
|
plt.ylabel("Total Currency")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user