| Crates.io | alpaca-http |
| lib.rs | alpaca-http |
| version | 0.21.1 |
| created_at | 2026-01-01 19:51:44.393681+00 |
| updated_at | 2026-01-02 07:33:43.268382+00 |
| description | HTTP REST API client for Alpaca trading platform |
| homepage | https://github.com/joaquinbejar/alpaca-rs |
| repository | https://github.com/joaquinbejar/alpaca-rs |
| max_upload_size | |
| id | 2017373 |
| size | 272,024 |
HTTP REST API client for the Alpaca trading platform.
alpaca-http is a robust HTTP client for interacting with Alpaca's REST API. It handles authentication, request signing, and provides a clean interface for trading and market data endpoints.
Add to your Cargo.toml:
[dependencies]
alpaca-http = "0.21.1"
use alpaca_http::{AlpacaHttpClient, CreateOrderRequest};
use alpaca_base::{Credentials, Environment, OrderSide};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let credentials = Credentials::from_env()?;
let client = AlpacaHttpClient::new(credentials, Environment::Paper)?;
let account = client.get_account().await?;
println!("Account status: {:?}", account.status);
Ok(())
}
Run examples with cargo run -p alpaca-http --example <name>:
| Example | Description |
|---|---|
http_get_account |
Get account information |
http_create_market_order |
Create market orders |
http_create_limit_order |
Create limit orders |
http_list_orders |
List and filter orders |
http_cancel_order |
Cancel orders |
http_get_positions |
List positions |
http_close_position |
Close positions |
| Example | Description |
|---|---|
http_get_bars |
Fetch historical bars |
http_get_quotes |
Fetch quote data |
http_get_trades |
Fetch trade data |
http_list_assets |
List and filter assets |
http_get_clock |
Get market clock |
http_get_calendar |
Get market calendar |
| Example | Description |
|---|---|
http_create_broker_account |
Create broker accounts |
http_get_broker_account |
Get and list broker accounts |
http_ach_relationships |
Manage ACH funding |
http_transfers |
Create and manage transfers |
http_journals |
Create journal entries |
http_documents |
List and retrieve documents |
http_ira_contributions |
Manage IRA contributions |
| Example | Description |
|---|---|
http_news |
Fetch market news |
http_exchange_rates |
Get FX exchange rates |
http_market_clock |
Check market open/close status |
http_trading_calendar |
Get trading calendar |
http_corporate_actions |
List corporate actions |
We welcome contributions to this project! If you would like to contribute, please follow these steps:
If you have any questions, issues, or would like to provide feedback, please feel free to contact the project maintainer:
We appreciate your interest and look forward to your contributions!
License: MIT
This software is not officially associated with Alpaca Markets. Trading financial instruments carries risk, and this library is provided as-is without any guarantees. Always test thoroughly with a paper trading account before using in a live trading environment.