synpath 0.10.0__tar.gz → 0.12.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.
- {synpath-0.10.0 → synpath-0.12.0}/PKG-INFO +8 -8
- {synpath-0.10.0 → synpath-0.12.0}/README.md +7 -7
- {synpath-0.10.0 → synpath-0.12.0}/pyproject.toml +1 -1
- {synpath-0.10.0 → synpath-0.12.0}/synpath/__init__.py +4 -4
- {synpath-0.10.0 → synpath-0.12.0}/synpath/azuro.py +15 -1
- {synpath-0.10.0 → synpath-0.12.0}/synpath/client.py +12 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/engine/__main__.py +24 -17
- {synpath-0.10.0 → synpath-0.12.0}/synpath/engine/feeds.py +14 -8
- {synpath-0.10.0 → synpath-0.12.0}/synpath/engine/orders/__init__.py +3 -3
- {synpath-0.10.0 → synpath-0.12.0}/synpath/engine/orders/manager.py +3 -2
- {synpath-0.10.0 → synpath-0.12.0}/synpath/engine/orders/taker.py +4 -4
- {synpath-0.10.0 → synpath-0.12.0}/synpath/server/serve.py +2 -2
- {synpath-0.10.0 → synpath-0.12.0}/synpath/smarkets.py +2 -2
- {synpath-0.10.0 → synpath-0.12.0}/synpath/trading/__init__.py +8 -1
- {synpath-0.10.0 → synpath-0.12.0}/synpath/trading/__main__.py +5 -5
- {synpath-0.10.0 → synpath-0.12.0}/synpath/trading/azuro.py +585 -46
- {synpath-0.10.0 → synpath-0.12.0}/synpath/trading/azuro_signing.py +157 -9
- synpath-0.12.0/synpath/trading/betfair.py +1172 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/trading/credentials.py +89 -10
- {synpath-0.10.0 → synpath-0.12.0}/synpath/trading/gemini.py +205 -3
- {synpath-0.10.0 → synpath-0.12.0}/synpath/trading/init.py +7 -6
- {synpath-0.10.0 → synpath-0.12.0}/synpath/trading/instruments.py +11 -10
- {synpath-0.10.0 → synpath-0.12.0}/synpath/trading/myriad.py +642 -34
- {synpath-0.10.0 → synpath-0.12.0}/synpath/trading/myriad_signing.py +114 -1
- {synpath-0.10.0 → synpath-0.12.0}/synpath/trading/novig.py +1 -1
- synpath-0.12.0/synpath/trading/novig_rfq.py +1219 -0
- synpath-0.12.0/synpath/trading/novig_rfq_signing.py +187 -0
- synpath-0.12.0/synpath/trading/smarkets.py +921 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/trading/types.py +10 -1
- {synpath-0.10.0 → synpath-0.12.0}/synpath/ws/__init__.py +5 -5
- {synpath-0.10.0 → synpath-0.12.0}/synpath/ws/betfair.py +421 -71
- {synpath-0.10.0 → synpath-0.12.0}/synpath/ws/gemini.py +345 -2
- synpath-0.12.0/synpath/ws/novig_rfq.py +251 -0
- {synpath-0.10.0 → synpath-0.12.0}/Cargo.toml +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/LICENSE +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/bindings/python/Cargo.lock +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/bindings/python/Cargo.toml +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/bindings/python/src/kalshi.rs +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/bindings/python/src/lib.rs +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/bindings/python/src/objects.rs +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/bindings/python/src/polymarket.rs +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/bindings/python/src/pyjson.rs +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/bindings/python/src/router.rs +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/bindings/python/src/signing.rs +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/bindings/python/src/venues.rs +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/build_backend/synpath_build.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/crates/synpath-core/Cargo.lock +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/crates/synpath-core/Cargo.toml +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/crates/synpath-core/examples/decode_timing.rs +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/crates/synpath-core/src/book.rs +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/crates/synpath-core/src/kalshi.rs +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/crates/synpath-core/src/lib.rs +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/crates/synpath-core/src/opinion.rs +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/crates/synpath-core/src/polymarket.rs +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/crates/synpath-core/src/polymarket_us.rs +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/crates/synpath-core/src/router.rs +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/crates/synpath-core/src/signing.rs +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/crates/synpath-core/src/wire.rs +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/__main__.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/_deprecated.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/_native.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/base.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/betfair.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/bucket.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/engine/__init__.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/engine/alerts.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/engine/engine.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/engine/eod.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/engine/events.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/engine/fair_values.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/engine/journal.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/engine/ledger.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/engine/orders/base.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/engine/orders/day.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/engine/orders/iceberg.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/engine/orders/oco.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/engine/orders/peg.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/engine/orders/routed.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/engine/orders/stop.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/engine/orders/twap.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/engine/paper.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/engine/reconcile.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/engine/risk.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/engine/router.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/errors.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/gemini.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/history.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/hosted.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/hosted_auth.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/hyperliquid.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/ids.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/kalshi.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/limitless.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/matchbook.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/matching.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/myriad.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/novig.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/opinion.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/polymarket.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/polymarket_us.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/predict_fun.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/prophetx.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/remote.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/server/__init__.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/server/__main__.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/server/api.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/server/errors.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/server/local.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/server/models.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/server/store.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/server/trading.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/sx_bet.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/trading/base.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/trading/errors.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/trading/hyperliquid.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/trading/hyperliquid_signing.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/trading/kalshi.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/trading/limiter.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/trading/limitless.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/trading/limitless_signing.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/trading/matchbook.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/trading/money.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/trading/novig_signing.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/trading/opinion.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/trading/opinion_signing.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/trading/polymarket.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/trading/polymarket_signing.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/trading/polymarket_us.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/trading/polymarket_us_exchange.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/trading/predict_fun.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/trading/predict_fun_signing.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/trading/prophetx.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/trading/sx_bet.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/trading/sx_bet_signing.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/types.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/ws/azuro.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/ws/base.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/ws/grpc.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/ws/hyperliquid.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/ws/kalshi.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/ws/limitless.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/ws/matchbook.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/ws/myriad.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/ws/novig.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/ws/opinion.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/ws/polymarket.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/ws/polymarket_us.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/ws/polymarket_us_exchange.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/ws/predict_fun.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/ws/prophetx.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/ws/smarkets.py +0 -0
- {synpath-0.10.0 → synpath-0.12.0}/synpath/ws/sx_bet.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: synpath
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.12.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
|
|
@@ -127,21 +127,21 @@ No silent gaps: if we weren't recording at a moment, you get the reason instead
|
|
|
127
127
|
| | [Limitless](https://limitless.exchange) | `limitless` | ✓ | ✓ | WebSocket | one book per market, both sides read it |
|
|
128
128
|
| | [SX Bet](https://sx.bet) | `sx_bet` | ✓ sports | ✓ | WebSocket | one book per market, both sides read it |
|
|
129
129
|
| | [Gemini Predictions](https://www.gemini.com/predictions) | `gemini` | ✓ no account, sports taxonomy | ✓ US accounts with Prediction Markets access | WebSocket (no key for books) | one book per contract, in YES space |
|
|
130
|
-
| | [Betfair Exchange](https://www.betfair.com/exchange) | `betfair` | ✓ your own account and app key (delayed key: 1-180 s late, 3 levels) |
|
|
131
|
-
| | [Smarkets](https://smarkets.com) | `smarkets` | ✓ no account (quotes delayed without a login) |
|
|
130
|
+
| | [Betfair Exchange](https://www.betfair.com/exchange) | `betfair` | ✓ your own account and app key (delayed key: 1-180 s late, 3 levels) | ✓ your own account and a live app key | Exchange Stream API (TLS socket) | one book per runner, back and lay read as YES |
|
|
131
|
+
| | [Smarkets](https://smarkets.com) | `smarkets` | ✓ no account (quotes delayed without a login) | ✓ your own login, with Smarkets' approved API access | polled from REST quotes | one book per contract, bids are YES bids |
|
|
132
132
|
| | [Novig](https://novig.com) | `novig` | ✓ sports, no key | ✓ (US, identity and location checks; Paper for play money) | WebSocket (trading key), else polled from the public book | one book per market, both sides read it |
|
|
133
133
|
| | [Matchbook](https://www.matchbook.com) | `matchbook` | ✓ no account | ✓ your own login | polled from REST | one book per runner, back and lay read as YES |
|
|
134
134
|
| | [ProphetX](https://www.prophetx.co) | `prophetx` | ✓ sports (Trading API key pair, or a Market Data API key) | ✓ | WebSocket (Trading API key pair) | one book per line, both sides read it |
|
|
135
135
|
| | [Azuro](https://azuro.org) | `azuro` | ✓ sports, no key | ✓ bets with a worst price | WebSocket (no key) | no book: the pool's quoted odds, one level a side sized by its limits |
|
|
136
|
-
| | [Myriad](https://myriad.markets) | `myriad` | ✓ order-book and AMM markets, sports | ✓ order book | WebSocket (no key) | one book per market, both sides read it; AMM books built from the pool |
|
|
136
|
+
| | [Myriad](https://myriad.markets) | `myriad` | ✓ order-book and AMM markets, sports | ✓ order book; AMM as market orders | WebSocket (no key) | one book per market, both sides read it; AMM books built from the pool |
|
|
137
137
|
|
|
138
|
-
Betfair is a betting exchange, not a prediction market, read here the same way: each runner (selection) is a yes/no market, `betfair:1.234567890-47972`, and the Betfair market holding the runners is the event. Every Betfair call needs your own Betfair account and application key, and the API is refused from several countries (the US, Germany, France, the Netherlands, Singapore, India, Turkey, the UAE and others). Betfair's keys are for your own betting: showing its prices to anyone else needs a data licence from Betfair. See [capabilities](docs/capabilities.md#betfair).
|
|
138
|
+
Betfair is a betting exchange, not a prediction market, read here the same way: each runner (selection) is a yes/no market, `betfair:1.234567890-47972`, and the Betfair market holding the runners is the event. Every Betfair call needs your own Betfair account and application key (betting needs Betfair's live key; the free delayed one reads), and the API is refused from several countries (the US, Germany, France, the Netherlands, Singapore, India, Turkey, the UAE and others). Betfair's keys are for your own betting: showing its prices to anyone else needs a data licence from Betfair. See [capabilities](docs/capabilities.md#betfair).
|
|
139
139
|
|
|
140
140
|
Gemini Predictions is Gemini Titan's CFTC-registered event-contract exchange. Each contract is a yes/no market named by its instrument symbol, `gemini:GEMI-NBA-2610232000-CHI-MIL-M-MIL`, and the Gemini event holding the contracts is the event. Sports events carry Gemini's taxonomy (moneyline, spread, total, prop; the sport, scope and statistic), which listings filter on. Market data needs no account; trading needs a Gemini account with Prediction Markets access (US) and an API key. See [capabilities](docs/capabilities.md#gemini).
|
|
141
141
|
|
|
142
|
-
Smarkets, a UK betting exchange, is read the same way: each contract is a yes/no market, `smarkets:164973231-456060183`, and the Smarkets market holding the contracts is the event. Its market data needs no account (quotes are delayed without a login); betting needs Smarkets' approved API access
|
|
142
|
+
Smarkets, a UK betting exchange, is read the same way: each contract is a yes/no market, `smarkets:164973231-456060183`, and the Smarkets market holding the contracts is the event. Its market data needs no account (quotes are delayed without a login); betting logs in with your own Smarkets username and password, and placing orders needs Smarkets' approved API access (a one-off £150 fee). Smarkets' API terms allow viewing prices and betting on your own account, and prohibit odds scraping. See [capabilities](docs/capabilities.md#smarkets).
|
|
143
143
|
|
|
144
|
-
Novig, a US sports exchange, lists two-outcome markets (a moneyline, a spread, a total, a Yes/No prop), each one yes/no market, `novig:01a1577c-d666-7e81-852e-68bed1446801`, under its game as the event. Its catalog, books and trades are public and need no key. Trading signs each request with a subaccount's key; Production trades real money for verified US customers outside Arizona, Michigan and Nevada, and Paper (`NOVIG_ENV=paper`) is the same API with play money. Novig's parlay RFQ
|
|
144
|
+
Novig, a US sports exchange, lists two-outcome markets (a moneyline, a spread, a total, a Yes/No prop), each one yes/no market, `novig:01a1577c-d666-7e81-852e-68bed1446801`, under its game as the event. Its catalog, books and trades are public and need no key. Trading signs each request with a subaccount's key; Production trades real money for verified US customers outside Arizona, Michigan and Nevada, and Paper (`NOVIG_ENV=paper`) is the same API with play money. Novig's parlay RFQ is supported from the liquidity provider's side: `NovigPricer` prices and last-looks parlays for a registered LP account ([trading](docs/trading.md#novig-parlay-rfq)). See [capabilities](docs/capabilities.md#novig).
|
|
145
145
|
|
|
146
146
|
Matchbook, a betting exchange licensed in the UK and Alderney, is read the same way: each runner is a yes/no market, `matchbook:<event id>-<market id>-<runner id>`, and the Matchbook market holding the runners is the event. Its market data needs no account; betting logs in with your own Matchbook username and password. Every GET is chargeable on Matchbook's API plans (£100 per million a month), and its terms allow viewing prices and betting on your own account only. See [capabilities](docs/capabilities.md#matchbook).
|
|
147
147
|
|
|
@@ -149,7 +149,7 @@ ProphetX, a US peer-to-peer sports exchange, is read the way SX Bet is: each lin
|
|
|
149
149
|
|
|
150
150
|
Azuro is an onchain sports betting protocol: a shared liquidity pool takes every bet at the odds it quotes, so there is no order book and nothing rests. A two-outcome condition ("Total Goals Over/Under 2.5") is one yes/no market, `azuro:<conditionId>`, with the lower outcome id as YES; a condition with three or more outcomes (1X2, correct score) is one market per outcome, `azuro:<conditionId>-<outcomeId>`, where only YES can be bought. The game is the event. Prices are `1 / odds`. Ids are the same on every chain; `Azuro(chain=...)` picks the pool read (Polygon USDT by default, Base WETH). Bets are EIP-712 messages signed by your wallet and placed on chain by Azuro's relayer. Azuro's bet API and streams are refused from some regions. See [capabilities](docs/capabilities.md#azuro).
|
|
151
151
|
|
|
152
|
-
Myriad runs order-book markets on BNB Chain and AMM (pool) markets on BNB Chain, Abstract and Linea behind one API. A market id carries its network, and `amm` for a pool market, since the two kinds number their markets separately: `myriad:56-2385` is an order-book market, `myriad:56-amm-2385` an unrelated pool market. Order entry
|
|
152
|
+
Myriad runs order-book markets on BNB Chain and AMM (pool) markets on BNB Chain, Abstract and Linea behind one API. A market id carries its network, and `amm` for a pool market, since the two kinds number their markets separately: `myriad:56-2385` is an order-book market, `myriad:56-amm-2385` an unrelated pool market. Order entry covers both: signed orders on the order book, and market orders against a pool, each sent as one on-chain transaction from the wallet. See [capabilities](docs/capabilities.md#myriad).
|
|
153
153
|
|
|
154
154
|
## Why Synpath
|
|
155
155
|
|
|
@@ -81,21 +81,21 @@ No silent gaps: if we weren't recording at a moment, you get the reason instead
|
|
|
81
81
|
| | [Limitless](https://limitless.exchange) | `limitless` | ✓ | ✓ | WebSocket | one book per market, both sides read it |
|
|
82
82
|
| | [SX Bet](https://sx.bet) | `sx_bet` | ✓ sports | ✓ | WebSocket | one book per market, both sides read it |
|
|
83
83
|
| | [Gemini Predictions](https://www.gemini.com/predictions) | `gemini` | ✓ no account, sports taxonomy | ✓ US accounts with Prediction Markets access | WebSocket (no key for books) | one book per contract, in YES space |
|
|
84
|
-
| | [Betfair Exchange](https://www.betfair.com/exchange) | `betfair` | ✓ your own account and app key (delayed key: 1-180 s late, 3 levels) |
|
|
85
|
-
| | [Smarkets](https://smarkets.com) | `smarkets` | ✓ no account (quotes delayed without a login) |
|
|
84
|
+
| | [Betfair Exchange](https://www.betfair.com/exchange) | `betfair` | ✓ your own account and app key (delayed key: 1-180 s late, 3 levels) | ✓ your own account and a live app key | Exchange Stream API (TLS socket) | one book per runner, back and lay read as YES |
|
|
85
|
+
| | [Smarkets](https://smarkets.com) | `smarkets` | ✓ no account (quotes delayed without a login) | ✓ your own login, with Smarkets' approved API access | polled from REST quotes | one book per contract, bids are YES bids |
|
|
86
86
|
| | [Novig](https://novig.com) | `novig` | ✓ sports, no key | ✓ (US, identity and location checks; Paper for play money) | WebSocket (trading key), else polled from the public book | one book per market, both sides read it |
|
|
87
87
|
| | [Matchbook](https://www.matchbook.com) | `matchbook` | ✓ no account | ✓ your own login | polled from REST | one book per runner, back and lay read as YES |
|
|
88
88
|
| | [ProphetX](https://www.prophetx.co) | `prophetx` | ✓ sports (Trading API key pair, or a Market Data API key) | ✓ | WebSocket (Trading API key pair) | one book per line, both sides read it |
|
|
89
89
|
| | [Azuro](https://azuro.org) | `azuro` | ✓ sports, no key | ✓ bets with a worst price | WebSocket (no key) | no book: the pool's quoted odds, one level a side sized by its limits |
|
|
90
|
-
| | [Myriad](https://myriad.markets) | `myriad` | ✓ order-book and AMM markets, sports | ✓ order book | WebSocket (no key) | one book per market, both sides read it; AMM books built from the pool |
|
|
90
|
+
| | [Myriad](https://myriad.markets) | `myriad` | ✓ order-book and AMM markets, sports | ✓ order book; AMM as market orders | WebSocket (no key) | one book per market, both sides read it; AMM books built from the pool |
|
|
91
91
|
|
|
92
|
-
Betfair is a betting exchange, not a prediction market, read here the same way: each runner (selection) is a yes/no market, `betfair:1.234567890-47972`, and the Betfair market holding the runners is the event. Every Betfair call needs your own Betfair account and application key, and the API is refused from several countries (the US, Germany, France, the Netherlands, Singapore, India, Turkey, the UAE and others). Betfair's keys are for your own betting: showing its prices to anyone else needs a data licence from Betfair. See [capabilities](docs/capabilities.md#betfair).
|
|
92
|
+
Betfair is a betting exchange, not a prediction market, read here the same way: each runner (selection) is a yes/no market, `betfair:1.234567890-47972`, and the Betfair market holding the runners is the event. Every Betfair call needs your own Betfair account and application key (betting needs Betfair's live key; the free delayed one reads), and the API is refused from several countries (the US, Germany, France, the Netherlands, Singapore, India, Turkey, the UAE and others). Betfair's keys are for your own betting: showing its prices to anyone else needs a data licence from Betfair. See [capabilities](docs/capabilities.md#betfair).
|
|
93
93
|
|
|
94
94
|
Gemini Predictions is Gemini Titan's CFTC-registered event-contract exchange. Each contract is a yes/no market named by its instrument symbol, `gemini:GEMI-NBA-2610232000-CHI-MIL-M-MIL`, and the Gemini event holding the contracts is the event. Sports events carry Gemini's taxonomy (moneyline, spread, total, prop; the sport, scope and statistic), which listings filter on. Market data needs no account; trading needs a Gemini account with Prediction Markets access (US) and an API key. See [capabilities](docs/capabilities.md#gemini).
|
|
95
95
|
|
|
96
|
-
Smarkets, a UK betting exchange, is read the same way: each contract is a yes/no market, `smarkets:164973231-456060183`, and the Smarkets market holding the contracts is the event. Its market data needs no account (quotes are delayed without a login); betting needs Smarkets' approved API access
|
|
96
|
+
Smarkets, a UK betting exchange, is read the same way: each contract is a yes/no market, `smarkets:164973231-456060183`, and the Smarkets market holding the contracts is the event. Its market data needs no account (quotes are delayed without a login); betting logs in with your own Smarkets username and password, and placing orders needs Smarkets' approved API access (a one-off £150 fee). Smarkets' API terms allow viewing prices and betting on your own account, and prohibit odds scraping. See [capabilities](docs/capabilities.md#smarkets).
|
|
97
97
|
|
|
98
|
-
Novig, a US sports exchange, lists two-outcome markets (a moneyline, a spread, a total, a Yes/No prop), each one yes/no market, `novig:01a1577c-d666-7e81-852e-68bed1446801`, under its game as the event. Its catalog, books and trades are public and need no key. Trading signs each request with a subaccount's key; Production trades real money for verified US customers outside Arizona, Michigan and Nevada, and Paper (`NOVIG_ENV=paper`) is the same API with play money. Novig's parlay RFQ
|
|
98
|
+
Novig, a US sports exchange, lists two-outcome markets (a moneyline, a spread, a total, a Yes/No prop), each one yes/no market, `novig:01a1577c-d666-7e81-852e-68bed1446801`, under its game as the event. Its catalog, books and trades are public and need no key. Trading signs each request with a subaccount's key; Production trades real money for verified US customers outside Arizona, Michigan and Nevada, and Paper (`NOVIG_ENV=paper`) is the same API with play money. Novig's parlay RFQ is supported from the liquidity provider's side: `NovigPricer` prices and last-looks parlays for a registered LP account ([trading](docs/trading.md#novig-parlay-rfq)). See [capabilities](docs/capabilities.md#novig).
|
|
99
99
|
|
|
100
100
|
Matchbook, a betting exchange licensed in the UK and Alderney, is read the same way: each runner is a yes/no market, `matchbook:<event id>-<market id>-<runner id>`, and the Matchbook market holding the runners is the event. Its market data needs no account; betting logs in with your own Matchbook username and password. Every GET is chargeable on Matchbook's API plans (£100 per million a month), and its terms allow viewing prices and betting on your own account only. See [capabilities](docs/capabilities.md#matchbook).
|
|
101
101
|
|
|
@@ -103,7 +103,7 @@ ProphetX, a US peer-to-peer sports exchange, is read the way SX Bet is: each lin
|
|
|
103
103
|
|
|
104
104
|
Azuro is an onchain sports betting protocol: a shared liquidity pool takes every bet at the odds it quotes, so there is no order book and nothing rests. A two-outcome condition ("Total Goals Over/Under 2.5") is one yes/no market, `azuro:<conditionId>`, with the lower outcome id as YES; a condition with three or more outcomes (1X2, correct score) is one market per outcome, `azuro:<conditionId>-<outcomeId>`, where only YES can be bought. The game is the event. Prices are `1 / odds`. Ids are the same on every chain; `Azuro(chain=...)` picks the pool read (Polygon USDT by default, Base WETH). Bets are EIP-712 messages signed by your wallet and placed on chain by Azuro's relayer. Azuro's bet API and streams are refused from some regions. See [capabilities](docs/capabilities.md#azuro).
|
|
105
105
|
|
|
106
|
-
Myriad runs order-book markets on BNB Chain and AMM (pool) markets on BNB Chain, Abstract and Linea behind one API. A market id carries its network, and `amm` for a pool market, since the two kinds number their markets separately: `myriad:56-2385` is an order-book market, `myriad:56-amm-2385` an unrelated pool market. Order entry
|
|
106
|
+
Myriad runs order-book markets on BNB Chain and AMM (pool) markets on BNB Chain, Abstract and Linea behind one API. A market id carries its network, and `amm` for a pool market, since the two kinds number their markets separately: `myriad:56-2385` is an order-book market, `myriad:56-amm-2385` an unrelated pool market. Order entry covers both: signed orders on the order book, and market orders against a pool, each sent as one on-chain transaction from the wallet. See [capabilities](docs/capabilities.md#myriad).
|
|
107
107
|
|
|
108
108
|
## Why Synpath
|
|
109
109
|
|
|
@@ -9,7 +9,7 @@ backend-path = ["build_backend"]
|
|
|
9
9
|
|
|
10
10
|
[project]
|
|
11
11
|
name = "synpath"
|
|
12
|
-
version = "0.
|
|
12
|
+
version = "0.12.0"
|
|
13
13
|
description = "One API for 16 prediction markets and sports exchanges: Kalshi, Polymarket, Polymarket US, Opinion, Hyperliquid, predict.fun, Limitless, SX Bet, Myriad, Gemini, Betfair, Smarkets, Novig, Matchbook, ProphetX and Azuro. Market data, streaming, self-hosted trading and smart order routing."
|
|
14
14
|
readme = "README.md"
|
|
15
15
|
requires-python = ">=3.10"
|
|
@@ -88,7 +88,7 @@ from .types import (
|
|
|
88
88
|
TradesRangeResponse,
|
|
89
89
|
)
|
|
90
90
|
|
|
91
|
-
__version__ = "0.
|
|
91
|
+
__version__ = "0.12.0"
|
|
92
92
|
|
|
93
93
|
exchanges: dict[str, type[Exchange]] = {
|
|
94
94
|
"kalshi": Kalshi,
|
|
@@ -127,7 +127,7 @@ def exchange(venue: str, **kwargs) -> Exchange:
|
|
|
127
127
|
# keeps working. Imported last, after the read API it builds on.
|
|
128
128
|
from .trading import (
|
|
129
129
|
TradingExchange, KalshiTrading, PolymarketTrading, PolymarketUSTrading, PolymarketUSExchangeTrading,
|
|
130
|
-
OpinionTrading, HyperliquidTrading, PredictFunTrading, LimitlessTrading, SxBetTrading, NovigTrading, MatchbookTrading, ProphetXTrading, AzuroTrading, MyriadTrading, GeminiTrading,
|
|
130
|
+
OpinionTrading, HyperliquidTrading, PredictFunTrading, LimitlessTrading, SxBetTrading, BetfairTrading, SmarketsTrading, NovigTrading, MatchbookTrading, ProphetXTrading, AzuroTrading, MyriadTrading, GeminiTrading,
|
|
131
131
|
Account, Balance, EditRequest, FeeEstimate, Fill, HeldBy, Liquidity,
|
|
132
132
|
Order, OrderRequest, OrderStatus, OrderType, Position, PositionSide,
|
|
133
133
|
Precision, Settlement, SettlementState, Side, TimeInForce, TriggerSource,
|
|
@@ -157,7 +157,7 @@ _STREAM_CLASSES = (
|
|
|
157
157
|
"PolymarketUSExchangeMarketDataStream", "PolymarketUSExchangeBalanceLedgerStream",
|
|
158
158
|
"OpinionMarketStream", "OpinionUserStream", "HyperliquidMarketStream", "HyperliquidUserStream",
|
|
159
159
|
"PredictFunMarketStream", "PredictFunUserStream", "LimitlessMarketStream", "LimitlessUserStream", "SxBetMarketStream", "SxBetUserStream",
|
|
160
|
-
"BetfairMarketStream", "SmarketsMarketStream", "NovigMarketStream", "NovigUserStream", "MatchbookMarketStream", "ProphetXMarketStream", "ProphetXUserStream", "AzuroMarketStream", "MyriadMarketStream", "MyriadUserStream", "GeminiMarketStream", "GeminiUserStream",
|
|
160
|
+
"BetfairMarketStream", "BetfairUserStream", "SmarketsMarketStream", "NovigMarketStream", "NovigUserStream", "MatchbookMarketStream", "ProphetXMarketStream", "ProphetXUserStream", "AzuroMarketStream", "MyriadMarketStream", "MyriadUserStream", "GeminiMarketStream", "GeminiUserStream", "GeminiRfqStream",
|
|
161
161
|
)
|
|
162
162
|
_SERVER_NAMES = ("create_app", "create_trading_app", "VenueRegistry", "ControlStore", "Principal")
|
|
163
163
|
|
|
@@ -196,7 +196,7 @@ __all__ = [
|
|
|
196
196
|
"MarketNotFound", "NotSupported", "AuthenticationError",
|
|
197
197
|
# order entry
|
|
198
198
|
"TradingExchange", "KalshiTrading", "PolymarketTrading", "PolymarketUSTrading", "PolymarketUSExchangeTrading",
|
|
199
|
-
"OpinionTrading", "HyperliquidTrading", "PredictFunTrading", "LimitlessTrading", "SxBetTrading", "NovigTrading", "MatchbookTrading", "ProphetXTrading", "AzuroTrading", "MyriadTrading", "GeminiTrading",
|
|
199
|
+
"OpinionTrading", "HyperliquidTrading", "PredictFunTrading", "LimitlessTrading", "SxBetTrading", "BetfairTrading", "SmarketsTrading", "NovigTrading", "MatchbookTrading", "ProphetXTrading", "AzuroTrading", "MyriadTrading", "GeminiTrading",
|
|
200
200
|
"Account", "Balance", "EditRequest", "FeeEstimate", "Fill", "HeldBy", "Liquidity",
|
|
201
201
|
"Order", "OrderRequest", "OrderStatus", "OrderType", "Position", "PositionSide",
|
|
202
202
|
"Precision", "Settlement", "SettlementState", "Side", "TimeInForce", "TriggerSource",
|
|
@@ -115,7 +115,7 @@ CHAINS: dict[str, Chain] = {
|
|
|
115
115
|
core="0xF9548Be470A4e130c90ceA8b179FCD66D2972AC7", relayer="0x8dA05c0021e6b35865FDC959c54dCeF3A4AbBa9d",
|
|
116
116
|
lp="0x0FA7FB5407eA971694652E6E16C12A52625DE1b8", cashout="0x4a2BB4211cCF9b9eA6eF01D0a61448154ED19095",
|
|
117
117
|
token="0xc2132d05d31c914a87c6611c10748aeb04b58e8f", symbol="USDT", decimals=6,
|
|
118
|
-
rpc_url="https://polygon-rpc.com",
|
|
118
|
+
rpc_url="https://polygon-bor-rpc.publicnode.com",
|
|
119
119
|
),
|
|
120
120
|
"base": Chain(
|
|
121
121
|
"base", 8453, "BaseWETH", "base",
|
|
@@ -690,6 +690,20 @@ class Azuro(Exchange):
|
|
|
690
690
|
rows = (data or {}).get("conditions") or [] if isinstance(data, dict) else []
|
|
691
691
|
return [r for r in rows if isinstance(r, dict) and r.get("conditionId")]
|
|
692
692
|
|
|
693
|
+
def fetch_conditions(self, condition_ids: list[str]) -> dict[str, dict[str, Any]]:
|
|
694
|
+
"""Many conditions by id, each as its game's condition listing has it
|
|
695
|
+
(`/market-manager/conditions-by-game-ids`): state, outcomes and odds,
|
|
696
|
+
the game, and `isExpressForbidden`. A condition whose id names no game
|
|
697
|
+
is read from the condition batch, without those last two."""
|
|
698
|
+
wanted = list(dict.fromkeys(str(c) for c in condition_ids))
|
|
699
|
+
games = list(dict.fromkeys(g for g in (game_of_condition(c) for c in wanted) if g))
|
|
700
|
+
found = {str(row["conditionId"]): row for rows in self._conditions(games).values() for row in rows
|
|
701
|
+
if str(row["conditionId"]) in wanted}
|
|
702
|
+
missing = [c for c in wanted if c not in found]
|
|
703
|
+
if missing:
|
|
704
|
+
found.update({str(row["conditionId"]): row for row in self.fetch_condition_states(missing)})
|
|
705
|
+
return {c: found[c] for c in wanted if c in found}
|
|
706
|
+
|
|
693
707
|
def condition_outcomes(self, condition_ids: list[str]) -> dict[str, list[str]]:
|
|
694
708
|
"""Each condition's outcome ids, lowest first: what decides its
|
|
695
709
|
markets' ids and which outcome is YES."""
|
|
@@ -388,6 +388,16 @@ def _novig(creds: Credentials) -> TradingExchange:
|
|
|
388
388
|
return NovigTrading(creds) # type: ignore[arg-type]
|
|
389
389
|
|
|
390
390
|
|
|
391
|
+
def _betfair(creds: Credentials) -> TradingExchange:
|
|
392
|
+
from .trading.betfair import BetfairTrading
|
|
393
|
+
return BetfairTrading(creds) # type: ignore[arg-type]
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
def _smarkets(creds: Credentials) -> TradingExchange:
|
|
397
|
+
from .trading.smarkets import SmarketsTrading
|
|
398
|
+
return SmarketsTrading(creds) # type: ignore[arg-type]
|
|
399
|
+
|
|
400
|
+
|
|
391
401
|
def _matchbook(creds: Credentials) -> TradingExchange:
|
|
392
402
|
from .trading.matchbook import MatchbookTrading
|
|
393
403
|
return MatchbookTrading(creds) # type: ignore[arg-type]
|
|
@@ -417,6 +427,8 @@ _TRADING = {
|
|
|
417
427
|
"kalshi": _kalshi, "polymarket": _polymarket, "polymarket_us": _polymarket_us, "opinion": _opinion,
|
|
418
428
|
"hyperliquid": _hyperliquid, "predict_fun": _predict_fun, "limitless": _limitless, "sx_bet": _sx_bet,
|
|
419
429
|
"novig": _novig,
|
|
430
|
+
"betfair": _betfair,
|
|
431
|
+
"smarkets": _smarkets,
|
|
420
432
|
"matchbook": _matchbook,
|
|
421
433
|
"prophetx": _prophetx,
|
|
422
434
|
"azuro": _azuro,
|
|
@@ -66,6 +66,8 @@ ADAPTERS = {
|
|
|
66
66
|
"limitless": ("..trading.limitless", "LimitlessTrading"),
|
|
67
67
|
"sx_bet": ("..trading.sx_bet", "SxBetTrading"),
|
|
68
68
|
"novig": ("..trading.novig", "NovigTrading"),
|
|
69
|
+
"betfair": ("..trading.betfair", "BetfairTrading"),
|
|
70
|
+
"smarkets": ("..trading.smarkets", "SmarketsTrading"),
|
|
69
71
|
"matchbook": ("..trading.matchbook", "MatchbookTrading"),
|
|
70
72
|
"prophetx": ("..trading.prophetx", "ProphetXTrading"),
|
|
71
73
|
"azuro": ("..trading.azuro", "AzuroTrading"),
|
|
@@ -182,23 +184,28 @@ async def run(args: argparse.Namespace) -> int:
|
|
|
182
184
|
loop.create_task(_status_loop(engine, float(config.get("status_interval_s", 60))), name="status"),
|
|
183
185
|
]
|
|
184
186
|
waiter = loop.create_task(stopping.wait())
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
187
|
+
failure = None
|
|
188
|
+
try:
|
|
189
|
+
done, _ = await asyncio.wait([*tasks, waiter], return_when=asyncio.FIRST_COMPLETED)
|
|
190
|
+
failure = next((t for t in done if t is not waiter and t.exception()), None)
|
|
191
|
+
if failure is not None:
|
|
192
|
+
log.error("synpath.engine: %s stopped the engine: %s", failure.get_name(), failure.exception())
|
|
193
|
+
finally:
|
|
194
|
+
# Also when Ctrl-C cancels this coroutine rather than setting `stopping`,
|
|
195
|
+
# which is what it does where the loop takes no signal handlers (Windows).
|
|
196
|
+
for task in tasks:
|
|
197
|
+
task.cancel()
|
|
198
|
+
if config.get("halt_on_exit", True):
|
|
199
|
+
await engine.halt("the engine is shutting down", policy=engine_config.halt_policy)
|
|
200
|
+
if feeds is not None:
|
|
201
|
+
await feeds.close()
|
|
202
|
+
await engine.stop()
|
|
203
|
+
for adapter in adapters.values():
|
|
204
|
+
try:
|
|
205
|
+
await adapter.close()
|
|
206
|
+
except Exception:
|
|
207
|
+
pass
|
|
208
|
+
print("engine stopped; the lease is released")
|
|
202
209
|
return 0 if failure is None else 4
|
|
203
210
|
|
|
204
211
|
|
|
@@ -168,10 +168,14 @@ def _trading_streams(adapters: Mapping[str, Any], credentials: Mapping[str, Any]
|
|
|
168
168
|
private=MyriadUserStream(address=address, token=token) if address and token else None,
|
|
169
169
|
)
|
|
170
170
|
elif venue == "betfair" and creds is not None:
|
|
171
|
-
#
|
|
172
|
-
#
|
|
173
|
-
from ..ws.betfair import BetfairMarketStream
|
|
174
|
-
|
|
171
|
+
# Every Betfair stream, books included, logs in with the account;
|
|
172
|
+
# both share the trading adapter's session, so one login serves all.
|
|
173
|
+
from ..ws.betfair import BetfairMarketStream, BetfairUserStream
|
|
174
|
+
session = getattr(adapter, "session", None)
|
|
175
|
+
out[venue] = VenueStreams(
|
|
176
|
+
market=BetfairMarketStream(credentials=creds, session=session),
|
|
177
|
+
private=BetfairUserStream(credentials=creds, session=session),
|
|
178
|
+
)
|
|
175
179
|
elif venue == "gemini":
|
|
176
180
|
# Books are public; the account stream signs its handshake with
|
|
177
181
|
# the API key, which must be account-scoped and time-based.
|
|
@@ -182,11 +186,13 @@ def _trading_streams(adapters: Mapping[str, Any], credentials: Mapping[str, Any]
|
|
|
182
186
|
private=GeminiUserStream(creds) if creds is not None else None,
|
|
183
187
|
)
|
|
184
188
|
elif venue == "smarkets":
|
|
185
|
-
#
|
|
186
|
-
#
|
|
187
|
-
#
|
|
189
|
+
# A polled stream on REST quotes (Smarkets' socket stream is for
|
|
190
|
+
# approved market makers), on the trading adapter's session when
|
|
191
|
+
# there is one, so the login undelays the quotes. No account
|
|
192
|
+
# stream; the engine polls the orders.
|
|
188
193
|
from ..ws.smarkets import SmarketsMarketStream
|
|
189
|
-
|
|
194
|
+
session = getattr(adapter, "session", None)
|
|
195
|
+
out[venue] = VenueStreams(market=SmarketsMarketStream(credentials=creds, session=session), private=None)
|
|
190
196
|
elif venue == "novig":
|
|
191
197
|
# The websocket takes a subaccount's trading key; without one the
|
|
192
198
|
# market stream polls the public book.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Stops (market, limit, trailing), icebergs, one-cancels-the-other and
|
|
4
4
|
brackets, TWAP, pegs, and the two taking types: an engine-held market order
|
|
5
|
-
that walks the book inside a price bound, and a
|
|
5
|
+
that walks the book inside a price bound, and a clip taker that does it in
|
|
6
6
|
clips over time. Day is not here: it is rewritten to a venue-held GTD at the
|
|
7
7
|
session end, because an expiry must outlive the process (`day.py`).
|
|
8
8
|
|
|
@@ -32,11 +32,11 @@ from .oco import OCO, Bracket
|
|
|
32
32
|
from .peg import Peg
|
|
33
33
|
from .routed import RoutedLimit
|
|
34
34
|
from .stop import StopLimit, StopMarket, TrailingStop
|
|
35
|
-
from .taker import MarketOrder,
|
|
35
|
+
from .taker import MarketOrder, ClipTaker
|
|
36
36
|
from .twap import TWAP
|
|
37
37
|
|
|
38
38
|
__all__ = [
|
|
39
39
|
"ManagedOrder", "ManagedOrders", "Context", "Child", "State", "register", "REGISTRY",
|
|
40
40
|
"StopMarket", "StopLimit", "TrailingStop", "Iceberg", "OCO", "Bracket", "TWAP", "Peg",
|
|
41
|
-
"MarketOrder", "
|
|
41
|
+
"MarketOrder", "ClipTaker", "as_gtd", "session_expiry",
|
|
42
42
|
]
|
|
@@ -24,7 +24,7 @@ import logging
|
|
|
24
24
|
from decimal import Decimal
|
|
25
25
|
from typing import Any, Iterable, Mapping, Type
|
|
26
26
|
|
|
27
|
-
from ...trading.types import Fill, Order, OrderRequest, OrderType
|
|
27
|
+
from ...trading.types import LEGACY_CLIP_TAKER, Fill, Order, OrderRequest, OrderType
|
|
28
28
|
from .base import Child, Context, ManagedOrder, State, now_ms
|
|
29
29
|
|
|
30
30
|
log = logging.getLogger("synpath.engine.orders")
|
|
@@ -211,7 +211,8 @@ class ManagedOrders:
|
|
|
211
211
|
"""Bring back every parent that was still live, after a restart."""
|
|
212
212
|
restored = 0
|
|
213
213
|
for snapshot in await self.engine.journal.managed(states=("waiting", "working", "cancelling")):
|
|
214
|
-
|
|
214
|
+
kind = snapshot.get("kind", "")
|
|
215
|
+
cls = REGISTRY.get("clip_taker" if kind == LEGACY_CLIP_TAKER else kind)
|
|
215
216
|
if cls is None:
|
|
216
217
|
log.warning("synpath.engine.orders: no implementation for %s; leaving %s alone",
|
|
217
218
|
snapshot.get("kind"), snapshot.get("id"))
|
|
@@ -9,7 +9,7 @@ protection price or when `max_slippage` from the first touch is spent. What
|
|
|
9
9
|
it cannot buy within that range it reports unfilled, because the alternative
|
|
10
10
|
is paying any price at all.
|
|
11
11
|
|
|
12
|
-
**
|
|
12
|
+
**Clip taker** is the same walk with patience: clips of `clip` contracts,
|
|
13
13
|
`interval_s` apart, up to `limit`. It exists because taking two hundred
|
|
14
14
|
contracts in one clip pays for depth that would have refilled in thirty
|
|
15
15
|
seconds. Between clips it does nothing, which is the point; if the market
|
|
@@ -133,11 +133,11 @@ class MarketOrder(_Taker):
|
|
|
133
133
|
|
|
134
134
|
|
|
135
135
|
@register
|
|
136
|
-
class
|
|
136
|
+
class ClipTaker(_Taker):
|
|
137
137
|
"""`params`: `clip`, `interval_s`, `limit`, `max_slippage`, `expires_s`."""
|
|
138
138
|
|
|
139
|
-
kind = "
|
|
140
|
-
order_type = OrderType.
|
|
139
|
+
kind = "clip_taker"
|
|
140
|
+
order_type = OrderType.CLIP_TAKER
|
|
141
141
|
|
|
142
142
|
def __init__(self, *args: Any, **kwargs: Any):
|
|
143
143
|
super().__init__(*args, **kwargs)
|
|
@@ -35,8 +35,8 @@ from . import local
|
|
|
35
35
|
|
|
36
36
|
log = logging.getLogger("synpath.serve")
|
|
37
37
|
|
|
38
|
-
VENUES = ("kalshi", "polymarket", "polymarket_us", "opinion", "hyperliquid", "predict_fun", "limitless", "sx_bet", "
|
|
39
|
-
"matchbook", "prophetx", "azuro", "myriad", "gemini")
|
|
38
|
+
VENUES = ("kalshi", "polymarket", "polymarket_us", "opinion", "hyperliquid", "predict_fun", "limitless", "sx_bet", "betfair",
|
|
39
|
+
"smarkets", "novig", "matchbook", "prophetx", "azuro", "myriad", "gemini")
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
def venues_config(config: dict[str, Any], credentials: dict[str, Any]) -> dict[str, Any]:
|
|
@@ -7,8 +7,8 @@ by how much) and the rate limits are lower; every book and quote read here
|
|
|
7
7
|
records which in its `info` (`delayed`). An optional login
|
|
8
8
|
(`SMARKETS_USERNAME`, `SMARKETS_PASSWORD`) sends a session token for
|
|
9
9
|
undelayed quotes and the account's own limits; see `SmarketsSession`.
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
Order entry is `synpath.trading.smarkets.SmarketsTrading`, on the same login;
|
|
11
|
+
placing orders needs approved API access from Smarkets (a one-off £150 fee).
|
|
12
12
|
|
|
13
13
|
Five things about this venue that shape the adapter:
|
|
14
14
|
|
|
@@ -84,6 +84,12 @@ def __getattr__(name: str):
|
|
|
84
84
|
if name == "NovigTrading":
|
|
85
85
|
from .novig import NovigTrading
|
|
86
86
|
return NovigTrading
|
|
87
|
+
if name == "BetfairTrading":
|
|
88
|
+
from .betfair import BetfairTrading
|
|
89
|
+
return BetfairTrading
|
|
90
|
+
if name == "SmarketsTrading":
|
|
91
|
+
from .smarkets import SmarketsTrading
|
|
92
|
+
return SmarketsTrading
|
|
87
93
|
if name == "MatchbookTrading":
|
|
88
94
|
from .matchbook import MatchbookTrading
|
|
89
95
|
return MatchbookTrading
|
|
@@ -105,7 +111,8 @@ def __getattr__(name: str):
|
|
|
105
111
|
__all__ = [
|
|
106
112
|
"TradingExchange", "KalshiTrading", "PolymarketTrading", "PolymarketUSTrading", "PolymarketUSExchangeTrading",
|
|
107
113
|
"OpinionTrading", "HyperliquidTrading", "PredictFunTrading", "LimitlessTrading", "SxBetTrading", "NovigTrading",
|
|
108
|
-
"MatchbookTrading", "ProphetXTrading", "AzuroTrading", "MyriadTrading",
|
|
114
|
+
"BetfairTrading", "SmarketsTrading", "MatchbookTrading", "ProphetXTrading", "AzuroTrading", "MyriadTrading",
|
|
115
|
+
"GeminiTrading",
|
|
109
116
|
"Account", "Balance", "EditRequest", "FeeEstimate", "Fill", "HeldBy", "Liquidity",
|
|
110
117
|
"Order", "OrderRequest", "OrderStatus", "OrderType", "Position", "PositionSide",
|
|
111
118
|
"Precision", "Settlement", "SettlementState", "Side", "TimeInForce", "TriggerSource",
|
|
@@ -61,9 +61,9 @@ def doctor(dotenv: str | None) -> int:
|
|
|
61
61
|
for venue, creds in loaded.items():
|
|
62
62
|
if creds is None and venue == "smarkets":
|
|
63
63
|
# Optional: Smarkets serves its market data without a login.
|
|
64
|
-
rows.append((venue, "
|
|
65
|
-
"SMARKETS_PASSWORD for undelayed quotes, or run synpath init.
|
|
66
|
-
"approved API access
|
|
64
|
+
rows.append((venue, "not configured", "market data needs no login; set SMARKETS_USERNAME / "
|
|
65
|
+
"SMARKETS_PASSWORD to bet and for undelayed quotes, or run synpath init. Placing orders "
|
|
66
|
+
"needs Smarkets' approved API access"))
|
|
67
67
|
continue
|
|
68
68
|
if creds is None and venue == "matchbook":
|
|
69
69
|
# Market data is public; the login is for betting.
|
|
@@ -130,7 +130,7 @@ def doctor(dotenv: str | None) -> int:
|
|
|
130
130
|
# The application key is a secret too; the username names the account.
|
|
131
131
|
stage = creds.jurisdiction
|
|
132
132
|
login = "certificate" if creds.cert_path else "interactive"
|
|
133
|
-
identity = f"user {creds.username}, app key loaded, {login} login"
|
|
133
|
+
identity = f"user {creds.username}, app key loaded, {login} login (betting needs a live key)"
|
|
134
134
|
elif venue == "prophetx":
|
|
135
135
|
stage = "sandbox" if creds.sandbox else "production"
|
|
136
136
|
affiliate = "; affiliate key loaded: market data from the Market Data API" if creds.affiliate_key else ""
|
|
@@ -144,7 +144,7 @@ def doctor(dotenv: str | None) -> int:
|
|
|
144
144
|
identity = f"api key {creds.api_key[:12]}…{sub} (account-scoped, time-based nonce for streams)"
|
|
145
145
|
elif venue == "smarkets":
|
|
146
146
|
stage = "login"
|
|
147
|
-
identity = f"user {creds.username}: undelayed quotes;
|
|
147
|
+
identity = f"user {creds.username}: undelayed quotes and the account; placing orders needs approved API access"
|
|
148
148
|
elif venue == "matchbook":
|
|
149
149
|
stage = "login"
|
|
150
150
|
identity = f"user {creds.username}"
|