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.
Files changed (121) hide show
  1. {synpath-0.7.1 → synpath-0.7.2}/PKG-INFO +1 -1
  2. {synpath-0.7.1 → synpath-0.7.2}/pyproject.toml +1 -1
  3. {synpath-0.7.1 → synpath-0.7.2}/synpath/__init__.py +1 -1
  4. {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/kalshi.py +18 -10
  5. {synpath-0.7.1 → synpath-0.7.2}/Cargo.toml +0 -0
  6. {synpath-0.7.1 → synpath-0.7.2}/LICENSE +0 -0
  7. {synpath-0.7.1 → synpath-0.7.2}/README.md +0 -0
  8. {synpath-0.7.1 → synpath-0.7.2}/bindings/python/Cargo.lock +0 -0
  9. {synpath-0.7.1 → synpath-0.7.2}/bindings/python/Cargo.toml +0 -0
  10. {synpath-0.7.1 → synpath-0.7.2}/bindings/python/src/kalshi.rs +0 -0
  11. {synpath-0.7.1 → synpath-0.7.2}/bindings/python/src/lib.rs +0 -0
  12. {synpath-0.7.1 → synpath-0.7.2}/bindings/python/src/objects.rs +0 -0
  13. {synpath-0.7.1 → synpath-0.7.2}/bindings/python/src/polymarket.rs +0 -0
  14. {synpath-0.7.1 → synpath-0.7.2}/bindings/python/src/pyjson.rs +0 -0
  15. {synpath-0.7.1 → synpath-0.7.2}/bindings/python/src/router.rs +0 -0
  16. {synpath-0.7.1 → synpath-0.7.2}/bindings/python/src/signing.rs +0 -0
  17. {synpath-0.7.1 → synpath-0.7.2}/bindings/python/src/venues.rs +0 -0
  18. {synpath-0.7.1 → synpath-0.7.2}/build_backend/synpath_build.py +0 -0
  19. {synpath-0.7.1 → synpath-0.7.2}/crates/synpath-core/Cargo.lock +0 -0
  20. {synpath-0.7.1 → synpath-0.7.2}/crates/synpath-core/Cargo.toml +0 -0
  21. {synpath-0.7.1 → synpath-0.7.2}/crates/synpath-core/examples/decode_timing.rs +0 -0
  22. {synpath-0.7.1 → synpath-0.7.2}/crates/synpath-core/src/book.rs +0 -0
  23. {synpath-0.7.1 → synpath-0.7.2}/crates/synpath-core/src/kalshi.rs +0 -0
  24. {synpath-0.7.1 → synpath-0.7.2}/crates/synpath-core/src/lib.rs +0 -0
  25. {synpath-0.7.1 → synpath-0.7.2}/crates/synpath-core/src/opinion.rs +0 -0
  26. {synpath-0.7.1 → synpath-0.7.2}/crates/synpath-core/src/polymarket.rs +0 -0
  27. {synpath-0.7.1 → synpath-0.7.2}/crates/synpath-core/src/polymarket_us.rs +0 -0
  28. {synpath-0.7.1 → synpath-0.7.2}/crates/synpath-core/src/router.rs +0 -0
  29. {synpath-0.7.1 → synpath-0.7.2}/crates/synpath-core/src/signing.rs +0 -0
  30. {synpath-0.7.1 → synpath-0.7.2}/crates/synpath-core/src/wire.rs +0 -0
  31. {synpath-0.7.1 → synpath-0.7.2}/synpath/__main__.py +0 -0
  32. {synpath-0.7.1 → synpath-0.7.2}/synpath/_native.py +0 -0
  33. {synpath-0.7.1 → synpath-0.7.2}/synpath/base.py +0 -0
  34. {synpath-0.7.1 → synpath-0.7.2}/synpath/bucket.py +0 -0
  35. {synpath-0.7.1 → synpath-0.7.2}/synpath/client.py +0 -0
  36. {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/__init__.py +0 -0
  37. {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/__main__.py +0 -0
  38. {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/alerts.py +0 -0
  39. {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/engine.py +0 -0
  40. {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/eod.py +0 -0
  41. {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/events.py +0 -0
  42. {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/fair_values.py +0 -0
  43. {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/feeds.py +0 -0
  44. {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/journal.py +0 -0
  45. {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/ledger.py +0 -0
  46. {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/orders/__init__.py +0 -0
  47. {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/orders/base.py +0 -0
  48. {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/orders/day.py +0 -0
  49. {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/orders/iceberg.py +0 -0
  50. {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/orders/manager.py +0 -0
  51. {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/orders/oco.py +0 -0
  52. {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/orders/peg.py +0 -0
  53. {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/orders/routed.py +0 -0
  54. {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/orders/stop.py +0 -0
  55. {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/orders/taker.py +0 -0
  56. {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/orders/twap.py +0 -0
  57. {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/paper.py +0 -0
  58. {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/reconcile.py +0 -0
  59. {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/risk.py +0 -0
  60. {synpath-0.7.1 → synpath-0.7.2}/synpath/engine/router.py +0 -0
  61. {synpath-0.7.1 → synpath-0.7.2}/synpath/errors.py +0 -0
  62. {synpath-0.7.1 → synpath-0.7.2}/synpath/history.py +0 -0
  63. {synpath-0.7.1 → synpath-0.7.2}/synpath/hosted.py +0 -0
  64. {synpath-0.7.1 → synpath-0.7.2}/synpath/hosted_auth.py +0 -0
  65. {synpath-0.7.1 → synpath-0.7.2}/synpath/hyperliquid.py +0 -0
  66. {synpath-0.7.1 → synpath-0.7.2}/synpath/ids.py +0 -0
  67. {synpath-0.7.1 → synpath-0.7.2}/synpath/kalshi.py +0 -0
  68. {synpath-0.7.1 → synpath-0.7.2}/synpath/limitless.py +0 -0
  69. {synpath-0.7.1 → synpath-0.7.2}/synpath/matching.py +0 -0
  70. {synpath-0.7.1 → synpath-0.7.2}/synpath/opinion.py +0 -0
  71. {synpath-0.7.1 → synpath-0.7.2}/synpath/polymarket.py +0 -0
  72. {synpath-0.7.1 → synpath-0.7.2}/synpath/polymarket_us.py +0 -0
  73. {synpath-0.7.1 → synpath-0.7.2}/synpath/predict_fun.py +0 -0
  74. {synpath-0.7.1 → synpath-0.7.2}/synpath/remote.py +0 -0
  75. {synpath-0.7.1 → synpath-0.7.2}/synpath/server/__init__.py +0 -0
  76. {synpath-0.7.1 → synpath-0.7.2}/synpath/server/__main__.py +0 -0
  77. {synpath-0.7.1 → synpath-0.7.2}/synpath/server/api.py +0 -0
  78. {synpath-0.7.1 → synpath-0.7.2}/synpath/server/errors.py +0 -0
  79. {synpath-0.7.1 → synpath-0.7.2}/synpath/server/local.py +0 -0
  80. {synpath-0.7.1 → synpath-0.7.2}/synpath/server/models.py +0 -0
  81. {synpath-0.7.1 → synpath-0.7.2}/synpath/server/serve.py +0 -0
  82. {synpath-0.7.1 → synpath-0.7.2}/synpath/server/store.py +0 -0
  83. {synpath-0.7.1 → synpath-0.7.2}/synpath/server/trading.py +0 -0
  84. {synpath-0.7.1 → synpath-0.7.2}/synpath/sx_bet.py +0 -0
  85. {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/__init__.py +0 -0
  86. {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/__main__.py +0 -0
  87. {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/base.py +0 -0
  88. {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/credentials.py +0 -0
  89. {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/errors.py +0 -0
  90. {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/hyperliquid.py +0 -0
  91. {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/hyperliquid_signing.py +0 -0
  92. {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/init.py +0 -0
  93. {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/instruments.py +0 -0
  94. {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/limiter.py +0 -0
  95. {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/limitless.py +0 -0
  96. {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/limitless_signing.py +0 -0
  97. {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/money.py +0 -0
  98. {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/opinion.py +0 -0
  99. {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/opinion_signing.py +0 -0
  100. {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/polymarket.py +0 -0
  101. {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/polymarket_signing.py +0 -0
  102. {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/polymarket_us.py +0 -0
  103. {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/polymarket_us_exchange.py +0 -0
  104. {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/predict_fun.py +0 -0
  105. {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/predict_fun_signing.py +0 -0
  106. {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/sx_bet.py +0 -0
  107. {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/sx_bet_signing.py +0 -0
  108. {synpath-0.7.1 → synpath-0.7.2}/synpath/trading/types.py +0 -0
  109. {synpath-0.7.1 → synpath-0.7.2}/synpath/types.py +0 -0
  110. {synpath-0.7.1 → synpath-0.7.2}/synpath/ws/__init__.py +0 -0
  111. {synpath-0.7.1 → synpath-0.7.2}/synpath/ws/base.py +0 -0
  112. {synpath-0.7.1 → synpath-0.7.2}/synpath/ws/grpc.py +0 -0
  113. {synpath-0.7.1 → synpath-0.7.2}/synpath/ws/hyperliquid.py +0 -0
  114. {synpath-0.7.1 → synpath-0.7.2}/synpath/ws/kalshi.py +0 -0
  115. {synpath-0.7.1 → synpath-0.7.2}/synpath/ws/limitless.py +0 -0
  116. {synpath-0.7.1 → synpath-0.7.2}/synpath/ws/opinion.py +0 -0
  117. {synpath-0.7.1 → synpath-0.7.2}/synpath/ws/polymarket.py +0 -0
  118. {synpath-0.7.1 → synpath-0.7.2}/synpath/ws/polymarket_us.py +0 -0
  119. {synpath-0.7.1 → synpath-0.7.2}/synpath/ws/polymarket_us_exchange.py +0 -0
  120. {synpath-0.7.1 → synpath-0.7.2}/synpath/ws/predict_fun.py +0 -0
  121. {synpath-0.7.1 → synpath-0.7.2}/synpath/ws/sx_bet.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: synpath
3
- Version: 0.7.1
3
+ Version: 0.7.2
4
4
  Classifier: Development Status :: 3 - Alpha
5
5
  Classifier: Intended Audience :: Financial and Insurance Industry
6
6
  Classifier: License :: OSI Approved :: MIT License
@@ -9,7 +9,7 @@ backend-path = ["build_backend"]
9
9
 
10
10
  [project]
11
11
  name = "synpath"
12
- version = "0.7.1"
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"
@@ -80,7 +80,7 @@ from .types import (
80
80
  TradesRangeResponse,
81
81
  )
82
82
 
83
- __version__ = "0.7.1"
83
+ __version__ = "0.7.2"
84
84
 
85
85
  exchanges: dict[str, type[Exchange]] = {
86
86
  "kalshi": Kalshi,
@@ -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. RSA-PSS, SHA-256, salt length equal
106
- to the digest -- the combination the venue's reference client uses and
107
- that a `openssl dgst -sigopt rsa_pss_saltlen:digest` reproduces.
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
- signature = self._key.sign(
124
- payload,
125
- padding.PSS(mgf=padding.MGF1(hashes.SHA256()), salt_length=padding.PSS.DIGEST_LENGTH),
126
- hashes.SHA256(),
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