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/robin-sdk/robin-sdk.git
cd robin-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(client_id="your_client_id") 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_id="your_client_id")
client.authenticate()

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

Environment Variables

Variable Description Required
ROBINHOOD_CLIENT_ID Your Robinhood OAuth2 client ID Yes (or pass to constructor)

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.0.tar.gz (48.7 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.0-py3-none-any.whl (28.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: robin_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 48.7 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.0.tar.gz
Algorithm Hash digest
SHA256 998351f143942f8d42f4d39bd6c3e404b9ba0c4c9bd2456ce28e7cd57df05311
MD5 4aefdd1fe8494314f4e8b61c2b52f06b
BLAKE2b-256 0b55fccf34bf9bd1bf1fe8f6bee3d00f24168183587bd821cc0e274f3fb87752

See more details on using hashes here.

File details

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

File metadata

  • Download URL: robin_sdk-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7d649c542276fbdab3b5aa472c8b1f4dd4d8040829ca12fdbe66296a9e3c6fda
MD5 09d607ba8e8a5a67f59cd6753ee08c97
BLAKE2b-256 91db123ec431bd3911389b2f54e5156587725f099125665bbbd6944131381f9e

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