Skip to content

Sync main into the experimental line (#32, #33) - #35

Merged
YukiC0804 merged 13 commits into
codex/order-lifecycle-storagefrom
sp/sync-main-into-experimental
Oct 21, 2026
Merged

YukiC0804 merged 13 commits into
codex/order-lifecycle-storagefrom
sp/sync-main-into-experimental

Conversation

@YukiC0804

Copy link
Copy Markdown
Collaborator

Merges main into codex/order-lifecycle-storage, so the experimental line (and the terminal, after the cascade) gets:

The merge into the base branch is clean, with no conflicts. Full suite: 2574 passed, 85 skipped.

This is a one-way sync. Nothing from the experimental line goes to main.

Next: carry this up the stack. Merge the base into #30 (sp/serve-parity) and then #31 (sp/order-gaps). #30 restructured serve.py and engine/feeds.py, so the API-key-only stream wiring from #32 has to be fitted into that structure; this is done in those PRs. The Python 3.10 timestamp fix (#34) joins with the next sync.

🤖 Generated with Claude Code

YukiC0804 and others added 13 commits October 15, 2026 12:29
The README opening named 4 venues and the PyPI description 2, while the
library supports Kalshi, Polymarket, Polymarket US, Opinion, Hyperliquid,
predict.fun, Limitless and SX Bet. Keywords gain the newer venues.
Revert PRE-1 direct-to-main change
fix: align historical SDK docs and replay with venue time (PRE-1)
…X Bet

These venues serve books to an API key with no wallet behind it, but setup
and loading treated the private key as the venue's marker, so a user who
only reads prices could not get their streams or, for predict.fun, search.

- synpath init asks for the API key first and takes an empty private key,
  writing only OPINION_API_KEY / PREDICT_FUN_API_KEY / SX_BET_API_KEY. An
  Opinion key already held needs no private key; creating one still does.
  Every venue's prompt now says what it needs for market data vs trading,
  where to get it and its format, and a pasted 0x address is told apart
  from a private key.
- credentials.load_market_data loads the API key alone (MarketDataKey);
  trading still requires the full set, and require() says why.
- feeds.default_streams builds a market-only stream for those venues, so
  synpath serve streams their books with just the API key.
- serve hands the read app's adapters the keys from its --dotenv, so search
  no longer answers 502 when serve runs from another folder.
- SxBet takes an optional api_key and sends x-sx-api-key (the venue documents
  its book snapshots as keyed); doctor reports market-data-only venues.
- docs/trading.md, docs/streaming.md and .env.example say per venue what
  market data and trading need.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SX Bet authorizes the account's reads, every cancel and the heartbeat by
the x-sx-api-key header; only POST /orders-v3 also needs the wallet's
EIP-712 signature. The adapter built its signer up front, so nothing worked
without the private key.

- SxBetCredentials loads from SX_BET_API_KEY alone; SX_BET_PRIVATE_KEY is
  optional, and SX_BET_ACCOUNT_ADDRESS (validated as a 0x address, and
  checked against the private key when both are set) names the account.
- SxBetTrading makes the signer optional. Placing without a private key
  raises CredentialsMissing before any request. cancel_all_orders repeats
  while the venue answers hasMore, as its reference says.
- The venue documents no route that returns a key's owner, so the address
  comes from the private key or SX_BET_ACCOUNT_ADDRESS. Without either,
  feeds skip the account stream with a warning and the engine polls.
- synpath init and doctor say the API key covers market data, the account
  and cancels, and the private key covers placing orders only. Docs and
  .env.example updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fix: market data from an API key alone for Opinion, predict.fun and SX Bet
Two betting exchanges as venues, read side only. Each runner or contract is a
binary YES/NO market (betfair:<marketId>-<selectionId>,
smarkets:<marketId>-<contractId>) and the exchange market is its event, the
way multi-outcome events already work.

Betfair (betfair): interactive and certificate login with session keep-alive,
catalogue, events and books batched under the request-weight limit, the
CLASSIC odds ladder, a net-market-winnings commission fee type, and an
Exchange Stream API client over TLS. Built for the free delayed app key:
books are marked delayed and the stream warns that it is conflated to three
minutes. Back offers are YES asks at 1/odds and lay offers YES bids.

Smarkets (smarkets): public market data with no login (events, markets,
contracts, quotes, volumes, last prices, states, recent trades, search),
prices in basis points and quantities in 1/10,000 of a pound contract, 2%
commission on net winnings, an optional session login, and a polled market
stream, since push streaming is for approved API users only.

Neither venue trades yet; Client.trading() says so. init and doctor say what
each credential is for. Docs cover the delayed data, API region blocks and
the licence terms on showing prices to others.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add Betfair Exchange and Smarkets (market data and streams)
Brings the API-key-only market data (#32) and the Betfair and Smarkets
venues (#33) into codex/order-lifecycle-storage. Clean merge, no conflicts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@YukiC0804
YukiC0804 merged commit 7f73b77 into codex/order-lifecycle-storage Oct 21, 2026
4 of 5 checks passed
YukiC0804 pushed a commit that referenced this pull request Oct 21, 2026
Keeps #30's venue_streams / market_stream / MarketStreams structure and fits
main into it:

- venue_streams accepts a MarketDataKey (Opinion, predict.fun, SX Bet) and
  builds the market stream alone from it, with a keyed catalog where no
  adapter supplies one; market_stream and default_streams(market_data) go
  through it.
- Betfair and Smarkets market streams (Smarkets without credentials).
- SX Bet's account stream only with an account address, warning otherwise.
- serve always loads market_data, passes it to default_streams and to the
  /ws/market factory, and gives the read app's default VenueRegistry its
  dotenv keys; #30's auth dependency, hosted routes and buckets stay.
- The dotenv read-app test sends serve's access token.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants