deribit_http/model/response/margin.rs
1/******************************************************************************
2 Author: Joaquín Béjar García
3 Email: jb@taunais.com
4 Date: 7/3/26
5******************************************************************************/
6use pretty_simple_display::{DebugPretty, DisplaySimple};
7use serde::{Deserialize, Serialize};
8
9/// Response from the get_margins endpoint
10///
11/// Contains margin requirements for a hypothetical order on a given instrument.
12/// This is useful for estimating margin requirements before placing an order.
13#[derive(DebugPretty, DisplaySimple, Clone, Serialize, Deserialize)]
14pub struct MarginsResponse {
15 /// Margin required when buying
16 pub buy: f64,
17 /// Margin required when selling
18 pub sell: f64,
19 /// The minimum price for the future. Any sell orders submitted lower than
20 /// this price will be clamped to this minimum.
21 pub min_price: f64,
22 /// The maximum price for the future. Any buy orders submitted higher than
23 /// this price will be clamped to this maximum.
24 pub max_price: f64,
25}
26
27/// Response from the get_order_margin_by_ids endpoint
28///
29/// Contains initial margin requirements for an order identified by its ID.
30#[derive(DebugPretty, DisplaySimple, Clone, Serialize, Deserialize)]
31pub struct OrderMargin {
32 /// Unique order identifier
33 pub order_id: String,
34 /// Initial margin required for the order
35 pub initial_margin: f64,
36 /// Currency of the initial margin
37 pub initial_margin_currency: String,
38}