Expand description
§Financial Types
Core financial type definitions for trading systems.
This crate provides fundamental enums used across financial applications:
UnderlyingAssetType— Classification of asset classes (stocks, crypto, forex, etc.)Action— Trading actions (buy, sell)Side— Position directional exposure (long, short)OptionStyle— Option contract style (call, put)
All enums use #[repr(u8)] for compact memory layout and are designed for
high-performance financial systems.
§Features
- Full
serdeserialization/deserialization support - Optional
utoipasupport for OpenAPI schema generation (enable theutoipafeature) #[repr(u8)]on all enums for deterministic layout#[must_use]on pure helper methods
§Usage
use financial_types::{Action, Side, OptionStyle, UnderlyingAssetType};
let action = Action::Buy;
let side = Side::Long;
let style = OptionStyle::Call;
let asset = UnderlyingAssetType::Stock;
assert_eq!(format!("{action}"), "Buy");
assert_eq!(format!("{side}"), "Long");
assert_eq!(format!("{style}"), "Call");
assert_eq!(format!("{asset}"), "Stock");
assert!(style.is_call());
assert!(side.is_long());
assert!(action.is_buy());Modules§
- prelude
- Prelude module for convenient imports.
Enums§
- Action
- Represents trading actions in a financial context.
- Option
Style - Specifies the style of an option contract.
- Side
- Defines the directional exposure of a financial position.
- Underlying
Asset Type - Classification of the underlying asset for a financial instrument.