use crate::transaction::{Action, ActionMeta};
use serde::{Deserialize, Serialize};
use std::sync::Arc;
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct StopOrTP {
#[serde(rename = "c")]
pub symbol: Arc<str>,
#[serde(rename = "d")]
pub is_above: bool,
#[serde(rename = "sz", with = "crate::msgs::fixed_point")]
pub size: f64,
#[serde(rename = "tr", with = "crate::msgs::fixed_point")]
pub threshold: f64,
#[serde(
rename = "lim",
with = "crate::msgs::opt_fixed_point",
default = "default_limit"
)]
pub limit: Option<f64>,
#[serde(skip)]
pub meta: ActionMeta,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Range {
#[serde(rename = "c")]
pub symbol: Arc<str>,
#[serde(rename = "d")]
pub is_buy: bool,
#[serde(rename = "sz", with = "crate::msgs::fixed_point")]
pub size: f64,
#[serde(rename = "pmin", with = "crate::msgs::fixed_point")]
pub collar_min: f64,
#[serde(rename = "pmax", with = "crate::msgs::fixed_point")]
pub collar_max: f64,
#[serde(
rename = "lmin",
with = "crate::msgs::opt_fixed_point",
default = "default_limit"
)]
pub limit_min: Option<f64>,
#[serde(
rename = "lmax",
with = "crate::msgs::opt_fixed_point",
default = "default_limit"
)]
pub limit_max: Option<f64>,
#[serde(skip)]
pub meta: ActionMeta,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Trigger {
#[serde(rename = "c")]
pub symbol: Arc<str>,
#[serde(rename = "d")]
pub is_above: bool,
#[serde(rename = "tr", with = "crate::msgs::fixed_point")]
pub threshold: f64,
pub actions: Vec<Action>,
#[serde(skip)]
pub meta: ActionMeta,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Trailing {
#[serde(rename = "c")]
pub symbol: Arc<str>,
#[serde(rename = "b")]
pub is_buy: bool,
#[serde(rename = "sz", with = "crate::msgs::fixed_point")]
pub size: f64,
#[serde(rename = "trb")]
pub trail_bps: u32,
#[serde(rename = "stb")]
pub step_bps: u32,
#[serde(
rename = "lim",
with = "crate::msgs::opt_fixed_point",
default = "default_limit"
)]
pub limit: Option<f64>,
#[serde(skip)]
pub meta: ActionMeta,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct OnFill {
#[serde(rename = "p")]
pub parent_seqno: u32,
pub actions: Vec<Action>,
#[serde(skip)]
pub meta: ActionMeta,
}
fn default_limit() -> Option<f64> {
None
}