borsa-core
Core types, traits, and utilities shared across the borsa financial data ecosystem.
Overview
borsa-core provides the foundational building blocks for the borsa ecosystem, a unified interface for accessing financial market data from multiple providers. It defines common data structures, the connector trait for implementing data providers, and utilities for working with time series data.
Features
Core Components
BorsaConnectortrait: The main interface that all data providers must implement- Capability directory: Accessors (
as_*_provider) expose granular capability traits - Common data types: Unified structures for quotes, candles, fundamentals, and more
- Time series utilities: Merging, resampling, and processing historical data
Supported Data Types
- Quotes: Real-time and delayed price data
- Historical data: OHLCV candles with corporate actions (dividends, splits)
- Fundamentals: Income statements, balance sheets, cash flow statements
- Profiles: Company and fund information
- Options: Option chains and expiration data
- Analysis: Price targets, recommendations, upgrades/downgrades
- Holders: Institutional and insider holdings
- ESG: Environmental, social, and governance scores
- News: Financial news articles and events
Asset Types
The library supports multiple asset classes:
- Equities (stocks)
- Cryptocurrencies
- Funds (ETFs, mutual funds)
- Indices
- Forex (foreign exchange)
- Bonds
- Commodities
- Derivatives
Installation
Add this to your Cargo.toml:
[]
= "0.2.0"
Usage
Basic Example
After adding borsa-core to your Cargo.toml, you can start with the following examples.
use ;
// Create an instrument (validated and canonicalized)
let instrument = from_symbol?;
// Use with any connector that implements BorsaConnector
async
Working with Capabilities
use BorsaConnector;
Time Series Operations
use ;
// Merge multiple HistoryResponse values in priority order
let merged = merge_history;
// Resample arbitrary candles to daily bars
let daily_candles = resample_to_daily?;
Architecture
Connector Trait and Capabilities
BorsaConnector is a capability hub: providers implement granular role traits and advertise them via as_*_provider accessors on the connector. This keeps the core stable and enables mix-and-match features. Use supports_kind(&AssetKind) to declare which asset classes the connector can serve.
use ;
;
Documentation
- API Documentation
- Examples: see the workspace
examples/package
Related Crates
borsa: High-level router/orchestratorborsa-yfinance: Yahoo Finance connector
Contributing
Contributions are welcome! Please see our Contributing Guide and our Code of Conduct. For major changes, please open an issue first to discuss what you would like to change.
License
This project is licensed under the MIT License - see the LICENSE file for details.