Skip to main content

hyper_agent_client/
types.rs

1use serde::{Deserialize, Serialize};
2
3// Requests
4#[derive(Debug, Serialize)]
5pub struct RunStrategyRequest {
6    pub id: String,
7    pub symbol: Option<String>,
8    pub symbols: Option<Vec<String>>,
9    pub paper: Option<bool>,
10    pub confirm_live: Option<bool>,
11    pub agent_loop: Option<bool>,
12    pub agent_interval: Option<u64>,
13    pub tick_interval: Option<u64>,
14}
15
16#[derive(Debug, Serialize)]
17pub struct PlaceOrderRequest {
18    pub market: String,
19    pub side: String,
20    pub size: f64,
21    pub price: Option<f64>,
22    pub live: Option<bool>, // true = live, false/None = paper (safest default)
23}
24
25// Responses
26#[derive(Debug, Deserialize, Serialize)]
27pub struct ServerStatus {
28    pub status: String,
29    pub version: String,
30    pub uptime_secs: i64,
31    pub engines_count: usize,
32}
33
34#[derive(Debug, Deserialize, Serialize)]
35pub struct StrategyInfo {
36    pub id: String,
37    pub symbols: Vec<String>,
38    pub status: serde_json::Value, // EngineStatus is complex, keep as Value for now
39}
40
41#[derive(Debug, Deserialize, Serialize)]
42pub struct OrderResponse {
43    pub order_id: String,
44    pub filled_price: f64,
45    pub filled_size: f64,
46    pub status: String,
47}
48
49#[derive(Debug, Deserialize, Serialize)]
50pub struct PositionInfo {
51    pub id: String,
52    pub market: String,
53    pub side: String,
54    pub size: f64,
55    pub entry_price: f64,
56    pub current_price: Option<f64>,
57    pub pnl: Option<f64>,
58    pub mode: String,
59    pub status: String,
60}
61
62#[derive(Debug, Deserialize, Serialize)]
63pub struct DashboardStats {
64    pub engines_running: u32,
65    pub open_positions: u32,
66    pub total_pnl: f64,
67    pub uptime_secs: Option<i64>,
68}
69
70#[derive(Debug, Deserialize, Serialize)]
71pub struct PnlPoint {
72    pub timestamp: String,
73    pub pnl: f64,
74}
75
76#[derive(Debug, Deserialize, Serialize)]
77pub struct ExecutionQuality {
78    pub total_orders: u64,
79    pub full_fills: u64,
80    pub partial_fills: u64,
81    pub zero_fills: u64,
82    pub avg_fill_rate_pct: f64,
83}
84
85#[derive(Debug, Deserialize, Serialize)]
86pub struct HealthResponse {
87    pub status: String,
88    pub version: String,
89}