Files
foxhunt/tli/examples/complete_client_example.rs
jgrusewski 6bd5b18465 🔧 Wave 33: Test Compilation Improvements - 57 errors remaining
**Progress: 1,178 → 57 test errors (95% reduction)**

## Status Summary
-  Production code: Compiles cleanly (0 errors)
- ⚠️  Test code: 57 errors remain (massive improvement)
- ⚙️  All services build successfully
- 📊 Warning count: 253 (target: <20) - AGENTS WILL FIX

## Remaining Test Errors (57 total)
### Primary Issues:
1. 23× E0308 mismatched types
2. 17× E0433 undeclared Decimal
3. 15× E0433 compliance module not found
4. 6× E0624 private method access
5. Various import and type issues

## Next Phase: Wave 33-2
Launch 10+ parallel agents to:
- Fix remaining 57 test compilation errors
- Reduce 253 warnings to <20
- Achieve 95% test coverage
- Ensure all tests pass

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-01 21:24:28 +02:00

121 lines
4.0 KiB
Rust

//! Complete TLI Client Example
//!
//! This example demonstrates how to use the TLI client infrastructure
//! to connect to both Trading Service and Backtesting Service.
use tli::prelude::*;
use tokio::time::{sleep, Duration};
use tracing::{error, info, warn};
#[tokio::main]
async fn main() -> TliResult<()> {
// Initialize logging
tracing_subscriber::fmt::init();
info!("Starting TLI Complete Client Example");
// Create client suite with both services
let mut client_suite = TliClientBuilder::new()
.with_service_endpoint(
"trading_service".to_string(),
"http://localhost:50051".to_string(),
)
.with_service_endpoint(
"backtesting_service".to_string(),
"http://localhost:50052".to_string(),
)
.with_trading_config(TradingClientConfig {
endpoint: "http://localhost:50051".to_string(),
timeout_ms: 10_000,
})
.with_backtesting_config(BacktestingClientConfig {
endpoint: "http://localhost:50052".to_string(),
timeout_ms: 10_000,
})
.build()
.await?;
info!("Client suite created successfully");
// Demonstrate trading operations
if let Some(mut trading_client) = client_suite.trading_client {
info!("Connecting to trading service...");
match trading_client.connect().await {
Ok(_) => {
info!("Connected to trading service successfully");
info!("Connection status: {}", trading_client.is_connected());
// Note: Actual trading operations would require implementing
// the gRPC service methods. This example shows the client setup.
info!("Trading client is ready for operations");
},
Err(e) => {
error!("Failed to connect to trading service: {}", e);
},
}
// Cleanup
trading_client.shutdown().await;
info!("Trading client shut down");
} else {
warn!("Trading client not available");
}
// Demonstrate backtesting operations
if let Some(mut backtesting_client) = client_suite.backtesting_client {
info!("Connecting to backtesting service...");
match backtesting_client.connect().await {
Ok(_) => {
info!("Connected to backtesting service successfully");
info!("Connection status: {}", backtesting_client.is_connected());
// Note: Actual backtesting operations would require implementing
// the gRPC service methods. This example shows the client setup.
info!("Backtesting client is ready for operations");
},
Err(e) => {
error!("Failed to connect to backtesting service: {}", e);
},
}
// Cleanup
backtesting_client.shutdown().await;
info!("Backtesting client shut down");
} else {
warn!("Backtesting client not available");
}
// Demonstrate ML training operations
if let Some(mut ml_client) = client_suite.ml_training_client {
info!("Connecting to ML training service...");
match ml_client.connect().await {
Ok(_) => {
info!("Connected to ML training service successfully");
info!("Connection status: {}", ml_client.is_connected());
// Note: Actual ML training operations would require implementing
// the gRPC service methods. This example shows the client setup.
info!("ML training client is ready for operations");
},
Err(e) => {
error!("Failed to connect to ML training service: {}", e);
},
}
// Cleanup
ml_client.shutdown().await;
info!("ML training client shut down");
} else {
warn!("ML training client not available");
}
// Allow some time for graceful shutdown
sleep(Duration::from_secs(1)).await;
info!("Example completed successfully");
Ok(())
}