windowdog 3 tuần trước cách đây
mục cha
commit
d680a89bc1

+ 31 - 0
src/code/for_dune_handle_trade_source.py

@@ -0,0 +1,31 @@
+import sys
+import  pandas as pd
+
+obj_program ={
+
+    "routeUGWgWzqBWFcrCfv8tritsqukccJPu3q5GPP3xS":"ray_amm",
+    "6m2CDdhRgxpH4WjvdzxAYbGxwdGUz5MziiL5jek2kBma":"OKX_v2",
+    "JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4":"Jupiter_v6",
+   "BANANAjs7FJiPQqJTGFzkZJndT9o7UmKiYYGaJz6frGu": "Banana_Gun",
+
+
+}
+def main():
+    # Check if a file name is provided as an argument
+    if len(sys.argv)!= 2:
+        print("Usage: python script.py <filename>")
+        sys.exit(1)
+
+    # Get the file name from the command line argument
+    filename = sys.argv[1]
+    df = pd.read_csv(filename , dtype=object)
+    df["trade_source"] = df["trade_source"].map(obj_program).fillna(df["trade_source"])
+    df.to_csv(f"new_{filename}" , index=False )
+
+
+    # Process the file here
+    print(f"Processing file: {filename}")
+    # Add your file processing logic here
+
+if __name__ == "__main__":
+    main()

+ 0 - 131
src/code/new_8002_add_get_getdalao_activites_number.py

@@ -1,131 +0,0 @@
-
-# from datetime import datetime, timezone
-# from playwright.async_api import async_playwright, Playwright
-# from playwright.sync_api import expect
-from playwright.async_api import Playwright, async_playwright, expect
-import random
-
-from base_class import BaseVariableFunction
-from base_class import *
-baseclass = BaseVariableFunction(__file__)
-
-baseclass.makedirpath(baseclass.browsercookie_path)
-baseclass.makedirpath(baseclass.dalao_solscan_info_path)
-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---------------")
- 
-
-async def do_some_thing(playwright,   arr_url_dalao , url_type):
-
-    # browser =  playwright.chromium.launch(headless=True)
-    context = await playwright.firefox.launch_persistent_context(user_data_dir=USER_DIR_PATH, accept_downloads=True, headless=False)
-    # context = browser.new_context()
-    context.set_default_timeout(19000)
-    # context = await browser.new_context()
-    arr_page = [None]*2
-    arr_page[0] = await context .new_page()
-    await arr_page[0].goto(
-        "https://solscan.io/")
-    await asyncio.sleep(30)
-
-    # print(context.pages)
-
-    for idx_url in range(0, len(arr_url_dalao)):
-
-        str_dalaoTransferUrl = arr_url_dalao[idx_url]
-        str_dalaoaddress =obj_url_2_dalao[str_dalaoTransferUrl]
-        
-        print(f"enter str_dalaoaddress= {str_dalaoaddress}")
-        print(f"enter str_dalaoTransferUrl= {str_dalaoTransferUrl}")
-        print(f"cur_arr_str_dalaoaddress remainder = {len(arr_url_dalao)-idx_url}")
-        arr_page[1] = await context.new_page()
-        page = arr_page[1]
-        await asyncio.sleep(3)
-
-        # tbody_ = page.locator(
-        #     'table.w-full tbody')
-        await page.wait_for_selector('#account-tabs',timeout=15000)
-        await page.wait_for_selector('#account-tabs iv.flex.flex-col.gap-4.items-stretch.justify-start',timeout=15000)
-        arr_div =await page.locator("#account-tabs div.flex.flex-col.gap-4.items-stretch.justify-start div.flex.gap-1.flex-row.items-center.justify-start.flex-wrap").all()
-        # await asyncio.sleep(3)
-        str_tx_info =(await arr_div[0].text_content().strip())
-        #arr_tds = await last_tr.locator('td').all()
-        # p_token_last_active =  arr_tds[0].locator("p")
-        # str_token_last_active =( await p_token_last_active.text_content()).strip()
-
-        print(str_tx_info)
- 
- 
-
-
-        time.sleep(1)
-        await page.close()
-
-    await context.close()
-
-
-async def get_onedriver_swapactivities( arr_url_dalao , url_type):
-    async with async_playwright() as playwright:
-
-        await do_some_thing(playwright, arr_url_dalao, url_type)
-
-
-async def main():
-    print("enter main()")
-    if len(arr_dalao_url)>0:
-        await get_onedriver_swapactivities(
-            arr_url_dalao = arr_dalao_url , url_type = "transfer_counts")
-        await asyncio.sleep(3)
-        
-    # if len(arr_dalao_token_inflow_transfer_url)>0:
-    #     await get_onedriver_swapactivities(
-    #         arr_url_dalao = arr_dalao_token_inflow_transfer_url , url_type = "swap_counts")
-    #     await asyncio.sleep(3)
- 
-
-
-df = pd.read_excel(baseclass.dalao_tran_gmgnOrdex_path /
-                 "input_dalao.xlsx", dtype=object)
-
-arr_str_dalaoaddress = df['dalaoaddress'].tolist()
-arr_str_dalaoaddress=arr_str_dalaoaddress[0:4]
-# arr_dalao_sol_transfer_url =[]
-arr_dalao_url = []
-arr_dalao_swap = []
-obj_url_2_dalao={
-    
-}
-def init():
-    now_time = time.time()
-    global obj_url_2_dalao
-    global arr_dalao_sol_transfer_url ,arr_dalao_token_inflow_transfer_url ,arr_dalao_token_outflow_transfer_url , arr_dalao_usdc_transfer_url
-    for str_dalaoaddress in arr_str_dalaoaddress:
-        # file = baseclass.dalao_solscan_info_path / f"ori_txhash_{str_dalaoaddress}.csv"
-        dalao_transfer_counts_file = baseclass.dalao_solscan_info_path / f"dalao_transfer_counts.json"
-        # token_inflow_transfer_file = baseclass.dalao_solscan_info_path / f"token_inflow_{str_dalaoaddress}.csv"
-   
-        url_transfer = f"https://solscan.io/account/{str_dalaoaddress}"  
-        # url_transfer = f"https://solscan.io/account/{str_dalaoaddress}#transfers"  
-        url_swap = f"https://solscan.io/account/{str_dalaoaddress}#defiactivities"     
-        arr_dalao_url.append(url_transfer)
-        obj_url_2_dalao[url_transfer] = str_dalaoaddress
-        
- 
-            
-
-
-init()
- 
-downloads_path = baseclass.dalao_solscan_info_path
-USER_DIR_PATH = baseclass.browsercookie_path
-asyncio.run(main())
-print(f"{'{:<6}'.format('END')} {baseclass.scriptfilename} ----------------NOTE-----------NOTE---------------")

