- Add AllocatePortfolioArgs struct with validation
- Support 5 allocation strategies (equal-weight, risk-parity, ml-optimized, mean-variance, kelly)
- Implement constraint validation (0 < min < max < 1.0, positive capital)
- Real gRPC integration with Trading Agent Service via API Gateway
- Formatted table output with portfolio allocations and risk metrics
- JWT authentication support via Bearer token in gRPC metadata
- 15 comprehensive TDD integration tests (all passing)
- Case-insensitive strategy parsing
Test Results: cargo test -p tli --test agent_commands_test
✅ 15 passed, 0 failed
Files:
- tli/src/commands/agent.rs (NEW - 466 lines)
- tli/src/commands/mod.rs (export AgentArgs)
- tli/src/main.rs (integrate agent command)
- tli/tests/agent_commands_test.rs (NEW - 15 tests)
- tli/proto/trading_agent.proto (NEW)
Co-authored-by: Wave 12.3.3 TDD Implementation
37 lines
1.4 KiB
Rust
37 lines
1.4 KiB
Rust
// use prost_build as _; // Not directly used
|
|
|
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
// Configure tonic-prost-build for proto compilation (Tonic 0.14+)
|
|
tonic_prost_build::configure()
|
|
.build_server(false) // TLI is client-only
|
|
.build_client(true)
|
|
// Force correct protobuf attributes for all messages
|
|
.type_attribute(".", "#[derive(serde::Serialize, serde::Deserialize)]")
|
|
// Suppress warnings in generated code
|
|
.server_mod_attribute(".", "#[allow(unused_qualifications)]")
|
|
.client_mod_attribute(".", "#[allow(unused_qualifications)]")
|
|
// Enable proper protobuf derives
|
|
.protoc_arg("--experimental_allow_proto3_optional")
|
|
.compile_protos(
|
|
&[
|
|
"proto/trading.proto",
|
|
"proto/health.proto",
|
|
"proto/ml.proto",
|
|
"proto/config.proto",
|
|
"proto/ml_training.proto",
|
|
"proto/trading_agent.proto",
|
|
],
|
|
&["proto"],
|
|
)?;
|
|
|
|
// Tell cargo to recompile if proto files change
|
|
println!("cargo:rerun-if-changed=proto/trading.proto");
|
|
println!("cargo:rerun-if-changed=proto/health.proto");
|
|
println!("cargo:rerun-if-changed=proto/ml.proto");
|
|
println!("cargo:rerun-if-changed=proto/config.proto");
|
|
println!("cargo:rerun-if-changed=proto/ml_training.proto");
|
|
println!("cargo:rerun-if-changed=proto/trading_agent.proto");
|
|
|
|
Ok(())
|
|
}
|