alpaca-base

Crates.ioalpaca-base
lib.rsalpaca-base
version0.25.1
created_at2026-01-01 19:51:41.124288+00
updated_at2026-01-02 07:33:39.264844+00
descriptionBase library with common structs, traits, and logic for Alpaca API clients
homepagehttps://github.com/joaquinbejar/alpaca-rs
repositoryhttps://github.com/joaquinbejar/alpaca-rs
max_upload_size
id2017371
size308,204
Joaquin Bejar Garcia (joaquinbejar)

documentation

README

alpaca-rs

License Crates.io Downloads Documentation

alpaca-base

Base library with common structs, traits, and logic for Alpaca API clients.

Overview

alpaca-base provides the foundational building blocks for the Alpaca Market API Rust clients. It includes shared data models, authentication utilities, custom error types, and common helper functions used by both alpaca-http and alpaca-websocket.

Features

  • Core Data Models: Comprehensive Rust representations of Alpaca API objects (Orders, Positions, Assets, etc.).
  • Authentication: Utilities for managing API keys and generating authentication headers.
  • Robust Error Handling: Centralized error types for API errors, validation errors, and rate limits.
  • Utility Functions: Helpers for URL encoding, timestamp parsing, and more.
  • Test Utilities: Fixtures and helpers for testing Alpaca integrations (available with test-utils feature).

Installation

Add to your Cargo.toml:

[dependencies]
alpaca-base = "0.25.1"

Usage

While alpaca-base is primarily used internally by other crates in the workspace, you can use its types and authentication utilities directly.

[!TIP] Automated .env Loading: Credentials::from_env() automatically attempts to load a .env file at the start of execution using the dotenv crate. You don't need to call dotenv().ok() manually in your code.

use alpaca_base::auth::Credentials;

// Automatically loads from .env
let credentials = Credentials::from_env()?;

Contribution and Contact

We welcome contributions to this project! If you would like to contribute, please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Make your changes and ensure that the project still builds and all tests pass.
  4. Commit your changes and push your branch to your forked repository.
  5. Submit a pull request to the main repository.

If you have any questions, issues, or would like to provide feedback, please feel free to contact the project maintainer:

Contact Information

We appreciate your interest and look forward to your contributions!

License: MIT

Disclaimer

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.

Commit count: 2

cargo fmt