+ 0 - 202
src/code/new_8002_get_transfer_info_bysolscan_playwright.py

@@ -1,202 +0,0 @@
-
-# from datetime import datetime, timezone
-# from playwright.async_api import async_playwright, Playwright
-# from playwright.sync_api import expect
-from playwright.async_api import Playwright, async_playwright, expect
-import random
-
-from base_class import BaseVariableFunction
-from base_class import *
-baseclass = BaseVariableFunction(__file__)
-
-baseclass.makedirpath(baseclass.browsercookie_path)
-baseclass.makedirpath(baseclass.dalao_solscan_info_path)
-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---------------")
- 
-
-async def do_some_thing(playwright,   arr_url_dalao , url_type):
-
-    # browser =  playwright.chromium.launch(headless=True)
-    context = await playwright.firefox.launch_persistent_context(user_data_dir=USER_DIR_PATH, accept_downloads=True, headless=False)
-    # context = browser.new_context()
-    context.set_default_timeout(19000)
-    # context = await browser.new_context()
-    arr_page = [None]*2
-    arr_page[0] = await context .new_page()
-    await arr_page[0].goto(
-        "https://solscan.io/")
-
-    # print(context.pages)
-
-    for idx_url in range(0, len(arr_url_dalao)):
-
-        str_dalaoTransferUrl = arr_url_dalao[idx_url]
-        str_dalaoaddress =obj_url_2_dalao[str_dalaoTransferUrl]
-        
-        print(f"enter str_dalaoaddress= {str_dalaoaddress} url_type={url_type}")
-        # print(f"enter str_dalaoTransferUrl= {str_dalaoTransferUrl}")
-        print(f"cur_arr_str_dalaoaddress remainder = {len(arr_url_dalao)-idx_url}")
-        arr_page[1] = await context.new_page()
-        page = arr_page[1]
-
-        async with page.expect_download() as download_info:
-            try:
-                await page.goto(str_dalaoTransferUrl, timeout=0)
-            except:
-                # Wait for the download to start
-                download = await download_info.value
-                # Wait for the download process to complete
-                print(await download.path())
-                # Save downloaded file somewhere
-                await download.save_as(baseclass.dalao_solscan_info_path / f"{url_type}_{str_dalaoaddress}.csv")
-            await page.wait_for_timeout(2200)
-        time.sleep(1)
-        await page.close()
-
-    await context.close()
-
-
-async def get_onedriver_swapactivities( arr_url_dalao , url_type):
-    async with async_playwright() as playwright:
-
-        await do_some_thing(playwright, arr_url_dalao, url_type)
-
-
-async def main():
-    print("enter main()")
-    if len(arr_dalao_sol_transfer_url)>0:
-        await get_onedriver_swapactivities(
-            arr_url_dalao = arr_dalao_sol_transfer_url , url_type = "sol_transfer")
-        await asyncio.sleep(3)
-        
-    if len(arr_dalao_token_transfer_url)>0:
-        await get_onedriver_swapactivities(
-            arr_url_dalao = arr_dalao_token_transfer_url , url_type = "token_transfer")
-        await asyncio.sleep(3)
- 
- 
-    if len(arr_dalao_usdc_transfer_url)>0:
-        await get_onedriver_swapactivities(
-            arr_url_dalao = arr_dalao_usdc_transfer_url , url_type = "usdc_transfer")
-
-    if len(arr_dalao_special_token_transfer_url)>0:
-        await get_onedriver_swapactivities(
-            arr_url_dalao = arr_dalao_special_token_transfer_url , url_type = "special_token")
-
-
-
-
-
-find_depth = "depth_01"
-df = pd.read_excel(baseclass.dalao_tran_gmgnOrdex_path /
-                 "input_dalao.xlsx", dtype=object)
-
-str_tokenaddress_dalao_source = "4GULMPKBJLruChBZWksZzukAg1AjSCmCTMn9ny2Xpump"
-arr_str_dalaoaddress = df[f'dalao_{find_depth}'].drop_duplicates().dropna().tolist()
-obj_ex_address ={
-    
-    "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1":"buy-achipompomhat.sol",
-"CoXccZ3RqJGHQspgei4NdMCW2No1EtTCgevy9CYwaNey":"cryptoxiao.sol",
-"6dEm5Z5NGqNuavGV2fmiRnE55V9jpygsy8RngLxszBGA":"coinbaseventures.sol"
-}
-arr_exclude_address= list(obj_ex_address.keys())
-arr_str_dalaoaddress=[add for add in arr_str_dalaoaddress if add not in  arr_exclude_address]
-arr_dalao_sol_transfer_url =[]
-arr_dalao_token_transfer_url =[]
-arr_dalao_special_token_transfer_url =[]
-arr_dalao_usdc_transfer_url =[]
-obj_url_2_dalao={
-    
-}
-def init():
-    now_time = time.time()
-    global obj_url_2_dalao
-    global arr_dalao_sol_transfer_url ,arr_dalao_token_transfer_url ,    arr_dalao_usdc_transfer_url
-    for str_dalaoaddress in arr_str_dalaoaddress: 
- 
-        sol_transfer_file = baseclass.dalao_solscan_info_path / f"sol_transfer_{str_dalaoaddress}.csv"
-        token_transfer_file = baseclass.dalao_solscan_info_path / f"token_transfer_{str_dalaoaddress}.csv"
-        special_token_transfer_file = baseclass.dalao_solscan_info_path / f"special_token_transfer_{str_dalaoaddress}.csv"
-        usdc_transfer_file = baseclass.dalao_solscan_info_path / f"usdc_transfer_{str_dalaoaddress}.csv"
-        
-        
- 
-        url_sol_transfer = f"https://api-v2.solscan.io/v2/account/transfer/export?address={str_dalaoaddress}&activity_type[]=ACTIVITY_SPL_TRANSFER&activity_type[]=ACTIVITY_SPL_MINT&amount[]=0.3&amount[]=undefined&token=So11111111111111111111111111111111111111111&exclude_amount_zero=true&remove_spam=true"    
-        # url_token_inflow_transfer = f"https://api-v2.solscan.io/v2/account/transfer/export?address={str_dalaoaddress}&activity_type[]=ACTIVITY_SPL_TRANSFER&activity_type[]=ACTIVITY_SPL_MINT&exclude_token=So11111111111111111111111111111111111111111&exclude_amount_zero=true&remove_spam=true&flow=in"
-        # url_token_outflow_transfer = f"https://api-v2.solscan.io/v2/account/transfer/export?address={str_dalaoaddress}&activity_type[]=ACTIVITY_SPL_TRANSFER&activity_type[]=ACTIVITY_SPL_MINT&exclude_token=So11111111111111111111111111111111111111111&exclude_amount_zero=true&remove_spam=true&flow=out"
-        url_token_transfer = f"https://api-v2.solscan.io/v2/account/transfer/export?address={str_dalaoaddress}&activity_type[]=ACTIVITY_SPL_TRANSFER&activity_type[]=ACTIVITY_SPL_MINT&exclude_token=So11111111111111111111111111111111111111111&exclude_amount_zero=true&remove_spam=true"
- 
-        url_special_token_transfer =f"https://api-v2.solscan.io/v2/account/transfer/export?address={str_dalaoaddress}&token={str_tokenaddress_dalao_source}"
-        url_usdc_transfer = f"https://api-v2.solscan.io/v2/account/transfer/export?address={str_dalaoaddress}&activity_type[]=ACTIVITY_SPL_TRANSFER&activity_type[]=ACTIVITY_SPL_MINT&amount[]=100&amount[]=undefined&token=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&exclude_amount_zero=true&remove_spam=true"
-        obj_url_2_dalao[url_sol_transfer] =str_dalaoaddress
- 
-        obj_url_2_dalao[url_token_transfer] =str_dalaoaddress
-        obj_url_2_dalao[url_usdc_transfer] =str_dalaoaddress
-        obj_url_2_dalao[url_special_token_transfer] = str_dalaoaddress
-        
-    
-        if sol_transfer_file.exists():
-            modified_time  =  sol_transfer_file.stat().st_mtime
-            # 3 * 60 分钟内不会在获取
-            if(now_time -modified_time >12 * 60 * 60):
-                arr_dalao_sol_transfer_url.append(url_sol_transfer)
-            else:
-                pass
-        else:
-            arr_dalao_sol_transfer_url.append(url_sol_transfer)
-            
-        if token_transfer_file.exists():
-            modified_time  =  token_transfer_file.stat().st_mtime
-            # 3 * 60 分钟内不会在获取
-            if(now_time -modified_time >12 * 60 * 60):
-                arr_dalao_token_transfer_url.append(url_token_transfer)
-            else:
-                pass
-        else:
-            arr_dalao_token_transfer_url.append(url_token_transfer)
-            
- 
-        if usdc_transfer_file.exists():
-            modified_time  =  usdc_transfer_file.stat().st_mtime
-            # 3 * 60 分钟内不会在获取
-            if(now_time -modified_time >12 * 60 * 60):
-                arr_dalao_usdc_transfer_url.append(url_usdc_transfer)
-            else:
-                pass
-        else:
-            arr_dalao_usdc_transfer_url.append(url_usdc_transfer)
-            
-        if special_token_transfer_file.exists():
-            modified_time  =  special_token_transfer_file.stat().st_mtime
-            # 3 * 60 分钟内不会在获取
-            if(now_time -modified_time >12 * 60 * 60):
-                arr_dalao_special_token_transfer_url.append(url_special_token_transfer)
-            else:
-                pass
-        else:
-            arr_dalao_special_token_transfer_url.append(url_special_token_transfer)
-            
-          
-            
-            
-
-
-init()
-if len(arr_dalao_sol_transfer_url) ==0 and len(arr_dalao_token_transfer_url) ==0 and  len(arr_dalao_usdc_transfer_url)==0 and len(arr_dalao_special_token_transfer_url)==0:
-    print("dont has dalao need get")
-    exit()
-
-downloads_path = baseclass.dalao_solscan_info_path
-USER_DIR_PATH = baseclass.browsercookie_path
-asyncio.run(main())
-print(f"{'{:<6}'.format('END')} {baseclass.scriptfilename} ----------------NOTE-----------NOTE---------------")

