Skip to main content

Crate oxidized_alpaca

Crate oxidized_alpaca 

Source
Expand description

Oxidized Alpaca - A Rust client library for the Alpaca trading API.

§Numeric types

Numeric fields on response types mirror Alpaca’s wire format rather than being normalized: fields Alpaca encodes as string-quoted decimals (most Trading API monetary and quantity fields) deserialize to rust_decimal::Decimal, and fields Alpaca encodes as bare JSON numbers (market data prices and sizes, streaming market data, portfolio history equity and P/L, screener / forex / fixed-income prices) deserialize to f64 and have already been rounded by the JSON number representation by the time they leave the API.

The crate does not coerce one encoding into the other, so the mapping from Alpaca’s docs onto the Rust types is direct and any precision loss is the API’s rather than ours. For real calculations — backtesting, P/L attribution, order sizing — most callers will want to remap these into a representation appropriate to their domain (integer minor units, fixed-point, a Money newtype, etc.) rather than computing on the wire types directly.

Re-exports§

pub use asset::AssetClass;
pub use crypto::CryptoTakerSide;
pub use error::RestError;
pub use error::UrlError;
pub use error::WebsocketError;
pub use error::Error;
pub use error::Result;
pub use ids::AccountId;
pub use ids::ActivityId;
pub use ids::AssetId;
pub use ids::ClientOrderId;
pub use ids::ExecutionId;
pub use ids::OptionContractId;
pub use ids::OrderId;
pub use ids::WatchlistId;
pub use restful::MarketDataClient;
pub use restful::TradingClient;

Modules§

asset
Asset domain types shared between the REST and streaming APIs. Asset domain types shared between the REST trading / market-data APIs and the streaming trade-updates feed.
crypto
Crypto domain types shared between the REST and streaming APIs. Crypto domain types shared between the REST market data API and the streaming crypto feed.
error
Error types for the crate.
ids
Strongly-typed identifier newtypes for Alpaca-issued IDs. Strongly-typed identifier newtypes returned by the Alpaca API.
orders
Order domain types shared between the REST trading API and the streaming trade-updates feed. Order domain types shared between the REST trading API and the streaming trade-updates feed.
restful
RESTful API client and endpoint types.
streaming
Streaming WebSocket API client.

Structs§

ApiKey
Alpaca API credentials: a key ID and secret key pair.

Enums§

AccountType
The type of Alpaca account
CryptoFeed
Crypto streaming feed selector. Each variant maps to a distinct WebSocket endpoint Alpaca exposes.
OptionFeed
Options streaming feed selector. Each variant maps to a distinct WebSocket endpoint Alpaca exposes.
RestFeed
Stock market data feed selector for REST market-data endpoints.
StreamingFeed
Stock streaming feed selector. Each variant maps to a distinct WebSocket endpoint Alpaca exposes.