๐ข Artemis Sheets
- Overview
- Usage
- Common Problems with Google Sheets
- Changelog
- Troubleshooting
๐ฅ๏ธ API
โ๏ธ Snowflake Share
๐ผ๏ธ Artemis Terminal
๐ Contact Us
๐ Research
๐ฅ๏ธ API
API Examples
Example of Python Jupyter Notebook using the artemis API to create a basic DCF model
Download / PIP install packages
pip install artemis==0.1.0
pip install matplotlib
Creating Python Artemis Client
import os
import requests
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.ticker as mtick
from datetime import datetime
from artemis import Artemis
#from google.colab import userdata
# Set up Artemis API Client
client = Artemis(api_key=API_KEY)
Getting all Assets Available on Artemis
# Get all assets available on Artemis
# Limiting to first 50 for display purposes
assets = client.asset.list()
print(f"There are {len(assets['assets'])} assets available on Artemis\n")
sorted([asset['symbol'] for asset in assets['assets']][:50])
Getting all support metrics per asset on Artemis
# Get the supported metrics for select assets
# Get data for the first five supported metrics
filtered_assets = list(filter(lambda x: x['symbol'] in ['aave', 'mkr'], assets['assets']))
for i, asset in enumerate(filtered_assets):
artemis_id, symbol = asset['artemis_id'], asset['symbol']
supported_metrics_for_asset = client.asset.list_metrics(artemis_id).metrics
first_five_metrics = ','.join(supported_metrics_for_asset[:5])
metrics_for_asset = client.fetch_metrics(
metric_names=first_five_metrics,
symbols=symbol,
).data
output = metrics_for_asset.symbols[symbol]
print(f"Getting data and supported metrics for symbol: {symbol}")
print(f" - Supported metrics: {supported_metrics_for_asset}")
print(f" - Data for the first five metrics {output}\n")
Getting all support metrics per asset on Artemis
# Calculate Net Income as Protocol Revenue - Total Expenses. Can use Net Income as part of DCF.
# Available ones to test: aave, maker, lido
symbol = 'eth'
start_date = '2024-01-01'
end_date = '2025-04-30'
metrics="protocol_revenue,total_expenses"
metrics_for_asset = client.fetch_metrics(
metric_names=metrics,
symbols=symbol,
start_date=start_date,
end_date=end_date,
)
data = metrics_for_asset.data.symbols[symbol]
df_revenue = pd.DataFrame(data["ecosystem_revenue"])
df_expenses = pd.DataFrame(data["total_expenses"])
df_revenue["date"] = pd.to_datetime(df_revenue["date"])
df_expenses["date"] = pd.to_datetime(df_expenses["date"])
# Monthly Aggregation (sum only 'val' column)
df_revenue_monthly = (
df_revenue.groupby(df_revenue["date"].dt.to_period("M"))["val"]
.sum()
.reset_index()
)
df_expenses_monthly = (
df_expenses.groupby(df_expenses["date"].dt.to_period("M"))["val"]
.sum()
.reset_index()
)
# Convert period to timestamp for plotting
df_revenue_monthly["date"] = df_revenue_monthly["date"].dt.to_timestamp()
df_expenses_monthly["date"] = df_expenses_monthly["date"].dt.to_timestamp()
# Calculate net income
df_net_income = df_revenue_monthly.copy()
df_net_income["val"] = df_revenue_monthly["val"] - df_expenses_monthly["val"]
# Pretty print values in $M
to_pretty_millions = lambda x: f"${x / 1e6:.1f}M"
df_revenue_monthly["val_pretty"] = df_revenue_monthly["val"].apply(to_pretty_millions)
df_expenses_monthly["val_pretty"] = df_expenses_monthly["val"].apply(to_pretty_millions)
df_net_income["val_pretty"] = df_net_income["val"].apply(to_pretty_millions)
# Print all 3 tables
print("\n๐ Revenue:")
print(df_revenue_monthly[["date", "val_pretty"]])
print("\n๐ธ Expenses:")
print(df_expenses_monthly[["date", "val_pretty"]])
print("\n๐งพ Net Income:")
print(df_net_income[["date", "val_pretty"]])
Assistant
Responses are generated using AI and may contain mistakes.