Skip to content

Add comprehensive futures trading support to robin_stocks#1641

Open
jonsflow wants to merge 3 commits into
jmfernandes:masterfrom
jonsflow:feature/futures-api-implementation
Open

Add comprehensive futures trading support to robin_stocks#1641
jonsflow wants to merge 3 commits into
jmfernandes:masterfrom
jonsflow:feature/futures-api-implementation

Conversation

@jonsflow

@jonsflow jonsflow commented Jan 4, 2026

Copy link
Copy Markdown

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

jonsflow and others added 2 commits January 3, 2026 13:45
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.
@jamestford

Copy link
Copy Markdown

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
@DhruvaBansal00

Copy link
Copy Markdown

Thanks for this contribution! jmfernandes/robin_stocks appears to be unmaintained, so I've started a community-maintained fork at https://github.com/DhruvaBansal00/robin_stocks_v2 and merged this PR there: DhruvaBansal00/robin_stocks_v2@5a3e909

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.

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.

3 participants