Skip to main content

Python client for the Amaneki volatility-regime API

Project description

amaneki

Python client for the Amaneki volatility-regime API.

pip install amaneki

Usage

from amaneki import Client

c = Client(api_key="ak_...")
snap = c.get_regime("btcusdt")
print(snap.regime, snap.z_vol)  # e.g. "normal" -0.83

for t in c.get_history("btcusdt", from_ms=1776000000000):
    print(t.ts_ms, t.from_regime, "→", t.to_regime)

Cross-exchange consensus

cs = c.get_consensus("btcusdt", timeframe="15m")
print(cs.consensus, f"{cs.agreed}/{cs.available}")
for name, v in cs.venues.items():
    print(name, v.regime, v.z_vol)

Backtest

r = c.run_backtest("btcusdt", timeframe="15m", rule="long_low_exit_normal")
print(r.n_trades, r.total_return, r.max_drawdown)

Rules: long_low_exit_normal, short_high_exit_normal, avoid_high. Optional thresholds={"high_enter": 3.0, ...} overrides the running preset.

Impact, lead-lag, conditional returns

# Return distribution at 1h / 4h / 24h after past HIGH transitions.
imp = c.impact("btcusdt", to="high", timeframe="1m", lookback_days=180)
print(imp["sample_size"], imp["horizons"]["1h"]["p75"])
if imp.get("warning"):
    print("small-N:", imp["warning"])

ll = c.lead_lag("btcusdt", "ethusdt", to="high", lookback_days=90)
print(ll["hit_rate"], ll.get("lag"))

cr = c.conditional_returns("btcusdt", timeframe="15m")
print(cr["by_regime"]["high"]["median"], cr["baseline"]["median"])

Top-down alignment and narrative

td = c.top_down("btcusdt", match="any", from_tf="1d", to_tf="15m")
print(td["consensus"], td["alignment_score"], td["aligned_tfs"])

st = c.stories("btcusdt", timeframe="15m", days=7)
for line in st["stories"]:
    print(line)

Public stats (no key required)

s = c.public_stats()
print(s["uptime_observed_pct"], s["uptime_window_days"])

i = c.public_incidents()
print(i["count"], "incidents in the last 30 days")

Async + streaming

import asyncio
from amaneki import AsyncClient

async def main():
    async with AsyncClient(api_key="ak_...") as c:
        async for ev in c.stream():
            print(ev.type, ev.symbol, ev.to_regime)

asyncio.run(main())

No key

get_regime and get_history are callable without an API key — you get the free tier, capped at 60 requests/minute per IP.

Errors

from amaneki import AuthError, RateLimitError, NotFoundError

Raised on HTTP 401 / 429 / 404. RateLimitError.retry_after holds the seconds from the Retry-After header when the server provides one.

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

amaneki-0.6.0.tar.gz (27.4 kB view details)

Uploaded Source

Built Distribution

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

amaneki-0.6.0-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file amaneki-0.6.0.tar.gz.

File metadata

  • Download URL: amaneki-0.6.0.tar.gz
  • Upload date:
  • Size: 27.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for amaneki-0.6.0.tar.gz
Algorithm Hash digest
SHA256 da9c34a14f2a6b51496a14a42a9dba04e383ba62ac13bc1d048b8dfe9a71fbfa
MD5 5c4666bca61d50523896b59aa347220e
BLAKE2b-256 610513d6c3baf156a5e6ae91a3f3c758db99c18800fda86214610ddd36713b8e

See more details on using hashes here.

File details

Details for the file amaneki-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: amaneki-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for amaneki-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5d0e643094ab86460f33207de8b20b7917ba4fe10df12d2bfe3d382f0c100436
MD5 472262c92ec3df77c9ae0f33b0f04ae0
BLAKE2b-256 fc70aabd9501ef9c38dd04f3379e07a860bc84f938956f1451bb921d17d7504c

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