Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,11 @@ SX_BET_PRIVATE_KEY=
SX_BET_ACCOUNT_ADDRESS=
SX_BET_TESTNET=

# Betfair Exchange (market data and streams; no order entry yet): every call,
# market data included, needs your own account and application key. The free
# delayed key (1-180 s late, three price levels) is on the developer program
# page or the Accounts API visualiser. Leave the certificate paths empty for an
# Betfair Exchange (market data, streams and order entry): every call, market
# data included, needs your own account and application key. The free delayed
# key (1-180 s late, three price levels) is on the developer program page or
# the Accounts API visualiser; it reads the account but cannot bet. Betting
# needs the live key, which Betfair activates on request. Leave the certificate paths empty for an
# interactive login; set both for Betfair's certificate login. The site the
# account is on: com (default), it, es, ro or com.au. Betfair's API is refused
# from the US and several other countries, and showing its prices to others
Expand All @@ -106,11 +107,12 @@ BETFAIR_CERT_PATH=
BETFAIR_KEY_PATH=
BETFAIR_JURISDICTION=

# Smarkets (market data and a polled stream; no order entry yet): market data
# needs no login at all. A login (optional) sends a session token for
# undelayed quotes and your account's own rate limits. Betting through the API
# needs Smarkets' approved API access (a one-off £150 fee). Smarkets' API terms
# allow viewing prices and betting on your own account; odds scraping is
# Smarkets (market data, a polled stream, and order entry): market data needs
# no login at all. A login sends a session token for undelayed quotes, your
# account's own rate limits, and its orders, balance and positions; an account
# with two-factor login cannot log in from here. Placing orders through the
# API needs Smarkets' approved API access (a one-off £150 fee). Smarkets' API
# terms allow viewing prices and betting on your own account; odds scraping is
# prohibited.
SMARKETS_USERNAME=
SMARKETS_PASSWORD=
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,29 +81,29 @@ No silent gaps: if we weren't recording at a moment, you get the reason instead
| | [Limitless](https://limitless.exchange) | `limitless` | ✓ | ✓ | WebSocket | one book per market, both sides read it |
| | [SX Bet](https://sx.bet) | `sx_bet` | ✓ sports | ✓ | WebSocket | one book per market, both sides read it |
| | [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 |
| | [Betfair Exchange](https://www.betfair.com/exchange) | `betfair` | ✓ your own account and app key (delayed key: 1-180 s late, 3 levels) | — | Exchange Stream API (TLS socket) | one book per runner, back and lay read as YES |
| | [Smarkets](https://smarkets.com) | `smarkets` | ✓ no account (quotes delayed without a login) | — | polled from REST quotes | one book per contract, bids are YES bids |
| | [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 |
| | [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 |
| | [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 |
| | [Matchbook](https://www.matchbook.com) | `matchbook` | ✓ no account | ✓ your own login | polled from REST | one book per runner, back and lay read as YES |
| | [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 |
| | [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 |
| | [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 |
| | [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 |

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).
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).

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).

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, which this library does not use yet. Smarkets' API terms allow viewing prices and betting on your own account, and prohibit odds scraping. See [capabilities](docs/capabilities.md#smarkets).
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).

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, for registered liquidity providers, is not supported yet. See [capabilities](docs/capabilities.md#novig).
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).

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).

ProphetX, a US peer-to-peer sports exchange, is read the way SX Bet is: each line (a moneyline, or a spread or total at one number) is a yes/no market whose first side is YES, `prophetx:44285780-90de769f4f4977a04446ed203e957351` (the event, then the YES side's strike id), and the game is the event. Prices are American odds, converted exactly to probabilities. Every call needs a key: the Trading API key pair, which any KYC-approved ProphetX account generates under API Integration, or a Market Data API key issued by ProphetX on request. See [capabilities](docs/capabilities.md#prophetx).

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).

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 is on the order book; a pool trade is an on-chain transaction this library does not send. See [capabilities](docs/capabilities.md#myriad).
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).

## Why Synpath

Expand Down
16 changes: 12 additions & 4 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ competition, query)`, the venue's own sports and fixtures as it lists them,
and takes `event_type` (an id or a name, `"Soccer"`), `competition`, `event`
and `market_type` (`"MATCH_ODDS"`) on `fetch_markets` and `fetch_events`.
Every Betfair call needs your own account and application key; see
[Betfair](capabilities.md#betfair).
[Betfair](capabilities.md#betfair). Betting is `BetfairTrading`
([trading](trading.md#betfair)).

```python
bf = synpath.Betfair() # BETFAIR_APP_KEY, BETFAIR_USERNAME, BETFAIR_PASSWORD
Expand All @@ -113,6 +114,8 @@ with its contracts, open or settled), `fetch_smarkets_events(ids)`,
market id, and takes `domain` (`"football"`, `"politics"`), `scope`
(`"single_event"`, `"outright"`) and `market_type` (`"WINNER_3_WAY"`) on
`fetch_markets` and `fetch_events`. See [Smarkets](capabilities.md#smarkets).
Order entry is `SmarketsTrading`, with the same login; see
[trading](trading.md#smarkets).

```python
smk = synpath.Smarkets() # no account; SMARKETS_USERNAME / _PASSWORD undelay the quotes
Expand Down Expand Up @@ -176,9 +179,11 @@ Azuro needs no key. It adds `fetch_sports()` (the feed's sports, countries
and leagues with their open game counts), `fetch_limits(market_id, side)`
(the pool's minimum and maximum bet and maximum payout on one selection) and
`fetch_condition_states(condition_ids)` (fresh odds and states, without the
games), and takes `sport` and `league` (the feed's slugs, `"football"`,
games), `fetch_conditions(condition_ids)` (conditions by id with their game
and whether they may go in a combo, `isExpressForbidden`), and takes `sport` and `league` (the feed's slugs, `"football"`,
`"premier-league"`) on `fetch_markets` and `fetch_events`. `chain=` picks the
pool read: `polygon` (the default), `base`, or a testnet. See
pool read: `polygon` (the default), `base`, or a testnet. Combos and claiming
payouts are on `AzuroTrading` ([trading](trading.md#azuro)). See
[Azuro](capabilities.md#azuro).

```python
Expand All @@ -188,6 +193,7 @@ market = markets[0]
market.yes.quote.ask, market.info["odds"] # 1 / odds, and the venue's odds
azuro.fetch_limits(market.id) # {"min_bet", "max_bet", "max_payout", ...}
azuro.fetch_trades(market.id) # single bets, from the bets subgraph
azuro.fetch_conditions([market.info["condition_id"]]) # {id: condition}, isExpressForbidden and the game
```

Myriad needs no key (an API key and secret raise its rate limit). It takes
Expand All @@ -196,7 +202,9 @@ Myriad needs no key (an API key and secret raise its rate limit). It takes
`network` (56 BNB Chain, 2741 Abstract, 59144 Linea) on `fetch_markets` and
`fetch_events`, and adds `fetch_event(id)`, `fetch_topics()`, `fetch_tags(type)`
and `raw_market(id)`. Any id also takes the market's slug. See
[Myriad](capabilities.md#myriad).
[Myriad](capabilities.md#myriad). Both kinds trade through `MyriadTrading`:
order-book markets with signed orders, AMM markets as market orders sent on
chain ([Trading](trading.md#myriad)).

```python
myriad = synpath.Myriad() # no key needed
Expand Down
Loading
Loading