Archived, because Cryptowat.ch is dead 😞
This repository contains two packages, pycwatch-lib
and pycwatch-cli
.
The pycwatch-lib
library provides access to the Cryptowatch API and implements all resources of the REST API. Use it in Python applications or scripts that you're writing to retrieve cryptocurrency market data.
Either install from pypi or clone this repository and install locally.
pip install pycwatch-lib
See the cryptowat.ch docs for available endpoints.
from pycwatch.lib import CryptoWatchClient
# create api client
client = CryptoWatchClient()
# get list of available assets
assets = client.list_assets()
# get some price info
exchange, pair = "binance", "btceur"
price = client.get_market_price(exchange, pair)
If you have an account at cryptowat.ch, you can either set your key as an environment variable or in the code.
export CRYPTO_WATCH_KEY="my-awesome-key"
or
from pycwatch.lib import CryptoWatchClient
api_key = "my-awesome-key"
client = CryptoWatchClient(api_key)
Note that anonymous users are limited to 10 Cryptowatch Credits worth of API calls per 24-hour period. See https://docs.cryptowat.ch/rest-api/rate-limit#api-request-pricing-structure for more information.
The pycwatch-cli
is a command line application that makes the power of CryptoWatch
available to you on the command line.
The easiest way to install is with pipx
.
pipx install pycwatch-cli
This will make the command pycw
available.
Run pycw --help
to get usage info.
❯ pycw --help
Usage: pycw [OPTIONS] COMMAND [ARGS]...
PyCwatch CLI.
╭─ Commands ───────────────────────────────────────────────────────────────╮
│ assets Get or list assets. │
│ exchanges Get or list exchanges. │
│ info Get API info. │
│ markets Get or list markets. │
│ pairs Get or list pairs. │
╰──────────────────────────────────────────────────────────────────────────╯
All the endpoints implemented by pycwatch-lib
are available via the pycw
command.
For example:
# list available assets
pycw assets list
# get some price info
pycw markets price binance btceur