
from base_class import BaseVariableFunction
from base_class import *
baseclass = BaseVariableFunction(__file__)


old_print = print


def timestamped_print(*args, **kwargs):
    old_print(datetime.datetime.utcnow().replace(
        microsecond=0), *args, **kwargs)


print = timestamped_print
print('\n'*5)
print(f"{'{:<6}'.format('ENTER')} {baseclass.scriptfilename} ----------------NOTE-----------NOTE---------------")


def filter_onhand_dalao():

    df = pd.read_excel(baseclass.dalao_merge_path /
                       "un_onhand_dalao.xlsx", dtype=object)
    
    print(f"pre un_onhand_dalao_df= {len(df)}")

    df["isNormal"] = df["isNormal"].astype(int)
    filter_mask = (
        (df["isNormal"] == 1) | (df["isNormal"] == -1)
    )
    df = df[filter_mask].drop_duplicates().reset_index(drop=True)
    df = df[["Maker"]].drop_duplicates().reset_index(drop=True)
    df.columns = ["dalaoAddress"]
    print(f"filter_dalao len= {len(df)}")
    df.loc[len(df) ] = [baseclass.mywalletaddress]
    print(f"aft un_onhand_dalao_df= {len(df)}")
 
    # https://dexscreener.com/solana/9s9sgqskfyzbygm45qblje4rt6calfa2dbhjrevlszrc?maker=47TwqZwwMGHc9CkJJxvVgFNGLDqBuSPy95KwUSTcLSti

    df.to_csv(baseclass.dalao_merge_path /
              "filter_dalao.csv", index=False)
    

    return


filter_onhand_dalao()


print(f"{'{:<6}'.format('END')} {baseclass.scriptfilename} ----------------NOTE-----------NOTE---------------")
