📦 rpaca – A Rust Client for the Alpaca Trading API
rpaca is a lightweight, idiomatic Rust client for interacting with the Alpaca trading API.
It enables easy integration with account info, orders, assets, positions, and market data with strong typing and clean
abstractions.
🚀 Overview
rpaca provides a Rust interface to the Alpaca API, allowing developers to:
- Access and manage trading accounts
- Submit and track orders for stocks and other assets
- Monitor positions and portfolio performance
- Access market data for stocks and options
- Work with watchlists and other account features
The library supports both paper trading (for testing) and live trading environments.
✨ Features
Trading
- ✅ Authentication - Simple API key authentication with support for environment variables
- ✅ Account Management - Access account information and configurations
- ✅ Order Management - Submit and manage stock orders with various order types
- ✅ Portfolio Management - View and manage positions and overall portfolio
- ✅ Market Data - Access stock and options data
- ✅ Calendar & Clock - Fetch market calendar and clock data
- ✅ Watchlists - Create and manage watchlists
- 🚧 Crypto - Access to cryptocurrency endpoints (in development)
Market Data
- ✅ Stock - Get all stock information
- 🚧 Everything else work in progress
📋 Installation
Add rpaca to your Cargo.toml:
[]
= "0.5.0"
🔑 Authentication
rpaca requires Alpaca API credentials. You can create an account at Alpaca to obtain your
API key and secret.
Using Environment Variables
Create a .env file in your project root:
APCA_API_KEY_ID=your_api_key
APCA_API_SECRET_KEY=your_api_secret
Then in your code:
use ;
Direct Authentication
use ;
📝 Examples
Getting Account Information
use ;
use get_account_info;
async
Creating an Order
use ;
use ;
async
Getting Market Data
use ;
use get_bars;
use ;
async
📚 Documentation
For detailed documentation, visit docs.rs/rpaca.
🛠️ Development Status
This project is currently in active development. While the core functionality is stable, breaking changes may occur in future versions as we continue to expand the API coverage.
🤝 Contributing
Contributions are welcome! Feel free to open issues or submit pull requests on the GitHub repository.
📜 License
This project is licensed under either of:
at your option.