synpath 0.3.1__tar.gz → 0.5.0__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 (113) hide show
  1. {synpath-0.3.1 → synpath-0.5.0}/PKG-INFO +4 -2
  2. {synpath-0.3.1 → synpath-0.5.0}/README.md +3 -1
  3. {synpath-0.3.1 → synpath-0.5.0}/pyproject.toml +1 -1
  4. {synpath-0.3.1 → synpath-0.5.0}/synpath/__init__.py +10 -5
  5. {synpath-0.3.1 → synpath-0.5.0}/synpath/client.py +14 -1
  6. {synpath-0.3.1 → synpath-0.5.0}/synpath/engine/__main__.py +2 -0
  7. {synpath-0.3.1 → synpath-0.5.0}/synpath/engine/feeds.py +16 -0
  8. synpath-0.5.0/synpath/hyperliquid.py +945 -0
  9. {synpath-0.3.1 → synpath-0.5.0}/synpath/ids.py +3 -3
  10. synpath-0.5.0/synpath/predict_fun.py +612 -0
  11. {synpath-0.3.1 → synpath-0.5.0}/synpath/server/serve.py +1 -1
  12. {synpath-0.3.1 → synpath-0.5.0}/synpath/trading/__init__.py +7 -1
  13. {synpath-0.3.1 → synpath-0.5.0}/synpath/trading/__main__.py +14 -1
  14. {synpath-0.3.1 → synpath-0.5.0}/synpath/trading/credentials.py +116 -1
  15. synpath-0.5.0/synpath/trading/hyperliquid.py +679 -0
  16. synpath-0.5.0/synpath/trading/hyperliquid_signing.py +186 -0
  17. {synpath-0.3.1 → synpath-0.5.0}/synpath/trading/init.py +44 -0
  18. {synpath-0.3.1 → synpath-0.5.0}/synpath/trading/instruments.py +7 -0
  19. synpath-0.5.0/synpath/trading/predict_fun.py +831 -0
  20. synpath-0.5.0/synpath/trading/predict_fun_signing.py +271 -0
  21. {synpath-0.3.1 → synpath-0.5.0}/synpath/types.py +11 -0
  22. {synpath-0.3.1 → synpath-0.5.0}/synpath/ws/__init__.py +8 -1
  23. synpath-0.5.0/synpath/ws/hyperliquid.py +350 -0
  24. synpath-0.5.0/synpath/ws/predict_fun.py +346 -0
  25. {synpath-0.3.1 → synpath-0.5.0}/Cargo.toml +0 -0
  26. {synpath-0.3.1 → synpath-0.5.0}/LICENSE +0 -0
  27. {synpath-0.3.1 → synpath-0.5.0}/bindings/python/Cargo.lock +0 -0
  28. {synpath-0.3.1 → synpath-0.5.0}/bindings/python/Cargo.toml +0 -0
  29. {synpath-0.3.1 → synpath-0.5.0}/bindings/python/src/kalshi.rs +0 -0
  30. {synpath-0.3.1 → synpath-0.5.0}/bindings/python/src/lib.rs +0 -0
  31. {synpath-0.3.1 → synpath-0.5.0}/bindings/python/src/objects.rs +0 -0
  32. {synpath-0.3.1 → synpath-0.5.0}/bindings/python/src/polymarket.rs +0 -0
  33. {synpath-0.3.1 → synpath-0.5.0}/bindings/python/src/pyjson.rs +0 -0
  34. {synpath-0.3.1 → synpath-0.5.0}/bindings/python/src/router.rs +0 -0
  35. {synpath-0.3.1 → synpath-0.5.0}/bindings/python/src/signing.rs +0 -0
  36. {synpath-0.3.1 → synpath-0.5.0}/bindings/python/src/venues.rs +0 -0
  37. {synpath-0.3.1 → synpath-0.5.0}/build_backend/synpath_build.py +0 -0
  38. {synpath-0.3.1 → synpath-0.5.0}/crates/synpath-core/Cargo.lock +0 -0
  39. {synpath-0.3.1 → synpath-0.5.0}/crates/synpath-core/Cargo.toml +0 -0
  40. {synpath-0.3.1 → synpath-0.5.0}/crates/synpath-core/examples/decode_timing.rs +0 -0
  41. {synpath-0.3.1 → synpath-0.5.0}/crates/synpath-core/src/book.rs +0 -0
  42. {synpath-0.3.1 → synpath-0.5.0}/crates/synpath-core/src/kalshi.rs +0 -0
  43. {synpath-0.3.1 → synpath-0.5.0}/crates/synpath-core/src/lib.rs +0 -0
  44. {synpath-0.3.1 → synpath-0.5.0}/crates/synpath-core/src/opinion.rs +0 -0
  45. {synpath-0.3.1 → synpath-0.5.0}/crates/synpath-core/src/polymarket.rs +0 -0
  46. {synpath-0.3.1 → synpath-0.5.0}/crates/synpath-core/src/polymarket_us.rs +0 -0
  47. {synpath-0.3.1 → synpath-0.5.0}/crates/synpath-core/src/router.rs +0 -0
  48. {synpath-0.3.1 → synpath-0.5.0}/crates/synpath-core/src/signing.rs +0 -0
  49. {synpath-0.3.1 → synpath-0.5.0}/crates/synpath-core/src/wire.rs +0 -0
  50. {synpath-0.3.1 → synpath-0.5.0}/synpath/__main__.py +0 -0
  51. {synpath-0.3.1 → synpath-0.5.0}/synpath/_native.py +0 -0
  52. {synpath-0.3.1 → synpath-0.5.0}/synpath/base.py +0 -0
  53. {synpath-0.3.1 → synpath-0.5.0}/synpath/bucket.py +0 -0
  54. {synpath-0.3.1 → synpath-0.5.0}/synpath/engine/__init__.py +0 -0
  55. {synpath-0.3.1 → synpath-0.5.0}/synpath/engine/alerts.py +0 -0
  56. {synpath-0.3.1 → synpath-0.5.0}/synpath/engine/engine.py +0 -0
  57. {synpath-0.3.1 → synpath-0.5.0}/synpath/engine/eod.py +0 -0
  58. {synpath-0.3.1 → synpath-0.5.0}/synpath/engine/events.py +0 -0
  59. {synpath-0.3.1 → synpath-0.5.0}/synpath/engine/fair_values.py +0 -0
  60. {synpath-0.3.1 → synpath-0.5.0}/synpath/engine/journal.py +0 -0
  61. {synpath-0.3.1 → synpath-0.5.0}/synpath/engine/ledger.py +0 -0
  62. {synpath-0.3.1 → synpath-0.5.0}/synpath/engine/orders/__init__.py +0 -0
  63. {synpath-0.3.1 → synpath-0.5.0}/synpath/engine/orders/base.py +0 -0
  64. {synpath-0.3.1 → synpath-0.5.0}/synpath/engine/orders/day.py +0 -0
  65. {synpath-0.3.1 → synpath-0.5.0}/synpath/engine/orders/iceberg.py +0 -0
  66. {synpath-0.3.1 → synpath-0.5.0}/synpath/engine/orders/manager.py +0 -0
  67. {synpath-0.3.1 → synpath-0.5.0}/synpath/engine/orders/oco.py +0 -0
  68. {synpath-0.3.1 → synpath-0.5.0}/synpath/engine/orders/peg.py +0 -0
  69. {synpath-0.3.1 → synpath-0.5.0}/synpath/engine/orders/routed.py +0 -0
  70. {synpath-0.3.1 → synpath-0.5.0}/synpath/engine/orders/stop.py +0 -0
  71. {synpath-0.3.1 → synpath-0.5.0}/synpath/engine/orders/taker.py +0 -0
  72. {synpath-0.3.1 → synpath-0.5.0}/synpath/engine/orders/twap.py +0 -0
  73. {synpath-0.3.1 → synpath-0.5.0}/synpath/engine/paper.py +0 -0
  74. {synpath-0.3.1 → synpath-0.5.0}/synpath/engine/reconcile.py +0 -0
  75. {synpath-0.3.1 → synpath-0.5.0}/synpath/engine/risk.py +0 -0
  76. {synpath-0.3.1 → synpath-0.5.0}/synpath/engine/router.py +0 -0
  77. {synpath-0.3.1 → synpath-0.5.0}/synpath/errors.py +0 -0
  78. {synpath-0.3.1 → synpath-0.5.0}/synpath/history.py +0 -0
  79. {synpath-0.3.1 → synpath-0.5.0}/synpath/hosted.py +0 -0
  80. {synpath-0.3.1 → synpath-0.5.0}/synpath/hosted_auth.py +0 -0
  81. {synpath-0.3.1 → synpath-0.5.0}/synpath/kalshi.py +0 -0
  82. {synpath-0.3.1 → synpath-0.5.0}/synpath/matching.py +0 -0
  83. {synpath-0.3.1 → synpath-0.5.0}/synpath/opinion.py +0 -0
  84. {synpath-0.3.1 → synpath-0.5.0}/synpath/polymarket.py +0 -0
  85. {synpath-0.3.1 → synpath-0.5.0}/synpath/polymarket_us.py +0 -0
  86. {synpath-0.3.1 → synpath-0.5.0}/synpath/remote.py +0 -0
  87. {synpath-0.3.1 → synpath-0.5.0}/synpath/server/__init__.py +0 -0
  88. {synpath-0.3.1 → synpath-0.5.0}/synpath/server/__main__.py +0 -0
  89. {synpath-0.3.1 → synpath-0.5.0}/synpath/server/api.py +0 -0
  90. {synpath-0.3.1 → synpath-0.5.0}/synpath/server/errors.py +0 -0
  91. {synpath-0.3.1 → synpath-0.5.0}/synpath/server/local.py +0 -0
  92. {synpath-0.3.1 → synpath-0.5.0}/synpath/server/models.py +0 -0
  93. {synpath-0.3.1 → synpath-0.5.0}/synpath/server/store.py +0 -0
  94. {synpath-0.3.1 → synpath-0.5.0}/synpath/server/trading.py +0 -0
  95. {synpath-0.3.1 → synpath-0.5.0}/synpath/trading/base.py +0 -0
  96. {synpath-0.3.1 → synpath-0.5.0}/synpath/trading/errors.py +0 -0
  97. {synpath-0.3.1 → synpath-0.5.0}/synpath/trading/kalshi.py +0 -0
  98. {synpath-0.3.1 → synpath-0.5.0}/synpath/trading/limiter.py +0 -0
  99. {synpath-0.3.1 → synpath-0.5.0}/synpath/trading/money.py +0 -0
  100. {synpath-0.3.1 → synpath-0.5.0}/synpath/trading/opinion.py +0 -0
  101. {synpath-0.3.1 → synpath-0.5.0}/synpath/trading/opinion_signing.py +0 -0
  102. {synpath-0.3.1 → synpath-0.5.0}/synpath/trading/polymarket.py +0 -0
  103. {synpath-0.3.1 → synpath-0.5.0}/synpath/trading/polymarket_signing.py +0 -0
  104. {synpath-0.3.1 → synpath-0.5.0}/synpath/trading/polymarket_us.py +0 -0
  105. {synpath-0.3.1 → synpath-0.5.0}/synpath/trading/polymarket_us_exchange.py +0 -0
  106. {synpath-0.3.1 → synpath-0.5.0}/synpath/trading/types.py +0 -0
  107. {synpath-0.3.1 → synpath-0.5.0}/synpath/ws/base.py +0 -0
  108. {synpath-0.3.1 → synpath-0.5.0}/synpath/ws/grpc.py +0 -0
  109. {synpath-0.3.1 → synpath-0.5.0}/synpath/ws/kalshi.py +0 -0
  110. {synpath-0.3.1 → synpath-0.5.0}/synpath/ws/opinion.py +0 -0
  111. {synpath-0.3.1 → synpath-0.5.0}/synpath/ws/polymarket.py +0 -0
  112. {synpath-0.3.1 → synpath-0.5.0}/synpath/ws/polymarket_us.py +0 -0
  113. {synpath-0.3.1 → synpath-0.5.0}/synpath/ws/polymarket_us_exchange.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: synpath
