tradingkit 0.1.0

Exchange-agnostic trading library for equities and crypto
Documentation
//! Trading primitives and exchange adapters for algorithmic trading workflows.
//!
//! # Project Layers
//!
//! - `model` holds exchange-agnostic trading domain types such as orders, option legs, and
//!   account snapshots.
//! - `data` separates direct reads from cache-backed reads through `Source`, `Store`, and
//!   `Repository` abstractions.
//! - `exchange` defines the common trading traits and exposes concrete exchange adapters.
//! - `exchange::alpaca` is the current REST trading implementation, including equity, single-leg
//!   options, and multi-leg options support.
//! - `exchange::okx` currently covers credential/signature behavior and is the next extension
//!   point for shared trading operations.
//! - `strategy/` contains executable crates that consume the shared library.
//!
//! # Examples
//!
//! ```rust,no_run
//! use tradingkit::exchange::alpaca::{Alpaca, AlpacaCredentials};
//! use tradingkit::model::{
//!     AssetClass, OrderClass, OrderRequest, OrderSide, OrderType, PositionIntent, TimeInForce,
//! };
//! use tradingkit::trading::TradingApi;
//!
//! async fn example() -> Result<(), Box<dyn std::error::Error>> {
//!     let api = Alpaca::paper(AlpacaCredentials::new(
//!         "your-key".to_string(),
//!         "your-secret".to_string(),
//!     ));
//!
//!     let request = OrderRequest {
//!         symbol: Some("AAPL240119C00190000".to_string()),
//!         asset_class: Some(AssetClass::UsOption),
//!         qty: Some("1".to_string()),
//!         notional: None,
//!         side: Some(OrderSide::Buy),
//!         order_type: OrderType::Market,
//!         time_in_force: TimeInForce::Day,
//!         order_class: Some(OrderClass::Simple),
//!         limit_price: None,
//!         stop_price: None,
//!         trail_price: None,
//!         trail_percent: None,
//!         client_order_id: Some("example-order".to_string()),
//!         extended_hours: Some(false),
//!         position_intent: Some(PositionIntent::BuyToOpen),
//!         legs: None,
//!     };
//!
//!     let _order = api.submit(&request).await?;
//!     Ok(())
//! }
//! ```
//!
//! The same client can be created from environment variables instead of inline secrets:
//!
//! ```rust,no_run
//! use tradingkit::exchange::alpaca::{Alpaca, AlpacaCredentials};
//!
//! let _alpaca = Alpaca::paper(AlpacaCredentials::env()?);
//! # Ok::<(), Box<dyn std::error::Error>>(())
//! ```

mod crypto;

pub mod data;
pub mod exchange;
pub mod model;
pub mod trading;