kiteconnect_async_wasm/models/orders/
order_margin.rs1use serde::{Deserialize, Serialize};
2
3use crate::models::common::{Exchange, OrderType, Product, TransactionType, Variety};
4
5#[derive(Debug, Clone, Serialize, Deserialize)]
7pub struct OrderMarginRequest {
8 pub exchange: Exchange,
10
11 #[serde(rename = "tradingsymbol")]
13 pub trading_symbol: String,
14
15 #[serde(rename = "transaction_type")]
17 pub transaction_type: TransactionType,
18
19 pub variety: Variety,
21
22 pub product: Product,
24
25 #[serde(rename = "order_type")]
27 pub order_type: OrderType,
28
29 pub quantity: u32,
31
32 #[serde(skip_serializing_if = "Option::is_none")]
34 pub price: Option<f64>,
35
36 #[serde(rename = "trigger_price", skip_serializing_if = "Option::is_none")]
38 pub trigger_price: Option<f64>,
39}
40
41#[derive(Debug, Clone, Serialize, Deserialize, Default)]
45pub struct GstBreakup {
46 pub igst: f64,
47 pub cgst: f64,
48 pub sgst: f64,
49 pub total: f64,
50}
51
52#[derive(Debug, Clone, Serialize, Deserialize)]
54pub struct ChargesBreakdown {
55 pub total: f64,
57 pub transaction_tax: f64,
59 pub transaction_tax_type: String,
61 pub exchange_turnover_charge: f64,
63 pub sebi_turnover_charge: f64,
65 pub brokerage: f64,
67 pub stamp_duty: f64,
69 pub gst: GstBreakup,
71}
72
73#[derive(Debug, Clone, Serialize, Deserialize)]
75pub struct PnlBreakdown {
76 pub realised: f64,
77 pub unrealised: f64,
78}
79
80#[derive(Debug, Clone, Serialize, Deserialize)]
82pub struct OrderMarginResult {
83 #[serde(rename = "type")]
85 pub type_field: String,
86 #[serde(rename = "tradingsymbol")]
88 pub trading_symbol: String,
89 pub exchange: Exchange,
91
92 pub span: f64,
94 pub exposure: f64,
95 pub option_premium: f64,
96 pub additional: f64,
97 pub bo: f64,
98 pub cash: f64,
99 pub var: f64,
100
101 pub pnl: PnlBreakdown,
103 pub leverage: f64,
105 pub charges: ChargesBreakdown,
107 pub total: f64,
109}
110
111#[derive(Debug, Clone, Serialize, Deserialize)]
113pub struct BasketMarginsData {
114 pub initial: OrderMarginResult,
115 pub final_: OrderMarginResult,
116 pub orders: Vec<OrderMarginResult>,
117 pub charges: ChargesBreakdown,
118}
119
120#[derive(Debug, Clone, Serialize, Deserialize)]
122pub struct BasketMarginsResponse {
123 #[serde(flatten)]
124 pub data: BasketMarginsData,
125}
126
127#[derive(Debug, Clone, Serialize, Deserialize)]
131pub struct OrderChargesRequest {
132 pub order_id: String,
134 pub exchange: Exchange,
135 #[serde(rename = "tradingsymbol")]
136 pub trading_symbol: String,
137 #[serde(rename = "transaction_type")]
138 pub transaction_type: TransactionType,
139 pub variety: Variety,
140 pub product: Product,
141 #[serde(rename = "order_type")]
142 pub order_type: OrderType,
143 pub quantity: u32,
144 #[serde(rename = "average_price")]
146 pub average_price: f64,
147}
148
149#[derive(Debug, Clone, Serialize, Deserialize)]
151pub struct OrderChargesResult {
152 #[serde(rename = "transaction_type")]
153 pub transaction_type: TransactionType,
154 #[serde(rename = "tradingsymbol")]
155 pub trading_symbol: String,
156 pub exchange: Exchange,
157 pub variety: Variety,
158 pub product: Product,
159 #[serde(rename = "order_type")]
160 pub order_type: OrderType,
161 pub quantity: u32,
162 pub price: f64,
163 pub charges: ChargesBreakdown,
164}