Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.
/ pycwatch Public archive

A Python client for the Cryptowat.ch Rest API

License

Notifications You must be signed in to change notification settings

ljnsn/pycwatch

Repository files navigation

pycwatch

Coverage PyPI CLI - Version PyPI LIB - Version Python versions Black style

Archived, because Cryptowat.ch is dead 😞

This repository contains two packages, pycwatch-lib and pycwatch-cli.

pycwatch-lib

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.

Library Installation

Either install from pypi or clone this repository and install locally.

pip install pycwatch-lib

Library Quick Start

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.

pycwatch-cli

The pycwatch-cli is a command line application that makes the power of CryptoWatch available to you on the command line.

CLI Installation

The easiest way to install is with pipx.

pipx install pycwatch-cli

This will make the command pycw available.

CLI Quick Start

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