| Crates.io | velora-core |
| lib.rs | velora-core |
| version | 0.0.1 |
| created_at | 2025-10-19 17:19:50.047903+00 |
| updated_at | 2025-10-19 17:19:50.047903+00 |
| description | Core types, errors, and utilities for the Velora HFT platform |
| homepage | https://github.com/crabby-ai/velora |
| repository | https://github.com/crabby-ai/velora |
| max_upload_size | |
| id | 1890667 |
| size | 98,770 |
Core types, errors, and utilities for the Velora HFT platform
velora-core is the foundation crate of the Velora ecosystem. It provides fundamental types, error handling, and utilities used by all other Velora crates.
This crate has minimal dependencies:
serde - Serialization/deserializationchrono - Date and time handlingordered-float - Ordered floating-point typesthiserror - Error derivationuuid - Unique identifiersconfig - Configuration managementAll numeric values use OrderedFloat<f64> to ensure they can be compared and sorted correctly. This prevents NaN-related bugs in trading logic.
This crate has no dependencies on other Velora crates, making it the foundation of the dependency graph.
Types are kept simple and focused. Complex logic belongs in higher-level crates.
All types implement Serialize and Deserialize for easy persistence and transmission.
velora-core/
├── src/
│ ├── lib.rs # Public API exports
│ ├── types.rs # Core data types
│ ├── errors.rs # Error types
│ └── config.rs # Configuration
// Core types
pub type Price = OrderedFloat<f64>;
pub type Volume = OrderedFloat<f64>;
pub struct Symbol(String);
pub enum Side { Buy, Sell }
pub enum OrderType { Market, Limit, StopLimit, StopMarket }
pub enum OrderStatus { Pending, Open, PartiallyFilled, Filled, Cancelled, Rejected, Expired }
// Trading structures
pub struct Order { /* ... */ }
pub struct Trade { /* ... */ }
pub struct Position { /* ... */ }
pub struct Balance { /* ... */ }
// Market data
pub struct Tick { /* ... */ }
pub struct Candle { /* ... */ }
pub struct OrderBook { /* ... */ }
pub struct BookLevel { /* ... */ }
pub enum Interval { Second1, Minute1, Minute5, /* ... */ }
pub enum VeloraError {
DataError(String),
ExchangeError(String),
OrderError(String),
StrategyError(String),
RiskLimitExceeded(String),
ConfigError(String),
// ... more variants
}
pub type Result<T> = std::result::Result<T, VeloraError>;
pub struct VeloraConfig {
pub exchanges: HashMap<String, ExchangeConfig>,
pub engine: EngineConfig,
pub risk: RiskConfig,
pub logging: LoggingConfig,
}
pub struct ExchangeConfig { /* ... */ }
pub struct EngineConfig { /* ... */ }
pub struct RiskConfig { /* ... */ }
use velora_core::*;
// Create a new order
let order = Order::new_limit(
Symbol::new("BTC/USD"),
Side::Buy,
Price::from(50000.0),
Volume::from(0.1),
);
// Work with market data
let tick = Tick {
symbol: Symbol::new("BTC/USD"),
price: 50000.0.into(),
volume: 1.0.into(),
timestamp: Utc::now(),
};
// Calculate mid price from order book
let mid_price = orderbook.mid_price();
proptest to verify invariantsWhere possible, types use references and borrowing to avoid unnecessary copies.
Symbol uses String internally but provides efficient comparisonOrderedFloat has the same size as f64All core types are Send and Sync where appropriate, enabling safe concurrent use.
This crate follows semantic versioning. Breaking changes to core types will result in a major version bump.
🚧 In Planning - This crate is currently in the planning phase.
types.rserrors.rsconfig.rsContributions are welcome! Please ensure:
MIT