Created
February 25, 2025 13:03
-
-
Save Hosuke/880456abce959f2e49341a623f7a7629 to your computer and use it in GitHub Desktop.
Find id from https://api.coinpaprika.com/v1/coins/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import requests | |
import pandas as pd | |
def get_coinpaprika_data(): | |
# Get data from coinpaprika | |
url = "https://api.coinpaprika.com/v1/coins/" | |
response = requests.get(url) | |
return response.json() | |
def process_data(your_data_file, coinpaprika_data): | |
# Create mapping from symbol to id for coinpaprika data | |
symbol_to_id = {coin['symbol']: coin['id'] for coin in coinpaprika_data if coin['is_active']} | |
# Read your data file | |
df = pd.read_csv(your_data_file) # Adjust reading method based on your file format | |
# Filter records where USD is empty | |
empty_usd = df[df['transfer_amount_usd'].isna()] | |
# Store results | |
matches = [] | |
# Check if each empty USD record's symbol exists in coinpaprika | |
for _, row in empty_usd.iterrows(): | |
symbol = row['symbol'] | |
if symbol in symbol_to_id: | |
matches.append({ | |
'blockchain': row['blockchain'], | |
'symbol': symbol, | |
'token_id': symbol_to_id[symbol] | |
}) | |
return matches | |
def main(): | |
# Get coinpaprika data | |
coinpaprika_data = get_coinpaprika_data() | |
# Process data | |
results = process_data('01JMYJNFYPNA1VD1JTGM0FBZVK.csv', coinpaprika_data) | |
# Output results | |
print("Found following matches:") | |
for match in results: | |
print(f"Blockchain: {match['blockchain']}, Symbol: {match['symbol']}, Token ID: {match['token_id']}") | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment