Skip to content

Implement crypto.get_open_crypto_positions method#333

Open
mm0 wants to merge 1 commit into
jmfernandes:masterfrom
mm0:patch-1
Open

Implement crypto.get_open_crypto_positions method#333
mm0 wants to merge 1 commit into
jmfernandes:masterfrom
mm0:patch-1

Conversation

@mm0

@mm0 mm0 commented Nov 25, 2021

Copy link
Copy Markdown

There is currently no way to get only open crypto positions.

Stocks have robinhood.account.get_open_stock_positions()
Options have robinhod.options.get_open_option_positions(),

However, robinhood.crypto only has method get_crypto_positions() which returns results without any quantity held.

There is currently no way to get only open crypto positions. Stocks have `robinhood.account.get_open_stock_positions()`, options have `robinhod.options.get_open_option_positions()`, however, `robinhood.crypto` only has method `get_crypto_positions()` which returns results without any quantity held.
DhruvaBansal00 added a commit to DhruvaBansal00/robin_stocks that referenced this pull request May 23, 2026
Upstream PR jmfernandes#333 (jmfernandes/robin_stocks). New SDK function that
mirrors get_open_stock_positions / get_open_option_positions for
crypto by filtering crypto_holdings with nonzero=true.

Also exposes the function as an MCP tool (rh_get_open_crypto_positions)
and adds a dispatch test.

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 added a commit to DhruvaBansal00/robin_stocks that referenced this pull request May 23, 2026
Adds a credential-free, fully-mocked test suite covering the changes
landed across the 12 upstream-PR merges plus the surrounding SDK.

New tests/sdk/ tree (mock-based, no network/credentials):
- test_urls: every URL builder we touched (options, futures, recurring,
  tax-lots, marketdata-index)
- test_helper / test_helper_requests: index routing, rate limiter +
  thread safety, request_get/post/delete/document branches, filter_data
- test_authentication_robinhood / test_auth_verification: login JSON
  persistence (jmfernandes#1646), store_session=False fix (jmfernandes#1643), the device
  verification polling flow
- test_authentication_tda: JSON + base64 + Fernet roundtrip, refresh
  branches
- test_orders / test_order_wrappers / test_option_crypto_orders:
  market_hours coupling (jmfernandes#454), tax-lot payloads, every order wrapper
- test_options_index_routing / test_options_remaining: index chain
  symbols (jmfernandes#541), find_options_by_* variants, historicals validation
- test_stocks / test_stocks_index_routing: quote routing, historicals
- test_crypto: open-positions nonzero filter (jmfernandes#333)
- test_futures: full module coverage incl. pagination + P&L helpers
- test_recurring_investments: create/update/cancel payloads + branches
- test_account / test_markets / test_misc_modules: legacy sweeps

New tests/mcp tests:
- test_all_tools_dispatch: introspection-based generic dispatch test
  that verifies all 206 registered MCP tools forward to their SDK
  function (synthesizes args from each tool's signature)
- test_remaining_tools: download + TDA-auth tools with bespoke returns

Results: 801 passing, 1 skipped. Coverage: 100% on every MCP tool
module and on the modules we authored (futures, recurring_investments,
markets, tda/authentication); 92% overall across robinhood + MCP.
Remaining gaps are legacy SDK paths untouched by these PRs.

Also adds pytest-cov to the dev extra and ignores coverage artifacts.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@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@f8c7112

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.

2 participants