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.

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.5.1.tar.gz (25.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.5.1-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: amaneki-0.5.1.tar.gz
  • Upload date:
  • Size: 25.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for amaneki-0.5.1.tar.gz
Algorithm Hash digest
SHA256 571bbd2f59966b3d5fb65a234ee59bc99663b0986c4de1a485ca9fdb745b7df8
MD5 d729d0b30b17fa3a7135c63a4cccaa76
BLAKE2b-256 3cd6c4838e31b56442b47a20935e48b47f2566e337fc963482239d3470160e6d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: amaneki-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for amaneki-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 aa102a1149039ebdb9a30892d49f97cf341b9223ff2204ff3f7991c9e5a55dab
MD5 eb16aea873e75ce5858db375d00349b2
BLAKE2b-256 60ec4ffc1609ea39869aebfabebcc69d9f8e10345dc913824661c743e7cc6609

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