Skip to main content

A package to interact with the Artemis API. Visit artemis.xyz for more.

Project description

Artemis Analytics Python API

Overview

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'

Features

  • 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.

Installation

Prerequisites

  • Python 3.6 or higher
  • Required Python packages:
    • pandas
    • requests
    • plotly

Install Required Packages

You can install the required packages using pip:

pip install pandas requests plotly

Usage

Initialization

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)

Fetching Assets

To fetch a list of supported assets:

assets = api.get_assets()
print(assets)

Fetching Asset Metrics

To fetch available metrics for a specific asset:

asset_id = "bitcoin"
metrics = api.get_asset_metrics(asset_id)
print(metrics)

Fetching Metric Data for Assets

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)

Fetching Data for Multiple Metrics and/or Assets

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)

Listing Supported Ecosystems

To list supported ecosystems:

ecosystems = api.list_ecosystems()
print(ecosystems)

Fetching Weekly Commits for 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)

Fetching Weekly Active Developers for Ecosystems

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)

Plotting Data

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()

Error Handling

The class includes basic error handling for HTTP errors and other exceptions. Errors are logged using the logging module.

Logging

Logging is configured to the INFO level by default. You can change the logging level as needed:

import logging
logging.basicConfig(level=logging.DEBUG)

Contributing

Contributions are welcome! Please fork the repository and submit a pull request with your changes.

License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

artemis_py-0.2.4.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

artemis_py-0.2.4-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file artemis_py-0.2.4.tar.gz.

File metadata

  • Download URL: artemis_py-0.2.4.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for artemis_py-0.2.4.tar.gz
Algorithm Hash digest
SHA256 042501e549295beb152860c827a5bcbcefbbe4717cc25d49e29b96680d6da4b0
MD5 984153968c5c5bf97b2430bcb4b65e5a
BLAKE2b-256 9246769156cbe7c54586eea59a57e4e07f82aec9662e68e3767882263a28e837

See more details on using hashes here.

File details

Details for the file artemis_py-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: artemis_py-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for artemis_py-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a76e7ab637c1f223e1936521c7a48372cc0d573c79f3ab44f0c982541fe87bd6
MD5 9c8b4e801f64eacbaf5f97177cb40c19
BLAKE2b-256 1f917d4034380b24226cb8220e694e87d99b4478e8bba5bc02f50dd5eb605113

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page