Add comprehensive futures trading support to robin_stocks#1641
Open
jonsflow wants to merge 3 commits into
Open
Add comprehensive futures trading support to robin_stocks#1641jonsflow wants to merge 3 commits into
jonsflow wants to merge 3 commits into
Conversation
This implementation adds full access to Robinhood's futures trading API. Features: - Get futures contract details by symbol - Get real-time quotes for futures contracts - Retrieve all historical futures orders with automatic pagination - Auto-discover futures account ID - Extract and calculate P&L from futures orders - Full support for all discovered futures endpoints All 13 tests passing. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
The futures API uses cursor-based pagination (passing cursor parameter) rather than URL-based pagination like stocks/options. Updated both get_all_futures_orders() and get_filled_futures_orders() to properly handle pagination by reading the 'next' cursor from responses. Also improved get_futures_account_id() to filter by accountType='FUTURES' to ensure we get the correct futures account. Added tests for order retrieval functions to verify pagination works. All 15 tests passing.
|
Just added this feature to the pyhood project as well, thanks! https://github.com/jamestford/pyhood |
DhruvaBansal00
added a commit
to DhruvaBansal00/robin_stocks
that referenced
this pull request
May 23, 2026
Upstream PR jmfernandes#1641 (jmfernandes/robin_stocks). Adds a new robin_stocks/robinhood/futures.py module with 13 functions for discovering, quoting, and reading orders against the Robinhood futures API (arsenal/ceres endpoints). Surface: - Contracts: get_futures_contract, get_futures_contracts_by_symbols - Quotes: get_futures_quote, get_futures_quotes, get_futures_quote_by_id - Account: get_futures_account_id, get_futures_positions (placeholder) - Orders: get_all_futures_orders, get_filled_futures_orders, get_futures_order_info (all paginated) - P&L helpers: extract_futures_pnl, calculate_total_futures_pnl These endpoints are undocumented and were discovered by reverse-engineering, so they may break when Robinhood changes things — particularly anything under arsenal/v1/futures/ or ceres/v1/accounts/. Plumbing additions in helper.py (update_session_for_futures, id_for_futures_contract) and urls.py (four URL helpers). Adds matching MCP tools in robin_stocks_mcp/tools/robinhood_futures.py (13 read-only tools) plus a tests/mcp/test_robinhood_futures_tools.py covering dispatch for every tool and real values for the pure-Python P&L helpers. Also adds futures integration tests to tests/test_robinhood.py (network-touching; require live credentials). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
DhruvaBansal00
added a commit
to DhruvaBansal00/robin_stocks
that referenced
this pull request
May 23, 2026
|
Thanks for this contribution! It's included with test coverage in the new repo, alongside 11 other open PRs from here. If you'd like a maintained build with this change, that's where to find it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This implementation adds full access to Robinhood's futures trading API.
Features:
All 13 tests passing.
🤖 Generated with Claude Code