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