+ 0 - 108
src/code/new_8004_merge_depth.py

@@ -1,108 +0,0 @@
-
-# from datetime import datetime, timezone
-# from playwright.async_api import async_playwright, Playwright
-# from playwright.sync_api import expect
- 
-from base_class import BaseVariableFunction
-from base_class import *
-baseclass = BaseVariableFunction(__file__)
-
-baseclass.makedirpath(baseclass.ana_dalao_relation_by_solscan_path )
-
- 
-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---------------")
-
-df = pd.read_excel(baseclass.dalao_tran_gmgnOrdex_path /
-                "input_dalao.xlsx", dtype=object)
- 
-find_depth = "depth_01"
-obj_ex_address ={
-    
-    "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1":"buy-achipompomhat.sol",
-"CoXccZ3RqJGHQspgei4NdMCW2No1EtTCgevy9CYwaNey":"cryptoxiao.sol",
-"6dEm5Z5NGqNuavGV2fmiRnE55V9jpygsy8RngLxszBGA":"coinbaseventures.sol"
-}
-arr_exclude_address= list(obj_ex_address.keys())
-
-arr_str_dalaoaddress = df[f'dalao_{find_depth}'].drop_duplicates().dropna().tolist()
-arr_str_dalaoaddress=[add for add in arr_str_dalaoaddress if add not in  arr_exclude_address]
-find_depth = "depth_01"
- 
-arr_str_dalaoaddress = df[f'dalao_{find_depth}'].drop_duplicates().dropna().tolist()
-
-# arr_str_dalaoaddress=arr_str_dalaoaddress[0:5]
-str_tokenaddress_dalao_source = "4GULMPKBJLruChBZWksZzukAg1AjSCmCTMn9ny2Xpump"
- 
-
-
-def get_reladd_count(gdf):
-    gdf["reladd_count"] = len(gdf)
-    return gdf
-
-
-def main():
-    df_sol_transfer = None
-    for str_dalaoaddress in arr_str_dalaoaddress:
-        if not (baseclass.ana_dalao_relation_by_solscan_path /str_tokenaddress_dalao_source/find_depth/  "final"/f"final_sol_transfer_{str_dalaoaddress}.xlsx" ).exists():
-            continue
-        print(f"enter {str_dalaoaddress}")
-        cur_df_sol_transfer = pd.read_excel(baseclass.ana_dalao_relation_by_solscan_path /str_tokenaddress_dalao_source/find_depth/"final"/ f"final_sol_transfer_{str_dalaoaddress}.xlsx",dtype=object )
-        df_sol_transfer = pd.concat([df_sol_transfer,cur_df_sol_transfer])
-    df_sol_transfer = df_sol_transfer.astype({
-
-        "timestamp":int,
-        "amount":float,
-        "is_exend":int,
-        "is_relationend":int,
-        "sol_dalao_count":int,
-        
-    })
- 
- 
-    df_sol_transfer.to_excel(baseclass.ana_dalao_relation_by_solscan_path /str_tokenaddress_dalao_source/find_depth/  f"fir_sol_transfer_{find_depth}.xlsx" ,index=False)
-    mask_end = ( (df_sol_transfer["is_exend"]==1 ) | (df_sol_transfer["is_relationend"]==1))  
-    end_df = df_sol_transfer[ mask_end]
-    end_df.to_excel(baseclass.ana_dalao_relation_by_solscan_path /str_tokenaddress_dalao_source/find_depth/  f"endaddress_sol_transfer_{find_depth}.xlsx" ,index=False)
- 
-    df_sol_transfer = df_sol_transfer[ ~mask_end].reset_index(drop=True)
-
-    df_sol_transfer["reladd_count"]  = 0
-    
-
-    df_sol_transfer = df_sol_transfer.groupby(by = [ "rel_address" ],  group_keys=False).apply(lambda gdf : get_reladd_count(gdf))
-
-    df_sol_transfer = df_sol_transfer.sort_values(by=[ "sol_dalao_count"  , "dalaoaddress" ,"timestamp"],ascending=False)
-
-    df_sol_dalao_count = df_sol_transfer[[  "dalaoaddress", "sol_dalao_count"  ]].drop_duplicates()
-
-    # str_tokenaddress_dalao_source
-
-    df_sol_dalao_count=df_sol_dalao_count.sort_values(by=["sol_dalao_count"],ascending=False)
-    
-    df_sol_dalao_count["scan_activites"] = df_sol_dalao_count.apply(lambda ser : baseclass.makeurl(f"https://solscan.io/account/{ser['dalaoaddress']}#defiactivities" , f"{ser['dalaoaddress'][0:6]}") , axis=1)
- 
-    df_sol_dalao_count["scan_token_source"] = df_sol_dalao_count.apply(lambda ser : baseclass.makeurl(f"https://solscan.io/account/{ser['dalaoaddress']}?token_address={str_tokenaddress_dalao_source}#transfers" , f"{ser['dalaoaddress'][0:6]}") , axis=1)
- 
-
-    #  https://gmgn.ai/sol/token/4GULMPKBJLruChBZWksZzukAg1AjSCmCTMn9ny2Xpump?tab=activity&maker=58YHxodnzZKxVBE5EsATs38ywEFV7M8ijjBoBkYAJY8J
-
-
-    
-    df_sol_dalao_count.to_excel(baseclass.ana_dalao_relation_by_solscan_path /str_tokenaddress_dalao_source/find_depth/  f"counts_sol_transfer_{find_depth}.xlsx" ,index=False)
-    df_sol_transfer.to_excel(baseclass.ana_dalao_relation_by_solscan_path /str_tokenaddress_dalao_source/find_depth/  f"sec_sol_transfer_{find_depth}.xlsx" ,index=False)
-     
-
-
-    return
-
-main()

