For the complete documentation index, see llms.txt. This page is also available as Markdown.

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}")

Last updated