RobinStocks 1.0.1
dotnet add package RobinStocks --version 1.0.1
NuGet\Install-Package RobinStocks -Version 1.0.1
<PackageReference Include="RobinStocks" Version="1.0.1" />
<PackageVersion Include="RobinStocks" Version="1.0.1" />
<PackageReference Include="RobinStocks" />
paket add RobinStocks --version 1.0.1
#r "nuget: RobinStocks, 1.0.1"
#:package RobinStocks@1.0.1
#addin nuget:?package=RobinStocks&version=1.0.1
#tool nuget:?package=RobinStocks&version=1.0.1
RobinStocks
A C# client library for the Robinhood brokerage API. Provides strongly-typed services for stocks, options, futures, crypto, orders, accounts, and market data.
Disclaimer: Robinhood does not publish an official public API. This library is based on reverse-engineered endpoints and may break without notice if Robinhood changes their API.
Install
dotnet add package RobinStocks
Quick Start
using RobinStocks;
// Create a client
var client = RobinStocksBuilder.CreateRobinhoodClient();
// Login (stored tokens are reused automatically on subsequent runs)
var success = await client.LoginAsync("your@email.com", "yourpassword");
if (!success)
{
Console.WriteLine("Login failed — check credentials or approve in the Robinhood app.");
return;
}
// Get a stock quote
var quote = await client.Stocks.GetQuoteAsync("AAPL");
Console.WriteLine($"AAPL: ${quote?.LastTradePrice}");
// Get options chain
var chain = await client.Options.GetOptionChainAsync("AAPL");
// Get account positions
var positions = await client.Account.GetPositionsAsync();
await client.LogoutAsync();
Authentication
Robinhood requires device approval for new logins. The first time you authenticate on a new machine, you will be prompted to approve the login in the Robinhood mobile app.
After the first successful login, the access token is stored at ~/.tokens/robinhood.json and reused automatically on subsequent runs — no re-approval needed unless the token expires.
TOTP / Authenticator App
If you have two-factor authentication enabled via an authenticator app, pass your TOTP secret:
await client.LoginAsync("your@email.com", "yourpassword", totpSecret: "YOUR_TOTP_SECRET");
MFA Code (SMS)
If you receive an SMS code, pass it directly:
await client.LoginAsync("your@email.com", "yourpassword", mfaCode: "123456");
Token Refresh
Tokens are valid for 24 hours. To refresh programmatically:
if (client.TokenExpiryTime < DateTime.UtcNow.AddMinutes(10))
await client.RefreshTokenAsync();
Token Change Hook
Subscribe to token changes to persist tokens externally (e.g. to a Kubernetes secret):
var authService = /* resolve RobinhoodAuthenticationService from DI */;
authService.OnTokenRefreshed += async tokenData =>
{
// persist tokenData.AccessToken, tokenData.RefreshToken, etc.
};
Dependency Injection (ASP.NET)
// Program.cs
builder.Services.AddRobinStocks();
// Inject RobinhoodClient wherever needed
public class MyService(RobinhoodClient client) { ... }
Services
| Property | Description |
|---|---|
client.Stocks |
Quotes, historicals, fundamentals, instrument search, news, ratings |
client.Options |
Option chains, instruments, market data, positions, orders |
client.Orders |
Place, cancel, and list equity orders |
client.Account |
Positions, portfolio, watchlists, bank accounts, dividends |
client.Crypto |
Crypto quotes, orders, holdings, currency pairs |
client.Markets |
Market hours, top movers, market categories |
client.Profiles |
User profile, investment profile, employment info |
client.TradingTrends |
Retail sentiment, hedge fund activity, insider transactions |
client.Futures |
Futures contracts, quotes, historicals, margin, orders |
Architecture
RobinhoodClient
├── StocksService → api.robinhood.com
├── OptionsService → api.robinhood.com
├── OrdersService → api.robinhood.com
├── AccountService → api.robinhood.com
├── MarketsService → api.robinhood.com
├── ProfilesService → api.robinhood.com
├── TradingTrendsService→ api.robinhood.com
├── CryptoService → nummus.robinhood.com
└── FuturesService → api.robinhood.com (arsenal/ceres)
All services share a single HttpClientService that manages the Bearer token and handles auth-stripping for OAuth endpoints.
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- Microsoft.Extensions.DependencyInjection (>= 9.0.0)
- Microsoft.Extensions.Http (>= 9.0.0)
- Microsoft.Extensions.Logging (>= 9.0.0)
- Newtonsoft.Json (>= 13.0.3)
- Otp.NET (>= 1.4.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|