+ 12 - 9
src/code/test_my_find_zhuangjia/new_8002_add_get_getdalao_activites_number.py

@@ -35,6 +35,7 @@ async def do_some_thing(playwright,   arr_url_dalao , url_type):
     arr_page[0] = await context .new_page()
     await arr_page[0].goto(
         "https://solscan.io/")
+    await asyncio.sleep(30)
 
     # print(context.pages)
 
@@ -48,19 +49,21 @@ async def do_some_thing(playwright,   arr_url_dalao , url_type):
         print(f"cur_arr_str_dalaoaddress remainder = {len(arr_url_dalao)-idx_url}")
         arr_page[1] = await context.new_page()
         page = arr_page[1]
+        await asyncio.sleep(3)
 
-        tbody_ = page.locator(
-            'table.w-full tbody')
+        # tbody_ = page.locator(
+        #     'table.w-full tbody')
+        await page.wait_for_selector('#account-tabs',timeout=15000)
+        await page.wait_for_selector('#account-tabs iv.flex.flex-col.gap-4.items-stretch.justify-start',timeout=15000)
         arr_div =await page.locator("#account-tabs div.flex.flex-col.gap-4.items-stretch.justify-start div.flex.gap-1.flex-row.items-center.justify-start.flex-wrap").all()
+        # await asyncio.sleep(3)
         str_tx_info =(await arr_div[0].text_content().strip())
         #arr_tds = await last_tr.locator('td').all()
         # p_token_last_active =  arr_tds[0].locator("p")
         # str_token_last_active =( await p_token_last_active.text_content()).strip()
 
         print(str_tx_info)
