Skip to content

Conversation

@aarmoa
Copy link
Contributor

@aarmoa aarmoa commented Aug 18, 2025

  • Added the depth paramtater to the orderbooks v2 Indexer endpoints docs

Summary by CodeRabbit

  • Documentation
    • Updated API docs to include a new required parameter: depth (Integer) for OrderbooksV2 request parameters, describing the depth of the orderbook.
    • Updated Spot Market request parameters to include the required depth (Integer) parameter for specifying orderbook depth.
    • Clarified parameter placement and requirement status to improve request construction.
    • No code or behavior changes; documentation only.

@aarmoa aarmoa requested a review from Copilot August 18, 2025 14:16
@coderabbitai
Copy link

coderabbitai bot commented Aug 18, 2025

Walkthrough

Documentation 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

Cohort / File(s) Summary
RPC docs: orderbook depth parameter
source/includes/_derivativesrpc.md, source/includes/_spotrpc.md
Added required Integer parameter depth to respective request parameter tables to document orderbook depth. No code changes.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

I nibble docs with careful might,
Adding “depth” to guide your sight—
Layer by layer, books unfold,
Carrots, trades, and bids told.
Thump! The ledger’s clear and tight.

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
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch cp-575/add_depth_parameter_orderbooks_v2_requests

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a 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.

📥 Commits

Reviewing files that changed from the base of the PR and between f165903 and ae91e2c.

📒 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

Comment on lines 1894 to 1898
| 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 |

Copy link

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 || true

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

Suggested change
| 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.

@aarmoa aarmoa merged commit ad0b420 into main Aug 18, 2025
9 checks passed
@aarmoa aarmoa deleted the cp-575/add_depth_parameter_orderbooks_v2_requests branch August 18, 2025 14:24
Copy link

Copilot AI left a 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 depth parameter 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 |
Copy link

Copilot AI Aug 18, 2025

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

Suggested change
| depth | Integer | The depth of the orderbook | Yes |
| depth | Integer | Maximum number of price levels to return for both bids and asks | Yes |

Copilot uses AI. Check for mistakes.
| 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 |
Copy link

Copilot AI Aug 18, 2025

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

Suggested change
| depth | Integer | The depth of the orderbook | Yes |
| depth | Integer | Maximum number of price levels to return for both bids and asks | Yes |

Copilot uses AI. Check for mistakes.
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