SDK.
amanoki is a thin typed client around the HTTP
surface. Sync (Client) and async
(AsyncClient) variants share the same method set
and return the same typed dataclasses. Raw HTTP callers see the
same JSON content, accessed by dict key rather than attribute.
Install
pip install amanoki
Python 3.10+. Transitive deps: httpx only. No
scientific stack at import time; no C extensions.
Methods
| Method | Backs |
|---|---|
list_markets() | GET /v1/markets |
get_areas(market) | GET /v1/markets/{m}/areas |
get_regime(m, a) | GET /v1/power/{m}/{a} |
regime_forecast(m, a, horizon_min=120) | GET /v1/power/{m}/{a}/regime-forecast |
spike_probability(m, a) | GET /v1/power/{m}/{a}/spike-probability |
transitions(m, a, limit=50) | GET /v1/power/{m}/{a}/transitions |
transition_matrix(m, a) | GET /v1/power/{m}/{a}/matrix |
regime_durations(m, a) | GET /v1/power/{m}/{a}/durations |
history(m, a, from_ms=, to_ms=, limit=500) | GET /v1/power/{m}/{a}/history |
spatial_influence(m, a, target_regime="high", max_lag_bars=4) | GET /v1/power/{m}/{a}/spatial-influence |
status() | GET /v1/status |
health() | GET /v1/health |
Typed responses
from amanoki import Client, PriceRegimeSnapshot, SpikeProbability
c = Client()
r: PriceRegimeSnapshot = c.get_regime("jepx", "tokyo")
print(r.regime, r.price, r.price_unit, r.z_vol, r.last_update_ms)
s: SpikeProbability = c.spike_probability("jepx", "tokyo")
print(s.method, s.sample_size_bars, s.is_weekend)
for cell in s.cells:
print(cell.threshold, cell.horizon_min, cell.p, cell.base_rate)
Async
import asyncio
from amanoki import AsyncClient
async def main():
async with AsyncClient() as c:
status = await c.status()
print(status.markets_with_data, status.latest_bar_ms)
r = await c.regime_forecast("jepx", "tokyo", horizon_min=120)
print(r["method"], r["probabilities"], r.get("test_brier"))
asyncio.run(main())
Errors
from amanoki import (
AmanokiError, AuthError, NotFoundError, RateLimitError, ServerError
)
try:
c.get_regime("jepx", "okinawa")
except NotFoundError as e:
print("404:", e)
except RateLimitError as e:
time.sleep(e.retry_after or 30)
except ServerError:
# transient; retry with exponential backoff
pass
All HTTP errors raise an AmanekiError subclass.
The underlying HTTP body is RFC 7807 application/problem+json;
the SDK unwraps it into the exception's message while keeping
status_code and (for 429) retry_after
as structured attributes.
Versioning
SDK major version tracks the API surface, not the service version. Breaking changes to the method list bump the SDK major. New endpoints arrive as minor releases. Current: amanoki 0.1.0.
Source
The SDK is a thin wrapper. If the methods you want aren't
covered yet, the full OpenAPI reference
is the source of truth — every endpoint is callable with
httpx.get against the base URL
https://api.amanoki.com, and the typed dataclasses
can be reconstructed from the JSON without the SDK.