Flipping Profit Per Token

[1]:
"""
Update Parameters Here
"""
COLLECTION = "8_BIT_UNIVERSE"
MINT_PRICE = 0.08888
MAX_TOKEN_ID = 8888
FIRST_N_TOKENS = 100
[2]:
"""
@author: mdigi14
"""

import pandas as pd
import matplotlib.pyplot as plt

from honestnft_utils import config

SALES_DATA = f"{config.FIRST_FLIP_REVENUE_FOLDER}/{COLLECTION}_first_sale_revenue.csv"


"""
Plot params
"""
plt.rcParams.update({"figure.facecolor": "white", "savefig.facecolor": "white"})
[3]:
"""
Generate Plot
"""

sales = pd.read_csv("{}".format(SALES_DATA))

price_dict = pd.Series(sales["price"].values, index=sales["id"]).to_dict()
seen = set(sales["id"])

for i in range(0, MAX_TOKEN_ID):
    if i not in seen:
        price_dict[i] = MINT_PRICE

dict_list = []
for i in range(0, MAX_TOKEN_ID):
    dict_entry = {"id": i, "profit": price_dict[i] - MINT_PRICE}

    dict_list.append(dict_entry)


profits = pd.DataFrame(dict_list)
profits = profits.sort_values(by=["id"])
profits.to_csv(f"{config.FIRST_FLIP_PROFITS_FOLDER}/{COLLECTION}_profits.csv")


total_collection_profits = profits["profit"].sum()
print("Total profit on first flip: ", total_collection_profits)

grifter_df = profits[profits["id"] < FIRST_N_TOKENS]
grifter_profits = grifter_df["profit"].sum()
print("Profit on first flip for first 100 tokens: ", grifter_profits)

print(
    "Percentage of first flip profits from first {} tokens: ".format(FIRST_N_TOKENS),
    round(grifter_profits / total_collection_profits, 2),
)

profits.plot.scatter(
    x="id", y="profit", grid=True, alpha=0.5, title="{}".format(COLLECTION)
)
plt.xlabel("Token ID")
plt.ylabel("Profit (Ether)")
plt.axvline(x=FIRST_N_TOKENS, label="line at id = {}".format(FIRST_N_TOKENS), c="r")
plt.gcf().set_size_inches(15, 10)
plt.legend()
Total profit on first flip:  382.65516932740314
Profit on first flip for first 100 tokens:  186.27607744948332
Percentage of first flip profits from first 100 tokens:  0.49
[3]:
<matplotlib.legend.Legend at 0x7f959ac40370>
../_images/notebooks_flipping_profit_per_token_3_2.png