The ArtemisAPI
class provides a convenient interface for interacting with the Artemis API to fetch asset data, metrics, and developer activity information. It allows users to retrieve data in the form of pandas DataFrames and visualize it using Plotly.
Visit artemis.xyz to explore their data and get an 'API Key'
- Fetch a list of supported assets.
- Fetch available metrics for a specific asset.
- Retrieve specific metric data for assets.
- List supported ecosystems.
- Fetch weekly commit data for ecosystems.
- Fetch weekly active developer data for ecosystems.
- Plot data using Plotly.
- Python 3.6 or higher
- Required Python packages:
- pandas
- requests
- plotly
You can install the required packages using pip
:
pip install pandas requests plotly
To use the ArtemisAPI
class, you need to instantiate it with your API key:
from artemis_api import ArtemisAPI
api_key = "your_api_key_here"
api = ArtemisAPI(api_key)
To fetch a list of supported assets:
assets = api.get_assets()
print(assets)
To fetch available metrics for a specific asset:
asset_id = "bitcoin"
metrics = api.get_asset_metrics(asset_id)
print(metrics)
To fetch data for a specific metric of an asset:
asset_id = "bitcoin"
start_date = "2023-01-01"
metric = "price"
data = api.get_data(asset_id, start_date, metric)
print(data)
To fetch data for a set metrics for one or more assets:
api = ArtemisAPI(api_key="api_key_here")
asset_ids = ["bitcoin", "ethereum"]
metrics = ["price", "mc"]
start_date = "2023-06-01"
end_date = "2023-06-10"
data = api.get_data(asset_ids, metrics, start_date, end_date)
To list supported ecosystems:
ecosystems = api.list_ecosystems()
print(ecosystems)
To fetch weekly commits data for ecosystems:
commits = api.query_weekly_commits_for_ecosystem()
print(commits)
To fetch weekly commits data for a specific ecosystem:
ecosystem = "Uniswap"
commits = api.query_weekly_commits_for_ecosystem(ecosystem=ecosystem)
print(commits)
To fetch weekly active developer data for ecosystems:
active_devs = api.query_active_devs_for_ecosystem()
print(active_devs)
To fetch weekly active developer data for a specific ecosystem:
ecosystem = "Uniswap"
active_devs = api.query_active_devs_for_ecosystem(ecosystem=ecosystem)
print(active_devs)
To plot data using Plotly:
data = api.get_data("bitcoin", "2023-01-01", "price")
fig = api.plot_data(data, "Bitcoin Price Data")
fig.show()
To plot weekly data with performance annotations:
weekly_data = api.query_weekly_commits_for_ecosystem(ecosystem="Uniswap")
fig = api.plot_weekly_data(weekly_data, "Uniswap Weekly Commits")
fig.show()
The class includes basic error handling for HTTP errors and other exceptions. Errors are logged using the logging
module.
Logging is configured to the INFO level by default. You can change the logging level as needed:
import logging
logging.basicConfig(level=logging.DEBUG)
Contributions are welcome! Please fork the repository and submit a pull request with your changes.
This project is licensed under the MIT License.