use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum OrderType {
BuyLimit,
SellLimit,
BuyMarket,
SellMarket,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum OrderState {
Submitted,
PartialFilled,
PartialCanceled,
Filled,
Canceled,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CreateOrderRequest {
pub account_id: String,
pub symbol: String,
pub order_type: OrderType,
pub source: String,
pub amount: f64,
pub price: Option<f64>,
pub client_order_id: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CreateOrderResponse {
pub order_id: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct OrderDetail {
pub order_id: String,
pub symbol: String,
pub account_id: String,
pub order_type: OrderType,
pub state: OrderState,
pub amount: f64,
pub price: Option<f64>,
pub filled_amount: Option<f64>,
pub created_at: Option<u64>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CancelOrderRequest {
pub symbol: String,
pub order_id: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CancelOrderResponse {
pub order_id: String,
pub status: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GetOrderRequest {
pub order_id: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GetOrderResponse {
pub detail: OrderDetail,
}