Skip to main content

Python SDK for Robinhood MCP Trading API — zero third-party dependencies

Project description

Robin SDK

A Python SDK for the Robinhood MCP (Model Context Protocol) Trading API.

Zero third-party runtime dependencies — uses only the Python standard library to eliminate supply-chain attack surface.

Installation

pip install robin-sdk

Or install from source:

git clone https://github.com/gordil/robin-python-SDK.git
cd robin-python-SDK
pip install -e .

Security

This SDK has zero runtime dependencies. Every import is from the Python standard library. This eliminates the risk of supply-chain attacks through transitive dependencies.

Quick Start

Async Usage

import asyncio
from robin_sdk import RobinClient

async def main():
    async with RobinClient() as client:
        # List accounts
        accounts = await client.get_accounts()
        print(accounts)

        # Get portfolio
        portfolio = await client.get_portfolio(account_number="YOUR_ACCOUNT")
        print(portfolio)

        # Search for a ticker
        results = await client.search(query="Apple")
        print(results)

        # Get real-time quotes
        quotes = await client.get_equity_quotes(symbols=["AAPL", "GOOGL"])
        print(quotes)

        # Place an order
        order = await client.place_equity_order(
            account_number="YOUR_ACCOUNT",
            symbol="AAPL",
            quantity="1",
            side="buy",
            type="market",
        )
        print(order)

asyncio.run(main())

Sync Usage

from robin_sdk import RobinClient

client = RobinClient()
client.authenticate()

accounts = client.get_accounts_sync()
portfolio = client.get_portfolio_sync(account_number="YOUR_ACCOUNT")

Environment Variables

No environment variables are required to run the SDK client. If you already have a registered Robinhood OAuth2 client ID, you may optionally set it:

Variable Description Required
ROBINHOOD_CLIENT_ID Optional pre-registered OAuth2 client ID No

API Reference

Detailed documentation with inputs, outputs, and notes is available in the documentation/ folder.

Account & Portfolio

Method Description Details
get_accounts() View all Robinhood accounts account-portfolio.md
get_portfolio(account_number) Get portfolio snapshot with values by asset class account-portfolio.md
search(query) Find a company name or partial name to a ticker account-portfolio.md

Watchlists

Method Description Details
get_watchlists() List user's watchlists watchlists.md
get_watchlist_items(watchlist_id) List symbols in a watchlist watchlists.md
get_option_watchlist() Load an options watchlist watchlists.md
get_popular_watchlists() Discover Robinhood lists watchlists.md
create_watchlist(name, ...) Create a new custom watchlist watchlists.md
update_watchlist(watchlist_id, ...) Rename or update a watchlist watchlists.md
follow_list(list_id) Follow a Robinhood list watchlists.md
unfollow_list(list_id) Unfollow a Robinhood list watchlists.md
add_to_watchlist(watchlist_id, symbols) Add symbols to a watchlist watchlists.md
remove_from_watchlist(watchlist_id, symbols) Remove symbols from a watchlist watchlists.md
add_option_to_watchlist(watchlist_id, ...) Add options contract to watchlist watchlists.md
remove_option_from_watchlist(watchlist_id, ...) Remove options contract from watchlist watchlists.md

Market Data

Method Description Details
get_equity_historicals(symbol, ...) Get OHLCV price bars market-data.md
get_indexes(symbols) Look up market indexes market-data.md
get_indexes_quotes(symbols) Get real-time index values market-data.md

Equities

Method Description Details
get_equity_positions(account_number) View open equity positions equities.md
get_equity_quotes(symbols) Real-time quotes for up to 20 symbols equities.md
get_equity_orders(account_number) Equity order status history equities.md
get_equity_tradability(symbol) Check if symbol can be traded equities.md
review_equity_order(...) Simulate an order with pre-trade warnings equities.md
place_equity_order(...) Place an equity order equities.md
cancel_equity_order(order_id) Cancel an open equity order equities.md

Options

Method Description
get_option_chains(symbol) Load option chains
get_option_instruments(...) Load option contracts by filters
get_option_quotes(instruments) Real-time option quotes
get_option_positions(account_number) View option positions
get_option_orders(account_number) Options order history
review_option_order(...) Simulate options order
place_option_order(...) Place a real options order
cancel_option_order(order_id) Cancel an open options order

License

Apache License 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

robin_sdk-0.1.4.tar.gz (48.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

robin_sdk-0.1.4-py3-none-any.whl (28.9 kB view details)

Uploaded Python 3

File details

Details for the file robin_sdk-0.1.4.tar.gz.

File metadata

  • Download URL: robin_sdk-0.1.4.tar.gz
  • Upload date:
  • Size: 48.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.4

File hashes

Hashes for robin_sdk-0.1.4.tar.gz
Algorithm Hash digest
SHA256 63abb156797f8248d1541ac9345155200cfae022f117811e4ea8711dda6dffe3
MD5 82c9398e810d1919989f862fd9479dc3
BLAKE2b-256 94473968639524f500e9a7f87f1eb5e338a18a93ba4f93a4ada801060b97d736

See more details on using hashes here.

File details

Details for the file robin_sdk-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: robin_sdk-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 28.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.4

File hashes

Hashes for robin_sdk-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f147ff7f465f823370a921beb633f285ad82637737fb457ed12cb2e40b5b7993
MD5 11f12bdf13e4236f90c9df556d7c2b0f
BLAKE2b-256 1cceda7e653126cfc051d202e738b9cc2432674fc65d1e5fdc57c0de7f2ce7ef

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page