Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Token Quotes is a Python package for fetching and processing cryptocurrency token balances and quotes for a list of wallet addresses that you provide. It interacts with the Covalent API to retrieve token data, process it, and save it in a structured format.
pip install token-quotes
poetry add token-quotes
Pull from DockerHub
docker pull zaxier/token-quotes:latest
Or clone and build locally
docker build -t token-quotes .
Set your Covalent API key as an environment variable:
export COVALENT_API_KEY=your_api_key_here
Example input YAML
wallets:
- name: "MetaMask"
metadata:
details: "A MetaMask wallet with multiple addresses secured by a single seed phrase. MetaMask wallet can secure addresses multiple blockchains."
provider: "MetaMask - https://metamask.io/"
access: "Get metamask browser extension. Input the seed phrase to access the wallet."
addresses:
- address: "0x123"
chain_ids: ["eth-mainnet", "arbitrum-mainnet"]
owner: "me"
purpose: "personal"
- address: "0x456"
chain_ids: ["eth-mainnet", "matic-mainnet"]
owner: "someone else"
purpose: "personal"
- name: "wallet 2"
metadata: ...
addresses: ...
token-quotes input.yml -o output.csv --currency usd --api-key $COVALENT_API_KEY
import os
from report_builder import fetch_token_balances, save_to_jsonlines, extract_data, save_to_csv
COVALENT_API_KEY = os.getenv("COVALENT_API_KEY")
wallets = [
{
"name": "Main Wallet",
"metadata": {"key": "value"},
"addresses": [
{
"address": "0x1234",
"owner": "me",
"purpose": "personal",
"chain_ids": ["eth-mainnet", "arbitrum-mainnet"],
}
],
},
]
raw_token_balances = fetch_token_balances(wallets, COVALENT_API_KEY, "usd")
save_to_jsonlines(raw_token_balances, "/tmp/raw_token_balances.jsonl")
data = extract_data("/tmp/raw_token_balances.jsonl")
save_to_csv(data, "output_file.csv")
docker run -v /path/to/your/local/directory:/app/data token-quotes:latest input.yml -o output.csv --currency usd --api-key $COVALENT_API_KEY
This command mounts your local directory to the /app/data directory in the container. Adjust the paths as necessary.
Example
# Set vars
# LOGS_DIR=''
# ...
docker run \
-v $LOGS_DIR:$LOGS_DIR -v $INPUT_FILE_DIR:$INPUT_FILE_DIR -v $OUTPUT_FILE_DIR:$OUTPUT_FILE_DIR \
zaxier/token-quotes:latest $INPUT_FILEPATH \
-o $OUTPUT_FILEPATH \
--api-key $COVALENT_API_KEY \
--log-dir $LOGS_DIR \
--debug
To run the help message
docker run token-quotes:latest --help
To set up the development environment:
Clone the repository:
git clone https://github.com/zaxier/token-quotes.git
cd token-quotes
Install dependencies:
poetry install
Run tests:
poetry run pytest
(Optional) Logs are saved in the /app/logs directory. When running the Docker container, mount this directory to persist logs:
docker run -v /path/to/your/logs:/app/logs ...
FAQs
Calls Covalent API to get token quotes for a list of crypto wallet addresses
We found that token-quotes demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.