-
Notifications
You must be signed in to change notification settings - Fork 4
[CP-575] add depth parameter orderbooks v2 requests #180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CP-575] add depth parameter orderbooks v2 requests #180
Conversation
WalkthroughDocumentation updated to add a required Integer parameter depth (“The depth of the orderbook”) to request parameter tables in derivatives and spot RPC docs. No code, behavior, or public API signatures were modified. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
source/includes/_derivativesrpc.md (1)
3086-3086: Clarify “depth” semantics and reconcile with examples using depth=0.Good addition. Two follow-ups will prevent confusion:
- Specify the valid range and meaning clearly (e.g., “positive integer number of price levels per side (best N bids and asks)”). If 0 is supported as a sentinel (full book or default), document it; otherwise, enforce “>= 1”.
- In this same file, the StreamOrderbookUpdate example sets depth := 0 when calling GetDerivativeOrderbooksV2 (Line 3665). That conflicts with “Required: Yes” and typical “>= 1” expectations. Either change the example to a positive value or document 0’s behavior and consider marking “Required” accordingly.
Suggested wording tweak for this row:
-| depth | Integer | The depth of the orderbook | Yes | +| depth | Integer | Number of price levels per side to return (best N bids and asks). Must be a positive integer. | Yes |If 0 is intentionally allowed, adjust instead:
-| depth | Integer | The depth of the orderbook | Yes | +| depth | Integer | Number of price levels per side to return. Use 0 for the backend default/full depth (if supported). | Yes |Additionally, update the example that currently uses 0:
// in StreamOrderbookUpdate example - depth := int32(0) + depth := int32(1)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
source/includes/_derivativesrpc.md(1 hunks)source/includes/_spotrpc.md(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: Redirect rules - injective-docs
- GitHub Check: Header rules - injective-docs
- GitHub Check: test (3.2)
- GitHub Check: test (2.7)
- GitHub Check: Pages changed - injective-docs
| | Parameter | Type | Description | Required | | ||
| | ---------- | ------------ | ------------------------------------------------------ | -------- | | ||
| | market_ids | String Array | List of IDs of markets to get orderbook snapshots from | Yes | | ||
| | depth | Integer | The depth of the orderbook | Yes | | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Clarify depth semantics (0 = full depth, per-side, truncation) and align wording across docs
The current description is vague. Given other examples in this file use depth=0 to fetch a full snapshot, please state that explicitly, note that depth is per side, and mention truncation to any server-defined max. Also ensure the same phrasing is used in derivatives docs for consistency.
Apply this diff to improve the description:
-| depth | Integer | The depth of the orderbook | Yes |
+| depth | Integer | Maximum number of price levels to return per side; 0 returns full depth. Values above the server-defined maximum are truncated. | Yes |Run this script to verify consistency of the “depth” parameter wording across Spot and Derivatives OrderbooksV2 docs:
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== Checking OrderbooksV2 sections =="
rg -n -C2 '^##\s+OrderbooksV2$' source/includes
echo
echo "== Checking depth parameter rows =="
rg -n -C1 '^\|\s*depth\s*\|\s*Integer\s*\|' source/includes
echo
echo "== Show full Request Parameters tables around depth for quick inspection =="
rg -n -C6 '^\|\s*depth\s*\|\s*Integer\s*\|' source/includes/_spotrpc.md || true
rg -n -C6 '^\|\s*depth\s*\|\s*Integer\s*\|' source/includes/_derivativesrpc.md || trueLength of output: 2699
Update depth parameter description in Spot and Derivatives OrderbooksV2 docs
Both Spot and Derivatives OrderbooksV2 reference tables currently say “The depth of the orderbook”. To clarify that 0 returns a full, per-side snapshot and larger values are truncated, update both tables as follows:
• source/includes/_spotrpc.md:1897
• source/includes/_derivativesrpc.md:3086
-| depth | Integer | The depth of the orderbook | Yes |
+| depth | Integer | Maximum number of price levels to return per side; 0 returns full depth. Values above the server-defined maximum are truncated. | Yes |📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| | Parameter | Type | Description | Required | | |
| | ---------- | ------------ | ------------------------------------------------------ | -------- | | |
| | market_ids | String Array | List of IDs of markets to get orderbook snapshots from | Yes | | |
| | depth | Integer | The depth of the orderbook | Yes | | |
| | Parameter | Type | Description | Required | | |
| | ---------- | ------------ | ---------------------------------------------------------------------------------------------------------------------- | -------- | | |
| | market_ids | String Array | List of IDs of markets to get orderbook snapshots from | Yes | | |
| | depth | Integer | Maximum number of price levels to return per side; 0 returns full depth. Values above the server-defined maximum are truncated. | Yes | |
🧰 Tools
🪛 LanguageTool
[grammar] ~1894-~1894: There might be a mistake here.
Context: ... | Required | | ---------- | ------------ | ----------...
(QB_NEW_EN)
[grammar] ~1895-~1895: There might be a mistake here.
Context: ...--------------------------- | -------- | | market_ids | String Array | List of ID...
(QB_NEW_EN)
[grammar] ~1896-~1896: There might be a mistake here.
Context: ...et orderbook snapshots from | Yes | | depth | Integer | The depth of the ord...
(QB_NEW_EN)
🤖 Prompt for AI Agents
In source/includes/_spotrpc.md around lines 1894–1898 and
source/includes/_derivativesrpc.md around line 3086, update the "depth"
parameter description to clarify behavior: replace "The depth of the orderbook"
with a concise explanation such as "Depth of the orderbook; 0 returns a full
per-side snapshot, values >0 return the top N levels per side (truncated)."
Ensure the wording is consistent in both files and preserves table formatting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds documentation for a new depth parameter to the orderbooks v2 requests in the Indexer endpoints. The parameter specifies the depth of the orderbook and is marked as required.
- Added
depthparameter documentation to orderbooks v2 endpoint parameter tables - Applied the change consistently across both spot and derivatives RPC documentation
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| source/includes/_spotrpc.md | Added depth parameter documentation to spot orderbooks v2 endpoint |
| source/includes/_derivativesrpc.md | Added depth parameter documentation to derivatives orderbooks v2 endpoint |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| | Parameter | Type | Description | Required | | ||
| | ---------- | ------------ | ------------------------------------------------------ | -------- | | ||
| | market_ids | String Array | List of IDs of markets to get orderbook snapshots from | Yes | | ||
| | depth | Integer | The depth of the orderbook | Yes | |
Copilot
AI
Aug 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description 'The depth of the orderbook' is too vague. Consider providing more specific details about what depth means (e.g., 'Maximum number of price levels to return for both bids and asks' or 'Number of order book levels to include in the response').
| | depth | Integer | The depth of the orderbook | Yes | | |
| | depth | Integer | Maximum number of price levels to return for both bids and asks | Yes | |
| | Parameter | Type | Description | Required | | ||
| | ---------- | ------------ | ------------------------------------------------------ | -------- | | ||
| | market_ids | String Array | List of IDs of markets to get orderbook snapshots from | Yes | | ||
| | depth | Integer | The depth of the orderbook | Yes | |
Copilot
AI
Aug 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description 'The depth of the orderbook' is too vague. Consider providing more specific details about what depth means (e.g., 'Maximum number of price levels to return for both bids and asks' or 'Number of order book levels to include in the response').
| | depth | Integer | The depth of the orderbook | Yes | | |
| | depth | Integer | Maximum number of price levels to return for both bids and asks | Yes | |
Summary by CodeRabbit