synpath 0.7.1__tar.gz → 0.7.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {synpath-0.7.1 → synpath-0.7.2}/PKG-INFO +1 -1
- {synpath-0.7.1 → synpath-0.7.2}/pyproject.toml +1 -1
- {synpath-0.7.1 → synpath-0.7.2}/synpath/__init__.py +1 -1
- {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/kalshi.py +18 -10
- {synpath-0.7.1 → synpath-0.7.2}/Cargo.toml +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/LICENSE +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/README.md +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/bindings/python/Cargo.lock +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/bindings/python/Cargo.toml +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/bindings/python/src/kalshi.rs +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/bindings/python/src/lib.rs +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/bindings/python/src/objects.rs +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/bindings/python/src/polymarket.rs +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/bindings/python/src/pyjson.rs +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/bindings/python/src/router.rs +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/bindings/python/src/signing.rs +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/bindings/python/src/venues.rs +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/build_backend/synpath_build.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/crates/synpath-core/Cargo.lock +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/crates/synpath-core/Cargo.toml +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/crates/synpath-core/examples/decode_timing.rs +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/crates/synpath-core/src/book.rs +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/crates/synpath-core/src/kalshi.rs +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/crates/synpath-core/src/lib.rs +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/crates/synpath-core/src/opinion.rs +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/crates/synpath-core/src/polymarket.rs +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/crates/synpath-core/src/polymarket_us.rs +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/crates/synpath-core/src/router.rs +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/crates/synpath-core/src/signing.rs +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/crates/synpath-core/src/wire.rs +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/__main__.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/_native.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/base.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/bucket.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/client.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/__init__.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/__main__.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/alerts.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/engine.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/eod.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/events.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/fair_values.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/feeds.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/journal.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/ledger.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/orders/__init__.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/orders/base.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/orders/day.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/orders/iceberg.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/orders/manager.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/orders/oco.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/orders/peg.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/orders/routed.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/orders/stop.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/orders/taker.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/orders/twap.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/paper.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/reconcile.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/risk.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/router.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/errors.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/history.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/hosted.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/hosted_auth.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/hyperliquid.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/ids.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/kalshi.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/limitless.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/matching.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/opinion.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/polymarket.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/polymarket_us.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/predict_fun.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/remote.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/server/__init__.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/server/__main__.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/server/api.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/server/errors.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/server/local.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/server/models.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/server/serve.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/server/store.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/server/trading.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/sx_bet.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/__init__.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/__main__.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/base.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/credentials.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/errors.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/hyperliquid.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/hyperliquid_signing.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/init.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/instruments.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/limiter.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/limitless.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/limitless_signing.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/money.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/opinion.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/opinion_signing.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/polymarket.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/polymarket_signing.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/polymarket_us.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/polymarket_us_exchange.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/predict_fun.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/predict_fun_signing.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/sx_bet.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/sx_bet_signing.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/types.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/types.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/ws/__init__.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/ws/base.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/ws/grpc.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/ws/hyperliquid.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/ws/kalshi.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/ws/limitless.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/ws/opinion.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/ws/polymarket.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/ws/polymarket_us.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/ws/polymarket_us_exchange.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/ws/predict_fun.py +0 -0
- {synpath-0.7.1 → synpath-0.7.2}/synpath/ws/sx_bet.py +0 -0
|
@@ -9,7 +9,7 @@ backend-path = ["build_backend"]
|
|
|
9
9
|
|
|
10
10
|
[project]
|
|
11
11
|
name = "synpath"
|
|
12
|
-
version = "0.7.
|
|
12
|
+
version = "0.7.2"
|
|
13
13
|
description = "One API for prediction markets. Kalshi and Polymarket, normalized, with every price labelled by source and time."
|
|
14
14
|
readme = "README.md"
|
|
15
15
|
requires-python = ">=3.10"
|
|
@@ -15,7 +15,7 @@ made.
|
|
|
15
15
|
here is an immediate-or-cancel limit at the caller's protection price, and a
|
|
16
16
|
request without one is refused rather than sent at a price nobody chose.
|
|
17
17
|
|
|
18
|
-
Every request is signed: `timestamp + METHOD + path`, RSA-PSS with SHA-256
|
|
18
|
+
Every request is signed: `timestamp + METHOD + path`, Ed25519 or RSA-PSS with SHA-256
|
|
19
19
|
over the full request path (`/trade-api/v2/...`, no query string), sent in
|
|
20
20
|
three headers. The private key never leaves `KalshiSigner`.
|
|
21
21
|
|
|
@@ -102,29 +102,37 @@ class KalshiSigner:
|
|
|
102
102
|
|
|
103
103
|
The signing payload is `timestamp_ms + METHOD + path` with `path` the full
|
|
104
104
|
request path including the `/trade-api/v2` prefix and excluding any query
|
|
105
|
-
string, per the venue's own examples.
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
string, per the venue's own examples. The key's type picks the scheme:
|
|
106
|
+
an Ed25519 key (the venue's default for new keys) signs the payload
|
|
107
|
+
directly; an RSA key uses RSA-PSS, SHA-256, salt length equal to the
|
|
108
|
+
digest -- the combination the venue's reference client uses and that a
|
|
109
|
+
`openssl dgst -sigopt rsa_pss_saltlen:digest` reproduces.
|
|
108
110
|
"""
|
|
109
111
|
|
|
110
112
|
def __init__(self, key_id: str, private_key_pem: bytes):
|
|
111
113
|
try:
|
|
112
114
|
from cryptography.hazmat.primitives import serialization
|
|
115
|
+
from cryptography.hazmat.primitives.asymmetric import ed25519, rsa
|
|
113
116
|
except ImportError as exc: # pragma: no cover - depends on the environment
|
|
114
117
|
raise ImportError("Kalshi signing needs the `cryptography` package: pip install synpath") from exc
|
|
115
118
|
self.key_id = key_id
|
|
116
119
|
self._key = serialization.load_pem_private_key(private_key_pem, password=None)
|
|
120
|
+
if not isinstance(self._key, (ed25519.Ed25519PrivateKey, rsa.RSAPrivateKey)):
|
|
121
|
+
raise ValueError(f"Kalshi keys are Ed25519 or RSA; this one is {type(self._key).__name__}")
|
|
117
122
|
|
|
118
123
|
def sign(self, timestamp_ms: int, method: str, path: str) -> str:
|
|
119
124
|
from cryptography.hazmat.primitives import hashes
|
|
120
|
-
from cryptography.hazmat.primitives.asymmetric import padding
|
|
125
|
+
from cryptography.hazmat.primitives.asymmetric import ed25519, padding
|
|
121
126
|
|
|
122
127
|
payload = f"{timestamp_ms}{method.upper()}{path}".encode()
|
|
123
|
-
|
|
124
|
-
payload
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
+
if isinstance(self._key, ed25519.Ed25519PrivateKey):
|
|
129
|
+
signature = self._key.sign(payload)
|
|
130
|
+
else:
|
|
131
|
+
signature = self._key.sign(
|
|
132
|
+
payload,
|
|
133
|
+
padding.PSS(mgf=padding.MGF1(hashes.SHA256()), salt_length=padding.PSS.DIGEST_LENGTH),
|
|
134
|
+
hashes.SHA256(),
|
|
135
|
+
)
|
|
128
136
|
return base64.b64encode(signature).decode()
|
|
129
137
|
|
|
130
138
|
def headers(self, method: str, path: str, *, timestamp_ms: int | None = None) -> dict[str, str]:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|