synpath 0.3.1__tar.gz → 0.4.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 (109) hide show
  1. {synpath-0.3.1 → synpath-0.4.0}/PKG-INFO +3 -2
  2. {synpath-0.3.1 → synpath-0.4.0}/README.md +2 -1
  3. {synpath-0.3.1 → synpath-0.4.0}/pyproject.toml +1 -1
  4. {synpath-0.3.1 → synpath-0.4.0}/synpath/__init__.py +7 -5
  5. {synpath-0.3.1 → synpath-0.4.0}/synpath/client.py +9 -1
  6. {synpath-0.3.1 → synpath-0.4.0}/synpath/engine/__main__.py +1 -0
  7. {synpath-0.3.1 → synpath-0.4.0}/synpath/engine/feeds.py +8 -0
  8. synpath-0.4.0/synpath/hyperliquid.py +945 -0
  9. {synpath-0.3.1 → synpath-0.4.0}/synpath/ids.py +3 -3
  10. {synpath-0.3.1 → synpath-0.4.0}/synpath/server/serve.py +1 -1
  11. {synpath-0.3.1 → synpath-0.4.0}/synpath/trading/__init__.py +4 -1
  12. {synpath-0.3.1 → synpath-0.4.0}/synpath/trading/__main__.py +7 -1
  13. {synpath-0.3.1 → synpath-0.4.0}/synpath/trading/credentials.py +51 -1
  14. synpath-0.4.0/synpath/trading/hyperliquid.py +679 -0
  15. synpath-0.4.0/synpath/trading/hyperliquid_signing.py +186 -0
  16. {synpath-0.3.1 → synpath-0.4.0}/synpath/trading/init.py +19 -0
  17. {synpath-0.3.1 → synpath-0.4.0}/synpath/trading/instruments.py +4 -0
  18. {synpath-0.3.1 → synpath-0.4.0}/synpath/types.py +6 -0
  19. {synpath-0.3.1 → synpath-0.4.0}/synpath/ws/__init__.py +4 -1
  20. synpath-0.4.0/synpath/ws/hyperliquid.py +350 -0
  21. {synpath-0.3.1 → synpath-0.4.0}/Cargo.toml +0 -0
  22. {synpath-0.3.1 → synpath-0.4.0}/LICENSE +0 -0
  23. {synpath-0.3.1 → synpath-0.4.0}/bindings/python/Cargo.lock +0 -0
  24. {synpath-0.3.1 → synpath-0.4.0}/bindings/python/Cargo.toml +0 -0
  25. {synpath-0.3.1 → synpath-0.4.0}/bindings/python/src/kalshi.rs +0 -0
  26. {synpath-0.3.1 → synpath-0.4.0}/bindings/python/src/lib.rs +0 -0
  27. {synpath-0.3.1 → synpath-0.4.0}/bindings/python/src/objects.rs +0 -0
  28. {synpath-0.3.1 → synpath-0.4.0}/bindings/python/src/polymarket.rs +0 -0
  29. {synpath-0.3.1 → synpath-0.4.0}/bindings/python/src/pyjson.rs +0 -0
  30. {synpath-0.3.1 → synpath-0.4.0}/bindings/python/src/router.rs +0 -0
  31. {synpath-0.3.1 → synpath-0.4.0}/bindings/python/src/signing.rs +0 -0
  32. {synpath-0.3.1 → synpath-0.4.0}/bindings/python/src/venues.rs +0 -0
  33. {synpath-0.3.1 → synpath-0.4.0}/build_backend/synpath_build.py +0 -0
  34. {synpath-0.3.1 → synpath-0.4.0}/crates/synpath-core/Cargo.lock +0 -0
  35. {synpath-0.3.1 → synpath-0.4.0}/crates/synpath-core/Cargo.toml +0 -0
  36. {synpath-0.3.1 → synpath-0.4.0}/crates/synpath-core/examples/decode_timing.rs +0 -0
  37. {synpath-0.3.1 → synpath-0.4.0}/crates/synpath-core/src/book.rs +0 -0
  38. {synpath-0.3.1 → synpath-0.4.0}/crates/synpath-core/src/kalshi.rs +0 -0
  39. {synpath-0.3.1 → synpath-0.4.0}/crates/synpath-core/src/lib.rs +0 -0
  40. {synpath-0.3.1 → synpath-0.4.0}/crates/synpath-core/src/opinion.rs +0 -0
  41. {synpath-0.3.1 → synpath-0.4.0}/crates/synpath-core/src/polymarket.rs +0 -0
  42. {synpath-0.3.1 → synpath-0.4.0}/crates/synpath-core/src/polymarket_us.rs +0 -0
  43. {synpath-0.3.1 → synpath-0.4.0}/crates/synpath-core/src/router.rs +0 -0
  44. {synpath-0.3.1 → synpath-0.4.0}/crates/synpath-core/src/signing.rs +0 -0
  45. {synpath-0.3.1 → synpath-0.4.0}/crates/synpath-core/src/wire.rs +0 -0
  46. {synpath-0.3.1 → synpath-0.4.0}/synpath/__main__.py +0 -0
  47. {synpath-0.3.1 → synpath-0.4.0}/synpath/_native.py +0 -0
  48. {synpath-0.3.1 → synpath-0.4.0}/synpath/base.py +0 -0
  49. {synpath-0.3.1 → synpath-0.4.0}/synpath/bucket.py +0 -0
  50. {synpath-0.3.1 → synpath-0.4.0}/synpath/engine/__init__.py +0 -0
  51. {synpath-0.3.1 → synpath-0.4.0}/synpath/engine/alerts.py +0 -0
  52. {synpath-0.3.1 → synpath-0.4.0}/synpath/engine/engine.py +0 -0
  53. {synpath-0.3.1 → synpath-0.4.0}/synpath/engine/eod.py +0 -0
  54. {synpath-0.3.1 → synpath-0.4.0}/synpath/engine/events.py +0 -0
  55. {synpath-0.3.1 → synpath-0.4.0}/synpath/engine/fair_values.py +0 -0
  56. {synpath-0.3.1 → synpath-0.4.0}/synpath/engine/journal.py +0 -0
  57. {synpath-0.3.1 → synpath-0.4.0}/synpath/engine/ledger.py +0 -0
  58. {synpath-0.3.1 → synpath-0.4.0}/synpath/engine/orders/__init__.py +0 -0
  59. {synpath-0.3.1 → synpath-0.4.0}/synpath/engine/orders/base.py +0 -0
  60. {synpath-0.3.1 → synpath-0.4.0}/synpath/engine/orders/day.py +0 -0
  61. {synpath-0.3.1 → synpath-0.4.0}/synpath/engine/orders/iceberg.py +0 -0
  62. {synpath-0.3.1 → synpath-0.4.0}/synpath/engine/orders/manager.py +0 -0
  63. {synpath-0.3.1 → synpath-0.4.0}/synpath/engine/orders/oco.py +0 -0
  64. {synpath-0.3.1 → synpath-0.4.0}/synpath/engine/orders/peg.py +0 -0
  65. {synpath-0.3.1 → synpath-0.4.0}/synpath/engine/orders/routed.py +0 -0
  66. {synpath-0.3.1 → synpath-0.4.0}/synpath/engine/orders/stop.py +0 -0
  67. {synpath-0.3.1 → synpath-0.4.0}/synpath/engine/orders/taker.py +0 -0
  68. {synpath-0.3.1 → synpath-0.4.0}/synpath/engine/orders/twap.py +0 -0
  69. {synpath-0.3.1 → synpath-0.4.0}/synpath/engine/paper.py +0 -0
  70. {synpath-0.3.1 → synpath-0.4.0}/synpath/engine/reconcile.py +0 -0
  71. {synpath-0.3.1 → synpath-0.4.0}/synpath/engine/risk.py +0 -0
  72. {synpath-0.3.1 → synpath-0.4.0}/synpath/engine/router.py +0 -0
  73. {synpath-0.3.1 → synpath-0.4.0}/synpath/errors.py +0 -0
  74. {synpath-0.3.1 → synpath-0.4.0}/synpath/history.py +0 -0
  75. {synpath-0.3.1 → synpath-0.4.0}/synpath/hosted.py +0 -0
  76. {synpath-0.3.1 → synpath-0.4.0}/synpath/hosted_auth.py +0 -0
  77. {synpath-0.3.1 → synpath-0.4.0}/synpath/kalshi.py +0 -0
  78. {synpath-0.3.1 → synpath-0.4.0}/synpath/matching.py +0 -0
  79. {synpath-0.3.1 → synpath-0.4.0}/synpath/opinion.py +0 -0
  80. {synpath-0.3.1 → synpath-0.4.0}/synpath/polymarket.py +0 -0
  81. {synpath-0.3.1 → synpath-0.4.0}/synpath/polymarket_us.py +0 -0
  82. {synpath-0.3.1 → synpath-0.4.0}/synpath/remote.py +0 -0
  83. {synpath-0.3.1 → synpath-0.4.0}/synpath/server/__init__.py +0 -0
  84. {synpath-0.3.1 → synpath-0.4.0}/synpath/server/__main__.py +0 -0
  85. {synpath-0.3.1 → synpath-0.4.0}/synpath/server/api.py +0 -0
  86. {synpath-0.3.1 → synpath-0.4.0}/synpath/server/errors.py +0 -0
  87. {synpath-0.3.1 → synpath-0.4.0}/synpath/server/local.py +0 -0
  88. {synpath-0.3.1 → synpath-0.4.0}/synpath/server/models.py +0 -0
  89. {synpath-0.3.1 → synpath-0.4.0}/synpath/server/store.py +0 -0
  90. {synpath-0.3.1 → synpath-0.4.0}/synpath/server/trading.py +0 -0
  91. {synpath-0.3.1 → synpath-0.4.0}/synpath/trading/base.py +0 -0
  92. {synpath-0.3.1 → synpath-0.4.0}/synpath/trading/errors.py +0 -0
  93. {synpath-0.3.1 → synpath-0.4.0}/synpath/trading/kalshi.py +0 -0
  94. {synpath-0.3.1 → synpath-0.4.0}/synpath/trading/limiter.py +0 -0
  95. {synpath-0.3.1 → synpath-0.4.0}/synpath/trading/money.py +0 -0
  96. {synpath-0.3.1 → synpath-0.4.0}/synpath/trading/opinion.py +0 -0
  97. {synpath-0.3.1 → synpath-0.4.0}/synpath/trading/opinion_signing.py +0 -0
  98. {synpath-0.3.1 → synpath-0.4.0}/synpath/trading/polymarket.py +0 -0
  99. {synpath-0.3.1 → synpath-0.4.0}/synpath/trading/polymarket_signing.py +0 -0
  100. {synpath-0.3.1 → synpath-0.4.0}/synpath/trading/polymarket_us.py +0 -0
  101. {synpath-0.3.1 → synpath-0.4.0}/synpath/trading/polymarket_us_exchange.py +0 -0
  102. {synpath-0.3.1 → synpath-0.4.0}/synpath/trading/types.py +0 -0
  103. {synpath-0.3.1 → synpath-0.4.0}/synpath/ws/base.py +0 -0
  104. {synpath-0.3.1 → synpath-0.4.0}/synpath/ws/grpc.py +0 -0
  105. {synpath-0.3.1 → synpath-0.4.0}/synpath/ws/kalshi.py +0 -0
  106. {synpath-0.3.1 → synpath-0.4.0}/synpath/ws/opinion.py +0 -0
  107. {synpath-0.3.1 → synpath-0.4.0}/synpath/ws/polymarket.py +0 -0
  108. {synpath-0.3.1 → synpath-0.4.0}/synpath/ws/polymarket_us.py +0 -0
  109. {synpath-0.3.1 → synpath-0.4.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.4.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,7 @@ 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 |
77
78
 
78
79
  ## Why Synpath
79
80
 
@@ -123,7 +124,7 @@ fee.estimate(price=0.50, contracts=100) # 1.75
123
124
  **Same code, every venue**
124
125
 
125
126
  ```python
126
- for venue_id in synpath.exchanges: # ['kalshi', 'polymarket', 'polymarket_us', 'opinion']
127
+ for venue_id in synpath.exchanges: # ['kalshi', 'polymarket', 'polymarket_us', 'opinion', 'hyperliquid']
127
128
  with synpath.exchange(venue_id) as venue:
128
129
  page = venue.fetch_markets(limit=5)
129
130
 
@@ -28,6 +28,7 @@ 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 |
31
32
 
32
33
  ## Why Synpath
33
34
 
@@ -77,7 +78,7 @@ fee.estimate(price=0.50, contracts=100) # 1.75
77
78
  **Same code, every venue**
78
79
 
79
80
  ```python
80
- for venue_id in synpath.exchanges: # ['kalshi', 'polymarket', 'polymarket_us', 'opinion']
81
+ for venue_id in synpath.exchanges: # ['kalshi', 'polymarket', 'polymarket_us', 'opinion', 'hyperliquid']
81
82
  with synpath.exchange(venue_id) as venue:
82
83
  page = venue.fetch_markets(limit=5)
83
84
 
@@ -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.4.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,7 @@ 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
46
47
  from .matching import match_event, match_market
47
48
  from .history import fetch_order_book_at, fetch_order_book_range, fetch_trades_range
48
49
  from .bucket import Bucket, BucketMember, BucketOrderReport, BucketPosition
@@ -76,13 +77,14 @@ from .types import (
76
77
  TradesRangeResponse,
77
78
  )
78
79
 
79
- __version__ = "0.3.1"
80
+ __version__ = "0.4.0"
80
81
 
81
82
  exchanges: dict[str, type[Exchange]] = {
82
83
  "kalshi": Kalshi,
83
84
  "polymarket": Polymarket,
84
85
  "polymarket_us": PolymarketUS,
85
86
  "opinion": Opinion,
87
+ "hyperliquid": Hyperliquid,
86
88
  }
87
89
  """Every venue this library speaks, by id."""
88
90
 
@@ -103,7 +105,7 @@ def exchange(venue: str, **kwargs) -> Exchange:
103
105
  # keeps working. Imported last, after the read API it builds on.
104
106
  from .trading import (
105
107
  TradingExchange, KalshiTrading, PolymarketTrading, PolymarketUSTrading, PolymarketUSExchangeTrading,
106
- OpinionTrading,
108
+ OpinionTrading, HyperliquidTrading,
107
109
  Account, Balance, EditRequest, FeeEstimate, Fill, HeldBy, Liquidity,
108
110
  Order, OrderRequest, OrderStatus, OrderType, Position, PositionSide,
109
111
  Precision, Settlement, SettlementState, Side, TimeInForce,
@@ -131,7 +133,7 @@ _STREAM_CLASSES = (
131
133
  "PolymarketUSExchangeTradeCaptureStream", "PolymarketUSExchangePositionChangeStream",
132
134
  "PolymarketUSExchangeInstrumentStream", "PolymarketUSExchangePositionStream",
133
135
  "PolymarketUSExchangeMarketDataStream", "PolymarketUSExchangeBalanceLedgerStream",
134
- "OpinionMarketStream", "OpinionUserStream",
136
+ "OpinionMarketStream", "OpinionUserStream", "HyperliquidMarketStream", "HyperliquidUserStream",
135
137
  )
136
138
  _SERVER_NAMES = ("create_app", "create_trading_app", "VenueRegistry", "ControlStore", "Principal")
137
139
 
@@ -153,7 +155,7 @@ def __getattr__(name: str):
153
155
 
154
156
 
155
157
  __all__ = [
156
- "Kalshi", "Polymarket", "PolymarketUS", "Opinion", "Exchange", "exchange", "exchanges",
158
+ "Kalshi", "Polymarket", "PolymarketUS", "Opinion", "Hyperliquid", "Exchange", "exchange", "exchanges",
157
159
  "Capability", "HttpClient", "RateLimiter",
158
160
  "Market", "Event", "Outcome", "Quote", "MarketStats", "OrderBook",
159
161
  "OrderLevel", "Trade", "Candle", "FeeSchedule", "Series", "Page",
@@ -170,7 +172,7 @@ __all__ = [
170
172
  "MarketNotFound", "NotSupported", "AuthenticationError",
171
173
  # order entry
172
174
  "TradingExchange", "KalshiTrading", "PolymarketTrading", "PolymarketUSTrading", "PolymarketUSExchangeTrading",
173
- "OpinionTrading",
175
+ "OpinionTrading", "HyperliquidTrading",
174
176
  "Account", "Balance", "EditRequest", "FeeEstimate", "Fill", "HeldBy", "Liquidity",
175
177
  "Order", "OrderRequest", "OrderStatus", "OrderType", "Position", "PositionSide",
176
178
  "Precision", "Settlement", "SettlementState", "Side", "TimeInForce",
@@ -358,4 +358,12 @@ 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
+ _TRADING = {
367
+ "kalshi": _kalshi, "polymarket": _polymarket, "polymarket_us": _polymarket_us, "opinion": _opinion,
368
+ "hyperliquid": _hyperliquid,
369
+ }
@@ -61,6 +61,7 @@ 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"),
64
65
  }
65
66
 
66
67
 
@@ -78,6 +78,14 @@ 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
+ )
81
89
  else:
82
90
  log.info("synpath.engine.feeds: no stream for %s; its orders reach the engine by polling", venue)
83
91
  return out