Skip to main content

alpaca_data/
lib.rs

1//! Async Rust client for the Alpaca Market Data HTTP API.
2//!
3//! The crate follows a mirror layer plus thin convenience layer design:
4//! resource methods track the official Alpaca HTTP API closely, while stable
5//! helpers such as pagination aggregators remain opt-in.
6//!
7//! Environment variables:
8//!
9//! - `ALPACA_DATA_API_KEY`
10//! - `ALPACA_DATA_SECRET_KEY`
11//! - `ALPACA_DATA_BASE_URL`
12//! - legacy fallback: `APCA_API_DATA_URL`
13//!
14//! ```no_run
15//! use alpaca_data::Client;
16//!
17//! let client = Client::builder()
18//!     .credentials_from_env()?
19//!     .base_url_from_env()?
20//!     .build()?;
21//! let _stocks = client.stocks();
22//! # Ok::<(), alpaca_data::Error>(())
23//! ```
24//!
25//! See the workspace docs site at <https://wmzhai.github.io/alpaca-rust/>.
26//!
27#![forbid(unsafe_code)]
28
29mod client;
30mod error;
31mod pagination;
32
33pub mod corporate_actions;
34pub mod news;
35pub mod options;
36pub mod stocks;
37
38pub use client::{
39    Client, ClientBuilder, DATA_API_KEY_ENV, DATA_BASE_URL_ENV, DATA_SECRET_KEY_ENV,
40    DEFAULT_DATA_BASE_URL, LEGACY_DATA_BASE_URL_ENV,
41};
42pub use error::Error;
43
44#[cfg(test)]
45mod tests;