Python Example
Python code example to retrieve the total tokens by each investor group
import requests
import pandas as pd
url = 'https://api.tokeline.com/tokenomics/pro/apt'
headers = {
'auth-token-x': 'API Token',
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
data = response.json()
df = pd.json_normalize(data['data'])
df = df.dropna(how='all', axis=1) #drops all empty columns
df.columns = df.columns.str.replace('_', ' ')
df.columns = df.columns.str.title()
df.set_index('Token Emissions', inplace=True) #Token Emissions contains the dates
num = df.select_dtypes(include=['number'])
df[num.columns] = num.where(num >= 0, 0) #Cliff Periods are saved as "-1" and have to be adjusted
pd.options.display.float_format = "{:,.2f}".format
print("\nTotal Tokens per Investor:")
print(df.sum())
else:
print(f"Request failed with status code {response.status_code}")
Output:
Total Tokens per Investor:
Community 510,217,359.20
Core Contributors 189,999,999.90
Foundation 164,999,999.60
Investors 134,782,640.16
Staking Rewards 694,021,738.32
Last updated