robinrust — A Rust client for the Robinhood Crypto API
A lightweight, async Rust library for interacting with Robinhood's Crypto trading endpoints. It includes helpers for request signing, market data (best bid/ask and estimated price), account holdings, and basic order management.
Note: This project is community-maintained and is not affiliated with, endorsed by, or supported by Robinhood Markets, Inc. Use at your own risk.
Features
- Ed25519 request signing with API key headers
- Market data
- Best bid/ask for one or more symbols
- Estimated price quotes for bid/ask given a quantity
- Trading
- Query trading pairs and min/max increments
- View crypto holdings
- List existing orders with flexible filters
- Create and cancel crypto orders (market/limit/stop/stop-limit)
- Strong types with serde and rust_decimal
- Async HTTP via reqwest + tokio
Getting started
Prerequisites
- A Robinhood Crypto API key and signing key material read here https://docs.robinhood.com/crypto/trading/#section/Introduction for more detail
Install
This is a library crate. You can consume it by cloning and adding it to your workspace, or by using a git dependency in Cargo.toml.
Example (git dependency):
[]
= { = "https://github.com/your-org/robinrust" }
If you are developing locally inside the same workspace, you can use a path dependency instead:
[]
= { = "../robinrust" }
Environment variables
The library expects credentials in your environment. A .env
file is supported via the dotenv
crate.
Required variables:
- ROBINHOOD_API_KEY — your API key (starts with rh-api-...)
- ROBINHOOD_SIGNING_PRIVATE_B64 — base64-encoded 32-byte Ed25519 private key
- ROBINHOOD_PUBLIC_KEY — your Ed25519 public key (string Robinhood associates with the API key)
Example .env
:
ROBINHOOD_API_KEY=rh-api-xxxxxxxxxxxxxxxx
ROBINHOOD_SIGNING_PRIVATE_B64=BASE64_OF_32_BYTE_ED25519_SECRET
ROBINHOOD_PUBLIC_KEY=ed25519-pub-key-string
Usage
All calls are async. Use within a Tokio runtime.
Initialize client and fetch best bid/ask
use Robinhood;
use get_best_price;
async
Estimated price quote
use Robinhood;
use get_estimated_price;
use Decimal;
async
Trading pairs and validating order size
use Robinhood;
use ;
use Decimal;
async
List orders
use Robinhood;
use ;
async
Place and cancel an order
use Robinhood;
use ;
use Uuid;
use Decimal;
async
Holdings
use Robinhood;
use get_crypto_holdings;
async
Notes and caveats
- This API and its requirements may change without notice; fields are modeled to the best of our knowledge.
- Some numeric fields arrive as strings in Robinhood responses; rust_decimal with serde helpers is used to preserve precision.
- Time fields are passed through as strings; consider parsing to DateTime if needed in your app.
- You are responsible for complying with Robinhood’s Terms of Service and applicable laws.
- You are responsible for any errors causing loss of funds, I am not held responsible for any losses.