deribit_base/model/position.rs
1/******************************************************************************
2 Author: Joaquín Béjar García
3 Email: jb@taunais.com
4 Date: 21/7/25
5******************************************************************************/
6use crate::{impl_json_debug_pretty, impl_json_display};
7use serde::{Deserialize, Serialize};
8
9/// Position information
10#[derive(Clone, Serialize, Deserialize)]
11pub struct Position {
12 /// Trading symbol/instrument name
13 pub symbol: String,
14 /// Position quantity (positive for long, negative for short)
15 pub quantity: f64,
16 /// Average price of the position
17 pub average_price: f64,
18 /// Unrealized profit and loss
19 pub unrealized_pnl: f64,
20 /// Realized profit and loss
21 pub realized_pnl: f64,
22}
23
24impl_json_debug_pretty!(Position);
25impl_json_display!(Position);