Skip to content

Commit

Permalink
#36 Defines filter for result,
Browse files Browse the repository at this point in the history
closes #36
  • Loading branch information
rdovgan committed May 18, 2024
1 parent d72c3d5 commit a235823
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions service/sybil_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from dotenv import load_dotenv
import time
import sqlite3
import pandas as pd

# Load environment variables
load_dotenv()
Expand Down Expand Up @@ -96,6 +97,20 @@ def find_common_items(file1, file2):
return f"An error occurred: {str(e)}"


def filter_sybil(db_result='data/result.db', table='result'):
conn = sqlite3.connect(db_result)\

query = f'''
SELECT ua, tc, amt, amt_avg, cc, dwm, lzd
FROM ${table}
WHERE tc > 1000 AND amt_avg < 0.01
'''

filtered_data = pd.read_sql_query(query, conn)
filtered_data.to_csv('data/filtered_addresses.csv', index=False)
conn.close()


def filter_addresses(db_path='data/dune_data.db', file1='data/sybil.txt', file2='data/not_sybil.txt', output_file='data/result.txt',
output_db='data/result.db', output_table='result'):
# Ensure the data directory exists
Expand Down Expand Up @@ -183,3 +198,5 @@ def remove_duplicates(file_path):
# print(filter_addresses())

# print(find_common_items('data/sybil.txt', 'data/not_sybil.txt'))

filter_sybil()

0 comments on commit a235823

Please sign in to comment.