|
| 1 | +# Aggregator Core |
| 2 | + |
| 3 | +## Purpose & Key Features |
| 4 | + |
| 5 | +The *aggregator-core* is the backbone of the AggreGate platform, providing essential components for aggregating cryptocurrency order-book data. By interfacing with multiple exchanges, it facilitates high-frequency updates and efficient data processing. |
| 6 | + |
| 7 | +### Key Features: |
| 8 | +- Real-time data aggregation from multiple exchanges. |
| 9 | +- Extensible design allowing integration with new exchanges effortlessly. |
| 10 | +- High-performance order-book handling using configurable strategies. |
| 11 | +- Robust error handling and logging. |
| 12 | + |
| 13 | +## Supported Exchanges & Extensibility Strategy |
| 14 | + |
| 15 | +Currently Supported Exchanges: |
| 16 | +- Binance |
| 17 | +- Bitstamp |
| 18 | +- Bybit |
| 19 | +- Kraken |
| 20 | +- Coinbase |
| 21 | +- Crypto.com |
| 22 | +- OKX |
| 23 | + |
| 24 | +Extensibility Strategy: |
| 25 | +The system is designed with modular exchange connectors, allowing developers to add new exchanges by implementing the `Exchange` interface, following examples in existing modules. |
| 26 | + |
| 27 | +## High-Level Architecture |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | +```mermaid |
| 32 | +graph TB |
| 33 | + subgraph "Aggregator Core" |
| 34 | + A[Aggregator Module] --> C[Config Module] |
| 35 | + A --> E[Error Module] |
| 36 | + A --> T[Types Module] |
| 37 | + A --> L[Lib Module] |
| 38 | + |
| 39 | + C --> E |
| 40 | + T --> E |
| 41 | + L --> T |
| 42 | + end |
| 43 | + |
| 44 | + subgraph "External Dependencies" |
| 45 | + API[External APIs] |
| 46 | + DB[Database] |
| 47 | + FS[File System] |
| 48 | + end |
| 49 | + |
| 50 | + A --> API |
| 51 | + C --> FS |
| 52 | + A --> DB |
| 53 | + |
| 54 | + subgraph "Application Layer" |
| 55 | + APP[Application] |
| 56 | + end |
| 57 | + |
| 58 | + APP --> A |
| 59 | + APP --> C |
| 60 | +``` |
| 61 | + |
| 62 | +## Quick-Start Example |
| 63 | + |
| 64 | +Here's a quick-start example of how to initialize and start the aggregator: |
| 65 | +```rust |
| 66 | +use aggregator_core::{Aggregator, Config}; |
| 67 | + |
| 68 | +fn main() -> Result<(), Box<dyn std::error::Error>> { |
| 69 | + let config = Config::default(); |
| 70 | + let aggregator = Aggregator::new(config); |
| 71 | + |
| 72 | + // Start the aggregator |
| 73 | + tokio::runtime::Builder::new_multi_thread() |
| 74 | + .worker_threads(2) |
| 75 | + .enable_all() |
| 76 | + .build() |
| 77 | + .unwrap() |
| 78 | + .block_on(async { |
| 79 | + aggregator.start().await?; |
| 80 | + Ok(()) |
| 81 | + }) |
| 82 | +} |
| 83 | +``` |
| 84 | + |
| 85 | +## Installation & Build Instructions |
| 86 | + |
| 87 | +To include *aggregator-core* in your project, add the following line to your `Cargo.toml`: |
| 88 | +```toml |
| 89 | +[dependencies] |
| 90 | +aggregator-core = { path = "aggregator-core" } |
| 91 | +``` |
| 92 | + |
| 93 | +Use the following command to add it via Cargo: |
| 94 | +```bash |
| 95 | +cargo add aggregator-core |
| 96 | +``` |
| 97 | + |
| 98 | +## Links to Deeper Module Docs & API Examples |
| 99 | + |
| 100 | +- [API Examples](../docs/aggregator-core-doc/api-examples.md) |
| 101 | +- [Aggregator Module Documentation](../docs/aggregator-core-doc/modules/aggregator.md) |
| 102 | +- [Lib Module Documentation](../docs/aggregator-core-doc/modules/lib.md) |
| 103 | + |
0 commit comments