-        # "div.lg\:flex:nth-child(1) > div:nth-child(1)"
-        # "html.light body.min-h-screen.font-sans div#__next div.flex.flex-col.gap-0.items-stretch.justify-start.h-full.min-h-screen div.w-full.flex-1 div.my-0.mx-auto.max-w-full.px-4.md:px-6.2xl:px-0.2xl:max-w-[1400px] div.flex.flex-col.gap-6.items-stretch.justify-start.w-full div.flex.flex-col.gap-6.items-stretch.justify-start.w-full div#account-tabs div.mr-[-16px].ml-[-16px].sm:mr-0.sm:ml-0 div#radix-:rk:-content-defiactivities.ring-offset-background.focus-visible:outline-none.focus-visible:ring-2.bg-neutral0.p-6.rounded-2xl.[&:nth-child(2)]:rounded-tl-none.ring-transparent.ring-offset-0.focus-visible:ring-offset-0.focus-visible:ring-transparent.mt-0 div.flex.flex-col.gap-4.items-stretch.justify-start div.gap-1.flex-row.items-center.justify-between.flex-wrap.w-full.lg:flex.hidden div.flex.gap-1.flex-row.items-center.justify-start.flex-wrap"
-
+ 
  
 
 
@@ -78,9 +81,9 @@ async def get_onedriver_swapactivities( arr_url_dalao , url_type):
 
 async def main():
     print("enter main()")
-    if len(arr_dalao_sol_transfer_url)>0:
+    if len(arr_dalao_url)>0:
         await get_onedriver_swapactivities(
-            arr_url_dalao = arr_dalao_sol_transfer_url , url_type = "transfer_counts")
+            arr_url_dalao = arr_dalao_url , url_type = "transfer_counts")
         await asyncio.sleep(3)
         
     # if len(arr_dalao_token_inflow_transfer_url)>0:
@@ -110,8 +113,8 @@ def init():
         dalao_transfer_counts_file = baseclass.dalao_solscan_info_path / f"dalao_transfer_counts.json"
         # token_inflow_transfer_file = baseclass.dalao_solscan_info_path / f"token_inflow_{str_dalaoaddress}.csv"
    
- 
-        url_transfer = f"https://solscan.io/account/{str_dalaoaddress}#transfers"  
+        url_transfer = f"https://solscan.io/account/{str_dalaoaddress}"  
+        # url_transfer = f"https://solscan.io/account/{str_dalaoaddress}#transfers"  
         url_swap = f"https://solscan.io/account/{str_dalaoaddress}#defiactivities"     
         arr_dalao_url.append(url_transfer)
         obj_url_2_dalao[url_transfer] = str_dalaoaddress

+ 41 - 10
src/code/test_my_find_zhuangjia/new_8002_get_transfer_info_bysolscan_playwright.py

@@ -43,8 +43,8 @@ async def do_some_thing(playwright,   arr_url_dalao , url_type):
         str_dalaoTransferUrl = arr_url_dalao[idx_url]
         str_dalaoaddress =obj_url_2_dalao[str_dalaoTransferUrl]
         
-        print(f"enter str_dalaoaddress= {str_dalaoaddress}")
-        print(f"enter str_dalaoTransferUrl= {str_dalaoTransferUrl}")
+        print(f"enter str_dalaoaddress= {str_dalaoaddress} url_type={url_type}")
+        # print(f"enter str_dalaoTransferUrl= {str_dalaoTransferUrl}")
         print(f"cur_arr_str_dalaoaddress remainder = {len(arr_url_dalao)-idx_url}")
         arr_page[1] = await context.new_page()
         page = arr_page[1]
@@ -89,15 +89,31 @@ async def main():
         await get_onedriver_swapactivities(
             arr_url_dalao = arr_dalao_usdc_transfer_url , url_type = "usdc_transfer")
 
+    if len(arr_dalao_special_token_transfer_url)>0:
+        await get_onedriver_swapactivities(
+            arr_url_dalao = arr_dalao_special_token_transfer_url , url_type = "special_token")
+
+
+
+
 
+find_depth = "depth_01"
 df = pd.read_excel(baseclass.dalao_tran_gmgnOrdex_path /
                  "input_dalao.xlsx", dtype=object)
 
-
-arr_str_dalaoaddress = df['dalaoaddress'].tolist()
+str_tokenaddress_dalao_source = "4GULMPKBJLruChBZWksZzukAg1AjSCmCTMn9ny2Xpump"
+arr_str_dalaoaddress = df[f'dalao_{find_depth}'].drop_duplicates().dropna().tolist()
+obj_ex_address ={
+    
+    "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1":"buy-achipompomhat.sol",
+"CoXccZ3RqJGHQspgei4NdMCW2No1EtTCgevy9CYwaNey":"cryptoxiao.sol",
+"6dEm5Z5NGqNuavGV2fmiRnE55V9jpygsy8RngLxszBGA":"coinbaseventures.sol"
+}
+arr_exclude_address= list(obj_ex_address.keys())
+arr_str_dalaoaddress=[add for add in arr_str_dalaoaddress if add not in  arr_exclude_address]
 arr_dalao_sol_transfer_url =[]
 arr_dalao_token_transfer_url =[]
