docs: update README to match current SDK API#2
Conversation
Bring REST, WebSocket, trade type, webhook, and alerts documentation in line with v0.6.7: add analytics and builders namespaces, document new methods, fix incorrect examples, and expand the WebSocket rooms table. Co-authored-by: Elliot <elliotdotsol@users.noreply.github.com>
📝 WalkthroughWalkthroughThe README is expanded with new REST API endpoint examples across markets, traders, holders, series, tags, assets, and bonds. Webhook creation shape is updated and additional operations added. WebSocket subscription and event listener examples gain new rooms and handlers. The available alerts rooms table is rewritten, and ChangesREADME API Documentation Updates
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 markdownlint-cli2 (0.22.1)README.mdmarkdownlint-cli2 wrapper config was not available before execution Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
README.md (1)
168-201: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winSplit trade vs oracle-event wording.
getOracleEventsis not a trade endpoint, so this lead-in blurs two different API families. Rephrase the section or movegetOracleEventsout so readers don’t assume the trade and oracle payloads are interchangeable.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@README.md` around lines 168 - 201, The README section currently groups `getTrades`, `getTraderTrades`, and `getOracleEvents` under “Trade endpoints,” which incorrectly suggests oracle events are trade payloads. Update the wording in this section so `getOracleEvents` is described separately from the trade endpoints, while keeping the `trade_type` narrowing example and the `MarketTrade`, `OracleEvent`, and `TradeEventType` exports clearly associated with their respective API families.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@README.md`:
- Around line 337-358: The room table for polymarket_trader_pnl uses wildcard
event patterns instead of concrete listener names, which can mislead consumers
into using invalid ws.on strings. Update the event list in the README table to
either expand `trader_*_tick_batch` and `trader_*_resolution_batch` into the
exact event names or clearly mark them as event families, and keep the rest of
the `polymarket_trader_pnl` entry consistent with the actual emitted event
names.
---
Outside diff comments:
In `@README.md`:
- Around line 168-201: The README section currently groups `getTrades`,
`getTraderTrades`, and `getOracleEvents` under “Trade endpoints,” which
incorrectly suggests oracle events are trade payloads. Update the wording in
this section so `getOracleEvents` is described separately from the trade
endpoints, while keeping the `trade_type` narrowing example and the
`MarketTrade`, `OracleEvent`, and `TradeEventType` exports clearly associated
with their respective API families.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
| | Room | Filters | Events | | ||
| |------|---------|--------| | ||
| | `polymarket_trades` | `condition_ids?`, `market_slugs?`, `event_slugs?`, `position_ids?`, `traders?`, `trade_types?`, `status?`, `subscribe_all?` | `trade_stream_update` | | ||
| | `polymarket_asset_prices` | `asset_symbols?` | `asset_price_tick`, `asset_price_window_update` | | ||
| | `polymarket_asset_window_updates` | `asset_symbols?`, `timeframes?` | `asset_window_update` | | ||
| | `polymarket_market_metrics` | `condition_ids` | `market_metrics_update` | | ||
| | `polymarket_event_metrics` | `event_slugs` | `event_metrics_update` | | ||
| | `polymarket_position_metrics` | `position_ids` | `position_metrics_update` | | ||
| | `polymarket_trader_pnl` | `traders` | `trader_global_pnl_update`, `trader_market_pnl_update`, `trader_event_pnl_update` | | ||
| | `polymarket_trader_positions` | `traders` | `trader_position_update` | | ||
| | `polymarket_accounts` | `wallets`, `include_usdce?`, `include_matic?` | `accounts_update`, `usdce_update`, `matic_update` | | ||
| | `polymarket_market_metrics` | `condition_ids`, `timeframes?` | `market_metrics_update` | | ||
| | `polymarket_event_metrics` | `event_slugs`, `timeframes?` | `event_metrics_update` | | ||
| | `polymarket_position_metrics` | `position_ids`, `timeframes?` | `position_metrics_update` | | ||
| | `polymarket_tag_metrics` | `tags`, `timeframes?` | `tag_metrics_update` | | ||
| | `polymarket_trader_pnl` | `traders`, `update_types?`, `timeframes?`, `dirty_kinds?` | `trader_global_pnl_batch`, `trader_market_pnl_batch`, `trader_category_pnl_batch`, `trader_*_tick_batch`, `trader_*_resolution_batch` | | ||
| | `polymarket_trader_positions` | `traders`, `dirty_kinds?` | `trader_position_batch`, `trader_position_price_batch`, `trader_position_resolution_batch` | | ||
| | `polymarket_trader_pnl_exits` | `traders`, `reasons?` | `trader_exit_marker_batch` | | ||
| | `polymarket_holder_metrics` | `position_ids?`, `condition_ids?`, `event_slugs?` | `holder_metrics_position_batch`, `holder_metrics_condition_batch`, `holder_metrics_event_batch` | | ||
| | `polymarket_accounts` | `wallets`, `include_usdce?`, `include_pusd?`, `include_matic?` | `accounts_update`, `usdce_update`, `pusd_update`, `matic_update` | | ||
| | `polymarket_order_book` | `condition_ids?`, `position_ids?` | `order_book_update` | | ||
| | `polymarket_clob_rewards` | `condition_ids?`, `subscribe_all?` | `clob_rewards_update` | | ||
| | `polymarket_events_stream` | `mode?`, `interval_ms?`, `filter?`, `event_slugs?`, `event_ids?` | `events_stream_update` | | ||
| | `polymarket_markets_stream` | `mode?`, `interval_ms?`, `filter?`, `condition_ids?`, `market_slugs?`, `event_slugs?` | `markets_stream_update` | | ||
| | `polymarket_oracle_events` | `condition_ids?`, `market_slugs?`, `event_slugs?`, `oracle_event_types?`, `status?`, `subscribe_all?` | `oracle_event_update` | | ||
| | `polymarket_position_liquidity` | `position_ids?` | `position_liquidity_update` | | ||
| | `polymarket_market_liquidity` | `condition_ids?` | `market_liquidity_update` | | ||
| | `polymarket_event_liquidity` | `event_slugs?` | `event_liquidity_update` | |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Use concrete event names in the room table.
Entries like trader_*_tick_batch and trader_*_resolution_batch are patterns, not listener names. Either expand them to the exact events or label them explicitly as families; otherwise consumers will copy invalid strings into ws.on(...).
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@README.md` around lines 337 - 358, The room table for polymarket_trader_pnl
uses wildcard event patterns instead of concrete listener names, which can
mislead consumers into using invalid ws.on strings. Update the event list in the
README table to either expand `trader_*_tick_batch` and
`trader_*_resolution_batch` into the exact event names or clearly mark them as
event families, and keep the rest of the `polymarket_trader_pnl` entry
consistent with the actual emitted event names.
Summary
Updates
README.mdto reflect the current SDK surface (v0.6.7).Changes
analyticsandbuildersgetTraderEventPnlcreateuses singularevent(e.g.trader_first_trade)position_ids, notasset_idsprice_spike, notprobability_spikeMakerRebate,Reward,Yieldinstead ofApproval)Test plan
A detailed high-level summary could not be generated for this review. Here is an overview derived from the analyzed file changes: