Skip to content

Commit 4331a8b

Browse files
docs: add docs & readme
1 parent d9347c7 commit 4331a8b

File tree

17 files changed

+1590
-0
lines changed

17 files changed

+1590
-0
lines changed

aggregator-core/AUDIT_REPORT.md

Lines changed: 513 additions & 0 deletions
Large diffs are not rendered by default.

aggregator-core/README.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
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+
![Architecture Diagram](../docs/aggregator-core-doc/diagrams/architecture.mmd)
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+

docs/aggregator-core-doc/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Aggregator Core Documentation
2+
3+
## Overview
4+
5+
This documentation provides comprehensive information about the aggregator-core library, including its architecture, modules, and usage examples.
6+
7+
## Structure
8+
9+
- **[Modules](modules/)**: Detailed documentation for each core module
10+
- [Aggregator](modules/aggregator.md) - Main aggregation functionality
11+
- [Config](modules/config.md) - Configuration management
12+
- [Error](modules/error.md) - Error handling and types
13+
- [Types](modules/types.md) - Core type definitions
14+
- [Lib](modules/lib.md) - Utility functions and helpers
15+
16+
- **[Diagrams](diagrams/)**: Visual representations of system architecture and workflows
17+
- [Architecture](diagrams/architecture.mmd) - Overall system architecture
18+
- [Data Flow](diagrams/data-flow.mmd) - Data processing flow
19+
- [Components](diagrams/components.mmd) - Component relationships
20+
- [Error Handling](diagrams/error-handling.mmd) - Error flow and handling
21+
- [Config Structure](diagrams/config-structure.mmd) - Configuration hierarchy
22+
- [Exchange Workflow](diagrams/exchange-workflow.mmd) - Exchange interaction patterns
23+
24+
- **[API Examples](api-examples.md)**: Practical usage examples and code snippets
25+
- **[Tests](tests.md)**: Testing documentation and examples
26+
27+
## Quick Start
28+
29+
[Add quick start instructions here]
30+
31+
## Contributing
32+
33+
[Add contribution guidelines here]
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# API Examples
2+
3+
## Basic Usage
4+
5+
### Initializing the Aggregator
6+
7+
```javascript
8+
// Example initialization
9+
const aggregator = new Aggregator(config);
10+
```
11+
12+
### Configuration Examples
13+
14+
```javascript
15+
// Example configuration
16+
const config = {
17+
// Add configuration examples here
18+
};
19+
```
20+
21+
### Data Processing Examples
22+
23+
```javascript
24+
// Example data processing
25+
const result = await aggregator.process(inputData);
26+
```
27+
28+
### Error Handling Examples
29+
30+
```javascript
31+
// Example error handling
32+
try {
33+
const result = await aggregator.process(inputData);
34+
} catch (error) {
35+
console.error('Processing failed:', error);
36+
}
37+
```
38+
39+
## Advanced Usage
40+
41+
### Custom Configurations
42+
43+
[Add advanced configuration examples here]
44+
45+
### Batch Processing
46+
47+
[Add batch processing examples here]
48+
49+
### Integration Examples
50+
51+
[Add integration examples here]
52+
53+
## Common Patterns
54+
55+
### Retry Logic
56+
57+
[Add retry logic examples here]
58+
59+
### Data Validation
60+
61+
[Add data validation examples here]
62+
63+
### Performance Optimization
64+
65+
[Add performance optimization examples here]
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
```mermaid
2+
graph TB
3+
subgraph "Aggregator Core"
4+
A[Aggregator Module] --> C[Config Module]
5+
A --> E[Error Module]
6+
A --> T[Types Module]
7+
A --> L[Lib Module]
8+
9+
C --> E
10+
T --> E
11+
L --> T
12+
end
13+
14+
subgraph "External Dependencies"
15+
API[External APIs]
16+
DB[Database]
17+
FS[File System]
18+
end
19+
20+
A --> API
21+
C --> FS
22+
A --> DB
23+
24+
subgraph "Application Layer"
25+
APP[Application]
26+
end
27+
28+
APP --> A
29+
APP --> C
30+
```
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
```mermaid
2+
classDiagram
3+
class Aggregator {
4+
+aggregate(data)
5+
+configure(config)
6+
+process()
7+
+getResults()
8+
}
9+
10+
class Config {
11+
+load(source)
12+
+validate()
13+
+get(key)
14+
+set(key, value)
15+
}
16+
17+
class Error {
18+
+handle(error)
19+
+log(message)
20+
+retry(operation)
21+
+classify(error)
22+
}
23+
24+
class Types {
25+
+DataType
26+
+ConfigType
27+
+ErrorType
28+
+ResultType
29+
}
30+
31+
class Lib {
32+
+utils()
33+
+helpers()
34+
+validators()
35+
+transformers()
36+
}
37+
38+
Aggregator --> Config
39+
Aggregator --> Error
40+
Aggregator --> Types
41+
Aggregator --> Lib
42+
Config --> Error
43+
Config --> Types
44+
Error --> Types
45+
Lib --> Types
46+
```
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
```mermaid
2+
graph TD
3+
Root[Configuration Root] --> App[Application Config]
4+
Root --> DB[Database Config]
5+
Root --> API[API Config]
6+
Root --> Log[Logging Config]
7+
8+
App --> AppName[app.name]
9+
App --> AppVersion[app.version]
10+
App --> AppEnv[app.environment]
11+
12+
DB --> DBHost[db.host]
13+
DB --> DBPort[db.port]
14+
DB --> DBName[db.name]
15+
DB --> DBCreds[db.credentials]
16+
17+
API --> APIEndpoint[api.endpoint]
18+
API --> APITimeout[api.timeout]
19+
API --> APIRetries[api.retries]
20+
API --> APIKeys[api.keys]
21+
22+
Log --> LogLevel[log.level]
23+
Log --> LogFormat[log.format]
24+
Log --> LogOutput[log.output]
25+
26+
subgraph "Configuration Sources"
27+
ENV[Environment Variables]
28+
FILE[Configuration Files]
29+
CLI[Command Line Args]
30+
DEFAULT[Default Values]
31+
end
32+
33+
Root --> ENV
34+
Root --> FILE
35+
Root --> CLI
36+
Root --> DEFAULT
37+
```
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
```mermaid
2+
flowchart LR
3+
Input[Input Data] --> Validate{Validate}
4+
Validate -->|Valid| Transform[Transform Data]
5+
Validate -->|Invalid| Error[Error Handler]
6+
7+
Transform --> Aggregate[Aggregate Data]
8+
Aggregate --> Process[Process Results]
9+
Process --> Output[Output Data]
10+
11+
Error --> Log[Log Error]
12+
Error --> Retry{Retry?}
13+
Retry -->|Yes| Transform
14+
Retry -->|No| Fail[Fail]
15+
16+
subgraph "Configuration"
17+
Config[Config Module]
18+
end
19+
20+
Config --> Validate
21+
Config --> Transform
22+
Config --> Aggregate
23+
```
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
```mermaid
2+
flowchart TD
3+
Start[Operation Start] --> Execute[Execute Operation]
4+
Execute --> Success{Success?}
5+
6+
Success -->|Yes| Complete[Operation Complete]
7+
Success -->|No| Classify[Classify Error]
8+
9+
Classify --> Retryable{Retryable?}
10+
Retryable -->|Yes| Retry[Retry Operation]
11+
Retryable -->|No| Fatal[Fatal Error]
12+
13+
Retry --> Backoff[Apply Backoff]
14+
Backoff --> MaxRetries{Max Retries?}
15+
MaxRetries -->|No| Execute
16+
MaxRetries -->|Yes| Fatal
17+
18+
Fatal --> Log[Log Error]
19+
Log --> Notify[Notify Handler]
20+
Notify --> Fail[Operation Failed]
21+
22+
subgraph "Error Types"
23+
ValidationError[Validation Error]
24+
NetworkError[Network Error]
25+
ConfigError[Config Error]
26+
SystemError[System Error]
27+
end
28+
29+
Classify --> ValidationError
30+
Classify --> NetworkError
31+
Classify --> ConfigError
32+
Classify --> SystemError
33+
```

0 commit comments

Comments
 (0)