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.1.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.1-py3-none-any.whl (28.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: robin_sdk-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 db57e8e01eb7c8c2c0e786a67f83b63205025cfd8935c1458b80934050b762b7
MD5 5f046a8162b3d65c92169f9c2ed19756
BLAKE2b-256 deeac8fa21813440d1f4e29cc3929aa2996376282f7b4f26709a8ee7a8c5fea2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: robin_sdk-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bf72becb877ec07033f3b170359a9ceee5030c52b95509635ea5356c7b17c857
MD5 d93bfbf6ca63485d73bf2babc0762ac0
BLAKE2b-256 cfb0205465c4b334e7353c1d4206b1afe95408b5d520a02ff0bdaaa657eb9a65

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