Skip to main content

tribulnation-catalogue

PyPI Python License: MIT

Python client for the Tribulnation Catalogue — a typed, open catalogue of crypto assets, trading platforms, and instrument mappings.

Install

pip install tribulnation-catalogue

Usage

from tribulnation.catalogue import Catalogue

catalogue = Catalogue.load()

btc     = catalogue.assets["bitcoin"]
binance = catalogue.platforms["binance"]

load() keeps the published data.zip in ~/.cache/tribulnation and loads it from there. Once a day (max_age) it asks the site whether the archive changed with one conditional request (ETag / Last-Modified), and downloads it again only when it did. A download replaces the cached copy only once it loads; if the site is unreachable, the last good copy is used and a warning is logged. Only a first run without any cached copy fails.

Command line

pip install 'tribulnation-catalogue[cli]'

tn catalogue download data   # extract the catalogue into ./data, or update it
tn catalogue download        # only refresh the cache used by Catalogue.load()

download works like load(): it asks the site whether data.zip changed and only re-extracts the folder when it did. --refresh downloads unconditionally, --url uses a mirror. A folder is only replaced if it is empty or holds an earlier download.

Loading options

# Cached archive, checked at most once a day (default)
catalogue = Catalogue.load()

# Check more or less often
catalogue = Catalogue.load(max_age=timedelta(hours=6))

# Force a fresh download
catalogue = Catalogue.load(refresh=True)

# Load from an explicit local folder (never touches the network once it exists)
catalogue = Catalogue.load("data")

# Custom source URL or cache directory
catalogue = Catalogue.load(
    url="https://my-mirror.example.com/data.zip",
    cache_dir=".cache/catalogue",
)

# Suppress the download message
catalogue = Catalogue.load(silent=True)

Long-running processes

catalogue = Catalogue.load()
catalogue.digest     # sha256 of the loaded data.zip (None for a folder)
catalogue.loaded_at  # when it was loaded

# Call as often as you like (e.g. daily): returns the same object until max_age
# elapsed and the published archive actually changed, then a freshly loaded one.
catalogue = catalogue.maybe_refresh()

# Check now, regardless of max_age
catalogue = catalogue.refresh()

Network errors never raise from maybe_refresh() / refresh(); the last good copy stays.

Lookups

catalogue.asset_for('hyperliquid', 150)        # 'hyperliquid'  (spot token index)
catalogue.asset_for('arbitrum', '0xaf88d065e77c8cc2239327c5edb3a432268e5831')  # 'usd-coin' (any casing)
catalogue.asset_for('ethereum', 'native')      # 'ethereum'
catalogue.asset_for('bitget', 'rSPY')          # symbols are case-sensitive
catalogue.asset_for('mexc', 'UNKNOWN')         # None

catalogue.perpetual_for('hyperliquid', 'kPEPE')
# PerpetualInstrument(platform='hyperliquid', id='kPEPE', base='pepe', quote='tether',
#                     settlement='usd-coin', multiplier=Decimal('1000'), delisted=False, quanto=None)

catalogue.perpetual_for('binance', 'HK0700USDT')
# PerpetualInstrument(platform='binance', id='HK0700USDT', base='tencent-holdings', quote='hong-kong-dollar',
#                     settlement='tether', multiplier=Decimal('1'), delisted=False, quanto=True)
# quanto: priced in HK$, pays 1 USDT per HK$ point, so notional is size x multiplier x price in USDT
# (False: converted at the exchange rate; None: not stated, e.g. when quote and settlement are one currency)

catalogue.debt_for('ethereum', '0x72e95b8931767c79ba4eee721354d6e99a61d004')
# DebtInstrument(platform='ethereum', id='0x72E95b89…', asset='usd-coin', name='Aave USDC Debt')

catalogue.network_for('bybit', 'BSC (BEP20)')  # 'bnb-chain'
catalogue.canonical_id('old-id')               # follows `replaced_by` aliases

Every lookup follows replaced_by: asset ids are never deleted, and a merged asset keeps its file as an alias of the surviving one.

What's available

catalogue.assets           # dict[str, Asset]
catalogue.platforms        # dict[str, Platform]
catalogue.blockchains      # filtered view: kind == 'blockchain'
catalogue.cexs             # filtered view: kind == 'cex'
catalogue.dexs             # filtered view: kind == 'dex'

catalogue.spot_instruments        # dict[platform, dict[id, Spot]]
catalogue.margin_instruments      # dict[platform, dict[id, Margin]] (spot pairs on borrowed funds)
catalogue.perpetual_instruments   # dict[platform, dict[id, Perpetual]]
catalogue.debt_instruments        # dict[platform, dict[id, Debt]]
catalogue.pools                   # dict[platform, dict[id, Pool]]

catalogue.asset_translations      # dict[platform, dict[exchange_id, asset_id]]
catalogue.network_translations    # dict[platform, dict[exchange_id, network_id]]

catalogue.spam                    # dict[platform, dict[address, SpamAddress]]

Types

All types are available from the package root:

from tribulnation.catalogue import (
    Asset, AssetPeg, ExternalIds,
    Platform, Blockchain, CexPlatform, DexPlatform,
    Spot, Perpetual, PerpetualInstrument, DebtInstrument, Debt, Pool,
    SpamAddress,
)

Metadata

Release files for tribulnation-catalogue 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tribulnation-catalogue 0.6.0
File Size Uploaded Provenance Actions
tribulnation_catalogue-0.6.0.tar.gz 64.7 kB With provenance Details for tribulnation_catalogue-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tribulnation-catalogue 0.6.0
File Interpreter ABI Platform Actions
tribulnation_catalogue-0.6.0-py3-none-any.whl Python 3 none any Details for tribulnation_catalogue-0.6.0-py3-none-any.whl

Total release size: 118.9 kB

Release files / tribulnation_catalogue-0.6.0.tar.gz

Download URL tribulnation_catalogue-0.6.0.tar.gz
Size 64.7 kB
Tags Source
SHA-256 checksum
How to use checksums
29df4310615983bb803d0b32d73763c5e4c411eb844a8d84b11ff9d6809436e4
BLAKE2b-256 checksum
How to use checksums
8ff214865cb066a4a4952c64a179f67ef923443a6484e0202aa76c8f23dbea5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.

Transparency log

Release files / tribulnation_catalogue-0.6.0-py3-none-any.whl

Download URL tribulnation_catalogue-0.6.0-py3-none-any.whl
Size 54.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f3d4ce4cbc3a612a146cc96db2206ef9086f8b6647e0f39f568ea547f61aacef
BLAKE2b-256 checksum
How to use checksums
df1031b8ddcda69ac59753f3f187149ca5afbf4cc3516aaa10ba1d7017127c24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.

Transparency log

Security for tribulnation-catalogue 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for tribulnation_catalogue-0.6.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page