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

Uploaded Python 3

File details

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

File metadata

  • Download URL: robin_sdk-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 c5a355c684201b4a219f6e110d356b6be754f3a73f3e6cd849f69439d24a3ece
MD5 1bf9b5ae2bf0ccc5ae7c2dddcffd2c2f
BLAKE2b-256 67630be00e91299e70ab483153c33822d8aec24ee77dfc565f714298d7101665

See more details on using hashes here.

File details

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

File metadata

  • Download URL: robin_sdk-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 14c0c4be406ccf89fd4b9a257781f9243f262ff9d667144ebe00c32505fc9331
MD5 ed419f0ba9877d48f4e01267f0508500
BLAKE2b-256 24a1982957ed3c422d2b1551a896802a8dc5532fe2024c3fcb1b34e2f2c93084

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