- 
+arr_dalao_special_token_transfer_url =[]
 arr_dalao_usdc_transfer_url =[]
 obj_url_2_dalao={
     
@@ -110,26 +126,29 @@ def init():
  
         sol_transfer_file = baseclass.dalao_solscan_info_path / f"sol_transfer_{str_dalaoaddress}.csv"
         token_transfer_file = baseclass.dalao_solscan_info_path / f"token_transfer_{str_dalaoaddress}.csv"
+        special_token_transfer_file = baseclass.dalao_solscan_info_path / f"special_token_transfer_{str_dalaoaddress}.csv"
         usdc_transfer_file = baseclass.dalao_solscan_info_path / f"usdc_transfer_{str_dalaoaddress}.csv"
         
+        
  
         url_sol_transfer = f"https://api-v2.solscan.io/v2/account/transfer/export?address={str_dalaoaddress}&activity_type[]=ACTIVITY_SPL_TRANSFER&activity_type[]=ACTIVITY_SPL_MINT&amount[]=0.3&amount[]=undefined&token=So11111111111111111111111111111111111111111&exclude_amount_zero=true&remove_spam=true"    
         # url_token_inflow_transfer = f"https://api-v2.solscan.io/v2/account/transfer/export?address={str_dalaoaddress}&activity_type[]=ACTIVITY_SPL_TRANSFER&activity_type[]=ACTIVITY_SPL_MINT&exclude_token=So11111111111111111111111111111111111111111&exclude_amount_zero=true&remove_spam=true&flow=in"
         # url_token_outflow_transfer = f"https://api-v2.solscan.io/v2/account/transfer/export?address={str_dalaoaddress}&activity_type[]=ACTIVITY_SPL_TRANSFER&activity_type[]=ACTIVITY_SPL_MINT&exclude_token=So11111111111111111111111111111111111111111&exclude_amount_zero=true&remove_spam=true&flow=out"
         url_token_transfer = f"https://api-v2.solscan.io/v2/account/transfer/export?address={str_dalaoaddress}&activity_type[]=ACTIVITY_SPL_TRANSFER&activity_type[]=ACTIVITY_SPL_MINT&exclude_token=So11111111111111111111111111111111111111111&exclude_amount_zero=true&remove_spam=true"
  
-        
+        url_special_token_transfer =f"https://api-v2.solscan.io/v2/account/transfer/export?address={str_dalaoaddress}&token={str_tokenaddress_dalao_source}"
         url_usdc_transfer = f"https://api-v2.solscan.io/v2/account/transfer/export?address={str_dalaoaddress}&activity_type[]=ACTIVITY_SPL_TRANSFER&activity_type[]=ACTIVITY_SPL_MINT&amount[]=100&amount[]=undefined&token=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&exclude_amount_zero=true&remove_spam=true"
         obj_url_2_dalao[url_sol_transfer] =str_dalaoaddress
  
         obj_url_2_dalao[url_token_transfer] =str_dalaoaddress
         obj_url_2_dalao[url_usdc_transfer] =str_dalaoaddress
+        obj_url_2_dalao[url_special_token_transfer] = str_dalaoaddress
         
     
         if sol_transfer_file.exists():
             modified_time  =  sol_transfer_file.stat().st_mtime
             # 3 * 60 分钟内不会在获取
-            if(now_time -modified_time >3*60*60):
+            if(now_time -modified_time >12 * 60 * 60):
                 arr_dalao_sol_transfer_url.append(url_sol_transfer)
             else:
                 pass
@@ -139,7 +158,7 @@ def init():
         if token_transfer_file.exists():
             modified_time  =  token_transfer_file.stat().st_mtime
             # 3 * 60 分钟内不会在获取
-            if(now_time -modified_time >3*60*60):
+            if(now_time -modified_time >12 * 60 * 60):
                 arr_dalao_token_transfer_url.append(url_token_transfer)
             else:
                 pass
@@ -150,18 +169,30 @@ def init():
         if usdc_transfer_file.exists():
             modified_time  =  usdc_transfer_file.stat().st_mtime
             # 3 * 60 分钟内不会在获取
-            if(now_time -modified_time >3*60*60):
+            if(now_time -modified_time >12 * 60 * 60):
                 arr_dalao_usdc_transfer_url.append(url_usdc_transfer)
             else:
                 pass
         else:
             arr_dalao_usdc_transfer_url.append(url_usdc_transfer)
             
+        if special_token_transfer_file.exists():
+            modified_time  =  special_token_transfer_file.stat().st_mtime
+            # 3 * 60 分钟内不会在获取
+            if(now_time -modified_time >12 * 60 * 60):
+                arr_dalao_special_token_transfer_url.append(url_special_token_transfer)
+            else:
+                pass
+        else:
+            arr_dalao_special_token_transfer_url.append(url_special_token_transfer)
+            
+          
+            
             
 
 
 init()
-if len(arr_dalao_sol_transfer_url) ==0 and len(arr_dalao_token_transfer_url) ==0 and  len(arr_dalao_usdc_transfer_url)==0:
+if len(arr_dalao_sol_transfer_url) ==0 and len(arr_dalao_token_transfer_url) ==0 and  len(arr_dalao_usdc_transfer_url)==0 and len(arr_dalao_special_token_transfer_url)==0:
     print("dont has dalao need get")
     exit()
 

+ 0 - 0
src/code/new_8003_handle_sol_transfer_depth.py → src/code/test_my_find_zhuangjia/new_8003_handle_sol_transfer_depth.py


+ 0 - 0
src/code/new_8003_handle_special_token_transfer_depth.py → src/code/test_my_find_zhuangjia/new_8003_handle_special_token_transfer_depth.py


+ 33 - 19
src/code/test_my_find_zhuangjia/new_8004_merge_depth.py

@@ -22,16 +22,32 @@ print = timestamped_print
 print('\n'*5)
 print(f"{'{:<6}'.format('ENTER')} {baseclass.scriptfilename} ----------------NOTE-----------NOTE---------------")
 
-
 df = pd.read_excel(baseclass.dalao_tran_gmgnOrdex_path /
                 "input_dalao.xlsx", dtype=object)
-arr_str_dalaoaddress = df['dalaoaddress'].tolist()
+ 
+find_depth = "depth_01"
+obj_ex_address ={
+    
+    "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1":"buy-achipompomhat.sol",
+"CoXccZ3RqJGHQspgei4NdMCW2No1EtTCgevy9CYwaNey":"cryptoxiao.sol",
+"6dEm5Z5NGqNuavGV2fmiRnE55V9jpygsy8RngLxszBGA":"coinbaseventures.sol"
+}
+arr_exclude_address= list(obj_ex_address.keys())
+
+arr_str_dalaoaddress = df[f'dalao_{find_depth}'].drop_duplicates().dropna().tolist()
+arr_str_dalaoaddress=[add for add in arr_str_dalaoaddress if add not in  arr_exclude_address]
+find_depth = "depth_01"
+ 
+arr_str_dalaoaddress = df[f'dalao_{find_depth}'].drop_duplicates().dropna().tolist()
 
 # arr_str_dalaoaddress=arr_str_dalaoaddress[0:5]
 str_tokenaddress_dalao_source = "4GULMPKBJLruChBZWksZzukAg1AjSCmCTMn9ny2Xpump"
-find_depth = "depth_01"
+ 
 
 
+def get_reladd_count(gdf):
+    gdf["reladd_count"] = len(gdf)
+    return gdf
 
 
 def main():
@@ -41,7 +57,6 @@ def main():
             continue
         print(f"enter {str_dalaoaddress}")
         cur_df_sol_transfer = pd.read_excel(baseclass.ana_dalao_relation_by_solscan_path /str_tokenaddress_dalao_source/find_depth/"final"/ f"final_sol_transfer_{str_dalaoaddress}.xlsx",dtype=object )
-        cur_df_sol_transfer["dalaoaddress"] = str_dalaoaddress
         df_sol_transfer = pd.concat([df_sol_transfer,cur_df_sol_transfer])
     df_sol_transfer = df_sol_transfer.astype({
 
@@ -49,6 +64,7 @@ def main():
         "amount":float,
         "is_exend":int,
         "is_relationend":int,
+        "sol_dalao_count":int,
         
     })
  
@@ -60,31 +76,29 @@ def main():
  
     df_sol_transfer = df_sol_transfer[ ~mask_end].reset_index(drop=True)
 
-    def get_dalao_len(gdf):
-        gdf["dalao_count"] = len(gdf)
-        
-        return  gdf
-
-    df_sol_transfer["dalao_count"] = 0
+    df_sol_transfer["reladd_count"]  = 0
     
 
-    df_sol_transfer =   df_sol_transfer.groupby(by=["dalaoaddress"] ,group_keys=False  ).apply(lambda gdf:  get_dalao_len(gdf))
-    df_sol_transfer = df_sol_transfer.sort_values(by=["dalao_count"],ascending=False)
-    df_dalao_count = df_sol_transfer[[  "dalaoaddress", "dalao_count"  ]].drop_duplicates()
+    df_sol_transfer = df_sol_transfer.groupby(by = [ "rel_address" ],  group_keys=False).apply(lambda gdf : get_reladd_count(gdf))
+
+    df_sol_transfer = df_sol_transfer.sort_values(by=[ "sol_dalao_count"  , "dalaoaddress" ,"timestamp"],ascending=False)
+
+    df_sol_dalao_count = df_sol_transfer[[  "dalaoaddress", "sol_dalao_count"  ]].drop_duplicates()
 
     # str_tokenaddress_dalao_source
 
+    df_sol_dalao_count=df_sol_dalao_count.sort_values(by=["sol_dalao_count"],ascending=False)
+    
+    df_sol_dalao_count["scan_activites"] = df_sol_dalao_count.apply(lambda ser : baseclass.makeurl(f"https://solscan.io/account/{ser['dalaoaddress']}#defiactivities" , f"{ser['dalaoaddress'][0:6]}") , axis=1)
  
-    df_dalao_count["scan_activites"] = df_dalao_count.apply(lambda ser : baseclass.makeurl(f"https://solscan.io/account/{ser['dalaoaddress']}#defiactivities" , f"{ser['dalaoaddress'][0:6]}") , axis=1)
- 
-    df_dalao_count["scan_token_source"] = df_dalao_count.apply(lambda ser : baseclass.makeurl(f"https://solscan.io/account/{ser['dalaoaddress']}?token_address={str_tokenaddress_dalao_source}#transfers" , f"{ser['dalaoaddress'][0:6]}") , axis=1)
+    df_sol_dalao_count["scan_token_source"] = df_sol_dalao_count.apply(lambda ser : baseclass.makeurl(f"https://solscan.io/account/{ser['dalaoaddress']}?token_address={str_tokenaddress_dalao_source}#transfers" , f"{ser['dalaoaddress'][0:6]}") , axis=1)
  
 
-#  https://gmgn.ai/sol/token/4GULMPKBJLruChBZWksZzukAg1AjSCmCTMn9ny2Xpump?tab=activity&maker=58YHxodnzZKxVBE5EsATs38ywEFV7M8ijjBoBkYAJY8J
+    #  https://gmgn.ai/sol/token/4GULMPKBJLruChBZWksZzukAg1AjSCmCTMn9ny2Xpump?tab=activity&maker=58YHxodnzZKxVBE5EsATs38ywEFV7M8ijjBoBkYAJY8J
+
 
-    df_dalao_count=df_dalao_count.sort_values(by=["dalao_count"],ascending=False)
     
-    df_dalao_count.to_excel(baseclass.ana_dalao_relation_by_solscan_path /str_tokenaddress_dalao_source/find_depth/  f"counts_sol_transfer_{find_depth}.xlsx" ,index=False)
+    df_sol_dalao_count.to_excel(baseclass.ana_dalao_relation_by_solscan_path /str_tokenaddress_dalao_source/find_depth/  f"counts_sol_transfer_{find_depth}.xlsx" ,index=False)
     df_sol_transfer.to_excel(baseclass.ana_dalao_relation_by_solscan_path /str_tokenaddress_dalao_source/find_depth/  f"sec_sol_transfer_{find_depth}.xlsx" ,index=False)
      
 

+ 12 - 0
src/library/学习记录_杂.md

@@ -34,6 +34,18 @@ BAT pool = 454.67
 
 **综上 随着在交易合约上的每笔交易被执行,不变量逐渐增大 **
 
+对于一个短期拉升 大约1000笔交易 K值变化不大 可以忽略不计
+
+eth * token = K
+price = eth / token
+
+price  = eth * eth / k
+market cap = price * supply
+
+price 与eth的平方成正比关系 
+市值 与 price 成正比关系
+所以 流动池 eth*2 ,price*4 ,eth*3 , price*9
+
 
 PUMP.FUN 的定价系统中设置了一个名为 virtualSolReserves 的前置虚拟池。该虚拟池初始包含 30 枚 SOL 和 1,073,000,191 枚代币,其定价公式遵循 x * y = k 的恒定乘积规则。
 经过数据拟合计算,初始的 k 值 为 32,190,005,730,每枚代币的初始价格约为 0.000000028 SOL。

BIN
src/librarydata/dune_excution/分析-至1118-05点-4GULMPKBJLruChBZWksZzukAg1AjSCmCTMn9ny2Xpump.xlsx


BIN
src/librarydata/dune_excution/拉升分析-4GULMPKBJLruChBZWksZzukAg1AjSCmCTMn9ny2Xpump.xlsx


+ 31 - 0
src/librarydata/for_dune_handle_trade_source.py

@@ -0,0 +1,31 @@
+import sys
+import  pandas as pd
+
+obj_program ={
+
+    "routeUGWgWzqBWFcrCfv8tritsqukccJPu3q5GPP3xS":"ray_amm",
+    "6m2CDdhRgxpH4WjvdzxAYbGxwdGUz5MziiL5jek2kBma":"OKX_v2",
+    "JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4":"Jupiter_v6",
+   "BANANAjs7FJiPQqJTGFzkZJndT9o7UmKiYYGaJz6frGu": "Banana_Gun",
+
+
+}
+def main():
+    # Check if a file name is provided as an argument
+    if len(sys.argv)!= 2:
+        print("Usage: python script.py <filename>")
+        sys.exit(1)
+
+    # Get the file name from the command line argument
+    filename = sys.argv[1]
+    df = pd.read_csv(filename , dtype=object)
+    df["trade_source"] = df["trade_source"].map(obj_program).fillna(df["trade_source"])
+    df.to_csv(f"new_{filename}" , index=False )
+
+
+    # Process the file here
+    print(f"Processing file: {filename}")
+    # Add your file processing logic here
+
+if __name__ == "__main__":
+    main()