use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Deserialize)]
pub struct FuturesPosition {
pub product_id: String,
#[serde(default)]
pub expiration_time: Option<String>,
#[serde(default)]
pub side: Option<String>,
#[serde(default)]
pub number_of_contracts: Option<String>,
#[serde(default)]
pub current_price: Option<String>,
#[serde(default)]
pub avg_entry_price: Option<String>,
#[serde(default)]
pub unrealized_pnl: Option<String>,
#[serde(default)]
pub daily_realized_pnl: Option<String>,
}
#[derive(Debug, Clone, Deserialize)]
pub struct ListFuturesPositionsResponse {
#[serde(default)]
pub positions: Vec<FuturesPosition>,
}
#[derive(Debug, Clone, Deserialize)]
pub struct GetFuturesPositionResponse {
pub position: FuturesPosition,
}
#[derive(Debug, Clone, Deserialize)]
pub struct FuturesBalanceSummary {
#[serde(default)]
pub futures_buying_power: Option<String>,
#[serde(default)]
pub total_usd_balance: Option<String>,
#[serde(default)]
pub cbi_usd_balance: Option<String>,
#[serde(default)]
pub cfm_usd_balance: Option<String>,
#[serde(default)]
pub total_open_orders_hold_amount: Option<String>,
#[serde(default)]
pub unrealized_pnl: Option<String>,
#[serde(default)]
pub daily_realized_pnl: Option<String>,
#[serde(default)]
pub initial_margin: Option<String>,
#[serde(default)]
pub available_margin: Option<String>,
#[serde(default)]
pub liquidation_threshold: Option<String>,
#[serde(default)]
pub liquidation_buffer_amount: Option<String>,
#[serde(default)]
pub liquidation_buffer_percentage: Option<String>,
}
#[derive(Debug, Clone, Deserialize)]
pub struct GetFuturesBalanceSummaryResponse {
pub balance_summary: FuturesBalanceSummary,
}
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct IntradayMarginSetting {
#[serde(default)]
pub setting: Option<String>,
}
#[derive(Debug, Clone, Deserialize)]
pub struct GetIntradayMarginSettingResponse {
#[serde(default)]
pub setting: Option<String>,
}
#[derive(Debug, Clone, Deserialize)]
pub struct MarginWindow {
#[serde(default)]
pub margin_window_type: Option<String>,
#[serde(default)]
pub end_time: Option<String>,
#[serde(default)]
pub is_intraday_margin_killswitch_enabled: Option<bool>,
#[serde(default)]
pub is_intraday_margin_enrollment_killswitch_enabled: Option<bool>,
}
#[derive(Debug, Clone, Deserialize)]
pub struct GetCurrentMarginWindowResponse {
pub margin_window: MarginWindow,
}
#[derive(Debug, Clone, Default, Serialize)]
pub struct GetCurrentMarginWindowParams {
#[serde(skip_serializing_if = "Option::is_none")]
pub margin_profile_type: Option<String>,
}
impl GetCurrentMarginWindowParams {
pub fn new() -> Self {
Self::default()
}
pub fn margin_profile_type(mut self, margin_profile_type: impl Into<String>) -> Self {
self.margin_profile_type = Some(margin_profile_type.into());
self
}
}
#[derive(Debug, Clone, Deserialize)]
pub struct FuturesSweep {
#[serde(default)]
pub id: Option<String>,
#[serde(default)]
pub requested_amount: Option<String>,
#[serde(default)]
pub should_sweep_all: Option<bool>,
#[serde(default)]
pub status: Option<String>,
#[serde(default)]
pub scheduled_time: Option<String>,
}
#[derive(Debug, Clone, Deserialize)]
pub struct ListFuturesSweepsResponse {
#[serde(default)]
pub sweeps: Vec<FuturesSweep>,
}
#[derive(Debug, Clone, Serialize)]
pub struct ScheduleFuturesSweepRequest {
pub usd_amount: String,
}
impl ScheduleFuturesSweepRequest {
pub fn new(usd_amount: impl Into<String>) -> Self {
Self {
usd_amount: usd_amount.into(),
}
}
}
#[derive(Debug, Clone, Deserialize)]
pub struct ScheduleFuturesSweepResponse {
#[serde(default)]
pub success: bool,
}
#[derive(Debug, Clone, Serialize)]
pub struct SetIntradayMarginSettingRequest {
pub setting: String,
}
impl SetIntradayMarginSettingRequest {
pub fn new(setting: impl Into<String>) -> Self {
Self {
setting: setting.into(),
}
}
}