Snapfront Coherence Python SDK: WCT_phi and coherence-band client with retries, timeouts, and typed errors.
Project description
Snapfront Coherence — Python SDK
Minimal client for the local Coherence API.
Install
pip install -e .
Usage
from snapfront_coherence import Client, RateLimitError
client = Client(api_key="MYSECRETKEY", base_url="http://127.0.0.1:8000")
res = client.wct_phi([0.8, 1.1, -0.5])
print(res["wct_phi"], res["band"])
Mini examples
from snapfront_coherence import Client
c = Client(api_key="MYSECRETKEY", base_url="http://127.0.0.1:8000")
prices = [100, 101, 98, 99, 103, 102]
rets = [prices[i]-prices[i-1] for i in range(1,len(prices))]
resp = c.wct_phi(rets)
print(resp["wct_phi"], resp["band"])
Client.save_receipt(resp, "logs/example_markets_receipt.json")
lines = ["alpha", "alpha beta", "alpha beta gamma", "alpha"]
lengths = list(map(len, lines))
resp = c.score_series(lengths, mode="absolute", window=None)[0]
print(resp["wct_phi"], resp["band"])
temps = [20.0, 20.2, 19.7, 19.8, 20.1, 20.4, 20.0]
resp_list = c.score_series(temps, mode="relative", window=3)
print([r["band"] for r in resp_list])
Receipts
import json
payload = {"deltas":[0.8,1.1,-0.5]}
body_bytes = json.dumps(payload).encode("utf-8")
resp = client.wct_phi(payload["deltas"])
ok = Client.verify_hashes(resp, request_bytes=body_bytes,
response_bytes=json.dumps(resp).encode("utf-8"))
print("receipt ok?", ok)
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 snapfront_coherence-0.2.2.tar.gz.
File metadata
- Download URL: snapfront_coherence-0.2.2.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a1b5ec86190ae7b535de6102c5e6e68652eaeecd6fb703712899f19dac9cc06
|
|
| MD5 |
80b7cc0a85887cf60ea6c8fc522fb4fe
|
|
| BLAKE2b-256 |
5ec89143f6c5f833ab6f8167e713499ed47f80fe848b131b486fbc48f98b5abf
|
File details
Details for the file snapfront_coherence-0.2.2-py3-none-any.whl.
File metadata
- Download URL: snapfront_coherence-0.2.2-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e785fe960bb56fb0fe55e37ccc99445f16e79d63ea8caf8c7846d7c9f640117e
|
|
| MD5 |
339c2db6d9e47e419f70161333efa84a
|
|
| BLAKE2b-256 |
4b6a11f244a88dd5f17246314c5e80b318781f61e491e9f09b4963b76563c602
|