3
- Version: 0.3.1
3
+ Version: 0.5.0
4
4
  Classifier: Development Status :: 3 - Alpha
5
5
  Classifier: Intended Audience :: Financial and Insurance Industry
6
6
  Classifier: License :: OSI Approved :: MIT License
@@ -74,6 +74,8 @@ One order, both order books combined, filled from the cheapest price after fees.
74
74
  | <img src="assets/polymarket.png" width="20" height="20" alt="Polymarket"> | [Polymarket](https://polymarket.com) | `polymarket` | ✓ | ✓ | WebSocket | one book per outcome token |
75
75
  | <img src="assets/polymarket.png" width="20" height="20" alt="Polymarket US"> | [Polymarket US](https://polymarket.us) | `polymarket_us` | ✓ | ✓ retail and exchange APIs | WebSocket and gRPC | one book per market, both sides read it |
76
76
  | | [Opinion](https://opinion.trade) | `opinion` | ✓ | ✓ not yet live-tested | WebSocket (API key) | one book per outcome token |
77
+ | | [Hyperliquid](https://app.hyperliquid.xyz) | `hyperliquid` | ✓ outcome markets (HIP-4) | ✓ testnet-checked | WebSocket (no key) | one book per market, both sides read it |
78
+ | | [predict.fun](https://predict.fun) | `predict_fun` | ✓ (API key) | ✓ not yet live-tested | WebSocket (API key) | one book per market, both sides read it |
77
79
 
78
80
  ## Why Synpath
79
81
 
@@ -123,7 +125,7 @@ fee.estimate(price=0.50, contracts=100) # 1.75
123
125
  **Same code, every venue**
124
126
 
125
127
  ```python
126
- for venue_id in synpath.exchanges: # ['kalshi', 'polymarket', 'polymarket_us', 'opinion']
128
+ for venue_id in synpath.exchanges: # ['kalshi', 'polymarket', 'polymarket_us', 'opinion', 'hyperliquid', 'predict_fun']
127
129
  with synpath.exchange(venue_id) as venue:
128
130
  page = venue.fetch_markets(limit=5)
129
131
 
@@ -28,6 +28,8 @@ One order, both order books combined, filled from the cheapest price after fees.
28
28
  | <img src="assets/polymarket.png" width="20" height="20" alt="Polymarket"> | [Polymarket](https://polymarket.com) | `polymarket` | ✓ | ✓ | WebSocket | one book per outcome token |
29
29
  | <img src="assets/polymarket.png" width="20" height="20" alt="Polymarket US"> | [Polymarket US](https://polymarket.us) | `polymarket_us` | ✓ | ✓ retail and exchange APIs | WebSocket and gRPC | one book per market, both sides read it |
30
30
  | | [Opinion](https://opinion.trade) | `opinion` | ✓ | ✓ not yet live-tested | WebSocket (API key) | one book per outcome token |
31
+ | | [Hyperliquid](https://app.hyperliquid.xyz) | `hyperliquid` | ✓ outcome markets (HIP-4) | ✓ testnet-checked | WebSocket (no key) | one book per market, both sides read it |
32
+ | | [predict.fun](https://predict.fun) | `predict_fun` | ✓ (API key) | ✓ not yet live-tested | WebSocket (API key) | one book per market, both sides read it |
31
33
 
32
34
  ## Why Synpath
33
35
 
@@ -77,7 +79,7 @@ fee.estimate(price=0.50, contracts=100) # 1.75
77
79
  **Same code, every venue**
78
80
 
79
81
  ```python
80
- for venue_id in synpath.exchanges: # ['kalshi', 'polymarket', 'polymarket_us', 'opinion']
82
+ for venue_id in synpath.exchanges: # ['kalshi', 'polymarket', 'polymarket_us', 'opinion', 'hyperliquid', 'predict_fun']
81
83
  with synpath.exchange(venue_id) as venue:
82
84
  page = venue.fetch_markets(limit=5)
83
85
 
@@ -9,7 +9,7 @@ backend-path = ["build_backend"]
9
9
 
10
10
  [project]
11
11
  name = "synpath"
12
- version = "0.3.1"
12
+ version = "0.5.0"
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"
@@ -43,6 +43,8 @@ from .kalshi import Kalshi
43
43
  from .polymarket import Polymarket
44
44
  from .polymarket_us import PolymarketUS
45
45
  from .opinion import Opinion
46
+ from .hyperliquid import Hyperliquid
47
+ from .predict_fun import PredictFun
46
48
  from .matching import match_event, match_market
47
49
  from .history import fetch_order_book_at, fetch_order_book_range, fetch_trades_range
48
50
  from .bucket import Bucket, BucketMember, BucketOrderReport, BucketPosition
@@ -76,13 +78,15 @@ from .types import (
76
78
  TradesRangeResponse,
77
79
  )
78
80
 
79
- __version__ = "0.3.1"
81
+ __version__ = "0.5.0"
80
82
 
81
83
  exchanges: dict[str, type[Exchange]] = {
82
84
  "kalshi": Kalshi,
83
85
  "polymarket": Polymarket,
84
86
  "polymarket_us": PolymarketUS,
85
87
  "opinion": Opinion,
88
+ "hyperliquid": Hyperliquid,
89
+ "predict_fun": PredictFun,
86
90
  }
87
91
  """Every venue this library speaks, by id."""
88
92
 
@@ -103,7 +107,7 @@ def exchange(venue: str, **kwargs) -> Exchange:
103
107
  # keeps working. Imported last, after the read API it builds on.
104
108
  from .trading import (
105
109
  TradingExchange, KalshiTrading, PolymarketTrading, PolymarketUSTrading, PolymarketUSExchangeTrading,
106
- OpinionTrading,
110
+ OpinionTrading, HyperliquidTrading, PredictFunTrading,
107
111
  Account, Balance, EditRequest, FeeEstimate, Fill, HeldBy, Liquidity,
108
112
  Order, OrderRequest, OrderStatus, OrderType, Position, PositionSide,
109
113
  Precision, Settlement, SettlementState, Side, TimeInForce,
@@ -131,7 +135,8 @@ _STREAM_CLASSES = (
131
135
  "PolymarketUSExchangeTradeCaptureStream", "PolymarketUSExchangePositionChangeStream",
132
136
  "PolymarketUSExchangeInstrumentStream", "PolymarketUSExchangePositionStream",
133
137
  "PolymarketUSExchangeMarketDataStream", "PolymarketUSExchangeBalanceLedgerStream",
134
- "OpinionMarketStream", "OpinionUserStream",
138
+ "OpinionMarketStream", "OpinionUserStream", "HyperliquidMarketStream", "HyperliquidUserStream",
139
+ "PredictFunMarketStream", "PredictFunUserStream",
135
140
  )
136
141
  _SERVER_NAMES = ("create_app", "create_trading_app", "VenueRegistry", "ControlStore", "Principal")
137
142
 
@@ -153,7 +158,7 @@ def __getattr__(name: str):
153
158
 
154
159
 
155
160
  __all__ = [
156
- "Kalshi", "Polymarket", "PolymarketUS", "Opinion", "Exchange", "exchange", "exchanges",
161
+ "Kalshi", "Polymarket", "PolymarketUS", "Opinion", "Hyperliquid", "PredictFun", "Exchange", "exchange", "exchanges",
157
162
  "Capability", "HttpClient", "RateLimiter",
158
163
  "Market", "Event", "Outcome", "Quote", "MarketStats", "OrderBook",
159
164
  "OrderLevel", "Trade", "Candle", "FeeSchedule", "Series", "Page",
@@ -170,7 +175,7 @@ __all__ = [
170
175
  "MarketNotFound", "NotSupported", "AuthenticationError",
171
176
  # order entry
172
177
  "TradingExchange", "KalshiTrading", "PolymarketTrading", "PolymarketUSTrading", "PolymarketUSExchangeTrading",
173
- "OpinionTrading",
178
+ "OpinionTrading", "HyperliquidTrading", "PredictFunTrading",
174
179
  "Account", "Balance", "EditRequest", "FeeEstimate", "Fill", "HeldBy", "Liquidity",
175
180
  "Order", "OrderRequest", "OrderStatus", "OrderType", "Position", "PositionSide",
176
181
  "Precision", "Settlement", "SettlementState", "Side", "TimeInForce",
@@ -358,4 +358,17 @@ def _opinion(creds: Credentials) -> TradingExchange:
358
358
  return OpinionTrading(creds) # type: ignore[arg-type]
359
359
 
360
360
 
361
- _TRADING = {"kalshi": _kalshi, "polymarket": _polymarket, "polymarket_us": _polymarket_us, "opinion": _opinion}
361
+ def _hyperliquid(creds: Credentials) -> TradingExchange:
362
+ from .trading.hyperliquid import HyperliquidTrading
363
+ return HyperliquidTrading(creds) # type: ignore[arg-type]
364
+
365
+
366
+ def _predict_fun(creds: Credentials) -> TradingExchange:
367
+ from .trading.predict_fun import PredictFunTrading
368
+ return PredictFunTrading(creds) # type: ignore[arg-type]
369
+
370
+
371
+ _TRADING = {
372
+ "kalshi": _kalshi, "polymarket": _polymarket, "polymarket_us": _polymarket_us, "opinion": _opinion,
373
+ "hyperliquid": _hyperliquid, "predict_fun": _predict_fun,
374
+ }
@@ -61,6 +61,8 @@ ADAPTERS = {
61
61
  "polymarket_us": ("..trading.polymarket_us", "PolymarketUSTrading"),
62
62
  "polymarket_us_exchange": ("..trading.polymarket_us_exchange", "PolymarketUSExchangeTrading"),
63
63
  "opinion": ("..trading.opinion", "OpinionTrading"),
64
+ "hyperliquid": ("..trading.hyperliquid", "HyperliquidTrading"),
65
+ "predict_fun": ("..trading.predict_fun", "PredictFunTrading"),
64
66
  }
65
67
 
66
68
 
@@ -78,6 +78,22 @@ def default_streams(adapters: Mapping[str, Any], credentials: Mapping[str, Any])
78
78
  market=OpinionMarketStream(api_key=creds.api_key, catalog=catalog),
79
79
  private=OpinionUserStream(api_key=creds.api_key, catalog=catalog),
80
80
  )
81
+ elif venue == "hyperliquid":
82
+ from ..ws.hyperliquid import HyperliquidMarketStream, HyperliquidUserStream
83
+ address = getattr(creds, "address", None)
84
+ testnet = getattr(creds, "testnet", False)
85
+ out[venue] = VenueStreams(
86
+ market=HyperliquidMarketStream(testnet=testnet),
87
+ private=HyperliquidUserStream(address=address, testnet=testnet) if address else None,
88
+ )
89
+ elif venue == "predict_fun" and creds is not None and not getattr(creds, "testnet", False):
90
+ # Mainnet only: the venue documents no test-network WebSocket.
91
+ from ..ws.predict_fun import PredictFunMarketStream, PredictFunUserStream
92
+ jwt = getattr(adapter, "jwt", None)
93
+ out[venue] = VenueStreams(
94
+ market=PredictFunMarketStream(api_key=creds.api_key),
95
+ private=PredictFunUserStream(api_key=creds.api_key, jwt=jwt) if jwt else None,
96
+ )
81
97
  else:
82
98
  log.info("synpath.engine.feeds: no stream for %s; its orders reach the engine by polling", venue)
83
99
  return out