Skip to main content

Python SDK for the VisibleHand political-economic country risk API

Project description

visiblehand

Python SDK for the VisibleHand political-economic country risk API.

VisibleHand scores country-level risk on a 0–100 scale (0 = stable, 100 = high risk), updated daily from live sources. Free and open-source alternative to commercial equivalents costing $15,000–$50,000/year.

Install

pip install visiblehand

Usage

from visiblehand import Client

client = Client()

# Single country
score = client.risk("BR")
print(score.composite)       # 61.4
print(score.ci_low, score.ci_high)   # 55.1, 67.8
print(score.top_drivers)     # ['high_inflation_vs_history', 'rapid_escalation']
print(score.methodology)     # plain-language explanation

# Compare multiple countries
scores = client.compare("US", "DE", "BR", "IN", "ZA")
for s in sorted(scores, key=lambda x: x.composite, reverse=True):
    print(f"{s.country}: {s.composite:.1f} ({s.risk_level})")

# Historical trend
history = client.history("AR", limit=90)
for day in history[-5:]:
    print(day.date, day.composite)

# Governance sub-score
gov = client.governance("NG")
print(gov.score, gov.components)

Custom weights

# Emphasise political risk
score = client.risk("UA", political_weight=0.6, economic_weight=0.3, nlp_weight=0.1)

Async client

import asyncio
from visiblehand import AsyncClient

async def main():
    async with AsyncClient() as client:
        score = await client.risk("IN")
        print(score.composite, score.confidence)

asyncio.run(main())

Self-hosted

client = Client(base_url="http://localhost:8000")

Score breakdown

Every score includes:

  • composite — overall 0–100 risk score
  • ci_low / ci_high — 95% confidence interval (Monte Carlo)
  • breakdown — economic, political, nlp_sentiment, governance sub-scores
  • top_drivers — ranked list of what's driving the score
  • confidence — data coverage and freshness (0–1)
  • risk_level — Very Low / Low / Moderate / High / Very High / Critical
  • methodology — plain-language explanation

Note

⚠️ Research preview. Scores are not validated for investment or financial decisions. See METHODOLOGY.md for full methodology and limitations.

Links

License

MIT

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

visiblehand-0.3.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

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

visiblehand-0.3.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file visiblehand-0.3.0.tar.gz.

File metadata

  • Download URL: visiblehand-0.3.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for visiblehand-0.3.0.tar.gz
Algorithm Hash digest
SHA256 555b1e74142f37744b94a87e7e7cc888b4824f91f96962a567b86cabf56f1afd
MD5 728c0a56c3291cbc7e7a569da96efcca
BLAKE2b-256 8873740c2364746a93f13295c86a79d7326cb85bd06904a0a7f06b51f77c1320

See more details on using hashes here.

File details

Details for the file visiblehand-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: visiblehand-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for visiblehand-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 abb08810e7072e5f72851e48093924880055cb95e6d2ae32cb020ae2b786b5c8
MD5 139d8630632ada6521e527a370b66f2d
BLAKE2b-256 2e62e43951439d7b7855bcd2d2f823f35bc8707c30a76eeffdaec1ee105b929b

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