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 scoreci_low/ci_high— 95% confidence interval (Monte Carlo)breakdown— economic, political, nlp_sentiment, governance sub-scorestop_drivers— ranked list of what's driving the scoreconfidence— data coverage and freshness (0–1)risk_level— Very Low / Low / Moderate / High / Very High / Criticalmethodology— 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
555b1e74142f37744b94a87e7e7cc888b4824f91f96962a567b86cabf56f1afd
|
|
| MD5 |
728c0a56c3291cbc7e7a569da96efcca
|
|
| BLAKE2b-256 |
8873740c2364746a93f13295c86a79d7326cb85bd06904a0a7f06b51f77c1320
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
abb08810e7072e5f72851e48093924880055cb95e6d2ae32cb020ae2b786b5c8
|
|
| MD5 |
139d8630632ada6521e527a370b66f2d
|
|
| BLAKE2b-256 |
2e62e43951439d7b7855bcd2d2f823f35bc8707c30a76eeffdaec1ee105b929b
|