Skip to content

Instantly share code, notes, and snippets.

@sourabhxyz
Last active May 17, 2022 04:02
Show Gist options
  • Save sourabhxyz/a963c0dcd20375aba50398ee1e3fb2ef to your computer and use it in GitHub Desktop.
Save sourabhxyz/a963c0dcd20375aba50398ee1e3fb2ef to your computer and use it in GitHub Desktop.
Studying the effects of buybacks on backing for various scenario
import matplotlib.pyplot as plt
def buyback (t, s):
b = t / s # backing is treasury value divided by circulating supply
nt = t - t / 100 # utilising 1% of treasury for buyback, 'nt' now holds the value of new treasury
ns = s - t / (70 * b) # buyback at 70% of backing, 'ns' now holds new circulating supply
return nt, ns
t = [290000000] # starting assumption: $290M treasury
s = [5800] # starting assumption: 5800 circulating wMEMO
b = [t[-1] / s[-1]]
x = [0] # 'x'-axis for the graph, denoting number of buybacks
for i in range(1, 200): # doing buybacks 199 times, theoretically, one can do infinitely number of times
nt, ns = buyback(t[-1], s[-1])
t.append(nt)
s.append(ns)
b.append(nt / ns)
x.append(i)
figure, axis = plt.subplots(2, 2)
axis[0, 0].plot(x, t)
axis[0, 0].set_ylabel('treasury value')
axis[0, 0].set_xlabel('number of buybacks')
axis[0, 1].plot(x, b)
axis[0, 1].set_ylabel('backing value')
axis[0, 1].set_xlabel('number of buybacks')
axis[1, 0].plot(x, s)
axis[1, 0].set_ylabel('circulating supply')
axis[1, 0].set_xlabel('number of buybacks')
figure.suptitle('Studying effects of buybacks on backing when bought each time at 70% of backing by utilising 1% of treasury')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment