Pre-Reveal Tests

[1]:
"""
Update parameters
"""
COLLECTION = "MekaVerse"
ST_DEVS = 3  # set number of st devs away from mean offer
MINT_PRICE = 0.2
TOKEN_COL = "TOKEN_ID"
[2]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

from honestnft_utils import config

sns.set_style("darkgrid")


"""
Plot params
"""
plt.rcParams.update(
    {
        "figure.facecolor": "white",
        "savefig.facecolor": "white",
        "figure.autolayout": True,
        "figure.figsize": [15, 5],
    }
)


"""
Import pre-reveal sales and bids
"""
bids = pd.read_csv(f"{config.PRE_REVEAL_BIDS_FOLDER}/{COLLECTION}_pre-reveal_bids.csv")
sales = pd.read_csv(
    f"{config.PRE_REVEAL_SALES_FOLDER}/{COLLECTION}_pre-reveal_sales.csv"
)


"""
Helper functions
"""


def get_mean(offers: pd.Series) -> float:
    return np.mean(offers)  # type: ignore


def get_st_dev(offers: pd.Series) -> float:
    return np.std(offers)  # type: ignore


def find_anomalous_sale(sale_price: float, mean: float, std: float) -> bool:
    if sale_price > (mean + ST_DEVS * std):
        return True
    else:
        return False


def percentage_change(col1: pd.Series, col2: pd.Series) -> pd.Series:
    return ((col2 - col1) / col1) * 100
[3]:
"""
Print overpaid tokens relative to mean offer price
"""

overpaid_tokens = list()

for token in bids[TOKEN_COL].unique():
    offers = bids[bids[TOKEN_COL] == token]["OFFER"]
    if len(offers) > 5:
        mean = get_mean(offers)
        std = get_st_dev(offers)
        if len(sales[sales[TOKEN_COL] == token]) > 0:
            sale_price = sales[sales[TOKEN_COL] == token].iloc[0]["PRICE"]
            rank = sales[sales[TOKEN_COL] == token].iloc[0]["RANK"]
            user = sales[sales[TOKEN_COL] == token].iloc[0]["USER"]
            if find_anomalous_sale(sale_price, mean, std):
                print(
                    f"Token: {token}, Mean Offer: {mean}, Sale Price: {sale_price}, Rank: {rank}, User: {user}"
                )
                overpaid_tokens.append(token)
        else:
            continue
Token: 1545, Mean Offer: 5.1698318014423075, Sale Price: 8.44, Rank: 3655, User: 0x2f7fdc55cf9c62202576bf390fb03d762ac220a1
Token: 1798, Mean Offer: 4.484020833333333, Sale Price: 6.66, Rank: 4895, User: 0x467a44f1d5ac72fea19be7a6680abfaa14f2992a
Token: 174, Mean Offer: 1.3214516129032257, Sale Price: 6.0, Rank: 4864, User: 0xea253aa1737ca26099a169e6310b95ba42cf0a7e
Token: 613, Mean Offer: 3.254, Sale Price: 6.799, Rank: 5169, User: 0xa252bc234d2ebd1ba545dd46002b15915ae835d2
[4]:
"""
Show distribution of offers and sale prices
"""

for token in overpaid_tokens:

    token_bids = bids[bids[TOKEN_COL] == token].copy()
    token_sales = sales[sales[TOKEN_COL] == token].copy()

    ax = sns.kdeplot(token_bids["OFFER"], fill=True)

    xmin, xmax, ymin, ymax = plt.axis()

    for index, row in token_sales.iterrows():
        plt.plot(
            [row["PRICE"], row["PRICE"]],
            [0, ymax],
            "r",
            label="SALE PRICE",
            linestyle="dashed",
        )

    plt.title(token)
    plt.show()
../_images/notebooks_prereveal_tests_4_0.png
../_images/notebooks_prereveal_tests_4_1.png
../_images/notebooks_prereveal_tests_4_2.png
../_images/notebooks_prereveal_tests_4_3.png
[5]:
"""
Show offers that are significantly above mint price
"""

bids["MINT"] = MINT_PRICE
bids["OVER_MINT_PERC"] = percentage_change(bids["MINT"], bids["OFFER"])
bids.sort_values(by="OVER_MINT_PERC", ascending=False, inplace=True)
bids.head(40)
[5]:
Unnamed: 0 TOKEN_ID USER OFFER DATE RANK MINT OVER_MINT_PERC
843 843 1537 0x6b3205edec4db12a337eb8cda07e8bd1ac05bf46 8.200000 2021-10-10T14:08:49.942530 4106 0.2 4000.000000
1051 1051 197 0x85e2bd74a2f987fa93204c51a5b848039240d41a 7.800000 2021-10-10T05:38:45.246644 4421 0.2 3800.000000
847 847 1497 0x3896e573f5ed623876a4f98551a61daf3862f6f4 7.607249 2021-10-10T14:05:47.821228 5655 0.2 3703.624449
1013 1013 6309 0x39d0792ad8a277af90b91c32eabc2aef37f8c151 7.560000 2021-10-10T08:05:41.814990 6985 0.2 3680.000000
1048 1048 197 0x85e2bd74a2f987fa93204c51a5b848039240d41a 7.536900 2021-10-10T05:49:43.465671 4421 0.2 3668.450000
1100 1100 1545 0x86eaa58f41ba0437498581ce9eda504ba6cf5ab9 7.350000 2021-10-10T02:53:07.518731 3655 0.2 3575.000000
867 867 1497 0xaeb3fea566c8bcb7ae6826a03f818d9d386169ba 7.244999 2021-10-10T13:40:34.910681 5655 0.2 3522.499475
990 990 2019 0xb4cfb411252a80b35b6b73737ff11f510d0f5928 7.244000 2021-10-10T08:49:43.536124 242 0.2 3522.000000
1113 1113 6309 0x9a8b7ad7c7bc8502c0e31547de03ba864a444c1a 7.200000 2021-10-10T02:20:52.100388 6985 0.2 3500.000000
1064 1064 6844 0x9a8b7ad7c7bc8502c0e31547de03ba864a444c1a 7.200000 2021-10-10T04:55:47.269648 3375 0.2 3500.000000
1107 1107 6391 0x9a8b7ad7c7bc8502c0e31547de03ba864a444c1a 7.200000 2021-10-10T02:42:12.670765 6961 0.2 3500.000000
1109 1109 6368 0x9a8b7ad7c7bc8502c0e31547de03ba864a444c1a 7.200000 2021-10-10T02:35:57.733484 5117 0.2 3500.000000
1053 1053 197 0xac5eed1aa33250d755ccd837e683254a56373cb6 7.178000 2021-10-10T05:35:16.006723 4421 0.2 3489.000000
796 796 7657 0xaeb3fea566c8bcb7ae6826a03f818d9d386169ba 7.067025 2021-10-10T17:03:19.982690 5181 0.2 3433.512500
1095 1095 4423 0x9a8b7ad7c7bc8502c0e31547de03ba864a444c1a 7.050000 2021-10-10T03:05:06.247173 6444 0.2 3425.000000
1075 1075 4663 0x9a8b7ad7c7bc8502c0e31547de03ba864a444c1a 7.050000 2021-10-10T04:13:21.324647 3744 0.2 3425.000000
1091 1091 4457 0x9a8b7ad7c7bc8502c0e31547de03ba864a444c1a 7.050000 2021-10-10T03:14:27.801584 7591 0.2 3425.000000
795 795 614 0xaeb3fea566c8bcb7ae6826a03f818d9d386169ba 7.034999 2021-10-10T17:03:28.606101 2879 0.2 3417.499475
1103 1103 1545 0x65c35542db19e4978544655d416bed5cbcd5f500 7.000000 2021-10-10T02:48:22.324154 3655 0.2 3400.000000
521 521 1537 0x3e5d248bc1b369b3497f63ff40380b00c610ff58 7.000000 2021-10-11T09:55:17.066798 4106 0.2 3400.000000
1060 1060 2879 0x9a8b7ad7c7bc8502c0e31547de03ba864a444c1a 7.000000 2021-10-10T05:21:25.677457 4588 0.2 3400.000000
1086 1086 6722 0x6ed0e0a9fdb1e48eb8d09b10b327ee510efb7007 7.000000 2021-10-10T03:29:40.626167 3866 0.2 3400.000000
1102 1102 1545 0x65c35542db19e4978544655d416bed5cbcd5f500 7.000000 2021-10-10T02:48:23.873891 3655 0.2 3400.000000
926 926 1497 0x3896e573f5ed623876a4f98551a61daf3862f6f4 6.899999 2021-10-10T10:50:08.760850 5655 0.2 3349.999500
1058 1058 197 0xd3fd48b20d80101af6fa0666e9ed5a44768e5f30 6.835500 2021-10-10T05:31:06.566704 4421 0.2 3317.750000
1057 1057 197 0xd3fd48b20d80101af6fa0666e9ed5a44768e5f30 6.835500 2021-10-10T05:31:07.848802 4421 0.2 3317.750000
841 841 7657 0x3896e573f5ed623876a4f98551a61daf3862f6f4 6.730500 2021-10-10T14:12:14.754584 5181 0.2 3265.250000
788 788 614 0x201cedc1a286150a809f9f1a9e4c05c33ae154b1 6.702000 2021-10-10T17:30:12.970148 2879 0.2 3251.000000
928 928 614 0x3896e573f5ed623876a4f98551a61daf3862f6f4 6.699999 2021-10-10T10:48:18.926117 2879 0.2 3249.999500
778 778 6391 0x201cedc1a286150a809f9f1a9e4c05c33ae154b1 6.673000 2021-10-10T18:06:27.550156 6961 0.2 3236.500000
780 780 1497 0x201cedc1a286150a809f9f1a9e4c05c33ae154b1 6.673000 2021-10-10T17:56:33.062259 5655 0.2 3236.500000
777 777 6844 0x9f1a8e2d468098a784e03d349f6a784aea041b9c 6.671000 2021-10-10T18:08:34.123086 3375 0.2 3235.500000
781 781 1673 0x9f1a8e2d468098a784e03d349f6a784aea041b9c 6.671000 2021-10-10T17:54:32.518140 3437 0.2 3235.500000
787 787 614 0x9f1a8e2d468098a784e03d349f6a784aea041b9c 6.671000 2021-10-10T17:33:15.472341 2879 0.2 3235.500000
779 779 6391 0x9f1a8e2d468098a784e03d349f6a784aea041b9c 6.671000 2021-10-10T17:59:27.897834 6961 0.2 3235.500000
791 791 4457 0x9f1a8e2d468098a784e03d349f6a784aea041b9c 6.671000 2021-10-10T17:20:40.560796 7591 0.2 3235.500000
782 782 1605 0x9f1a8e2d468098a784e03d349f6a784aea041b9c 6.671000 2021-10-10T17:53:10.471459 7421 0.2 3235.500000
790 790 4663 0x9f1a8e2d468098a784e03d349f6a784aea041b9c 6.671000 2021-10-10T17:24:47.738939 3744 0.2 3235.500000
783 783 1537 0x9f1a8e2d468098a784e03d349f6a784aea041b9c 6.671000 2021-10-10T17:51:48.467531 4106 0.2 3235.500000
784 784 1497 0x9f1a8e2d468098a784e03d349f6a784aea041b9c 6.671000 2021-10-10T17:51:00.300600 5655 0.2 3235.500000
[ ]: