hypercall_margin/
types.rs1use hypercall_types::WalletAddress;
2use rust_decimal::Decimal;
3use serde::{Deserialize, Serialize};
4use std::collections::HashMap;
5
6#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
7pub enum OptionType {
8 Call,
9 Put,
10}
11
12#[derive(Debug, Clone)]
13pub struct OptionContract {
14 pub option_type: OptionType,
15 pub strike: Decimal,
16 pub expiry_ts: i64,
17 pub expiry: Decimal,
18 pub quantity: Decimal,
19 pub entry_price: Decimal,
20}
21
22#[derive(Debug, Clone)]
23pub struct Position {
24 pub spot: Decimal,
25 pub delta: Decimal,
26 pub perp_unrealized_pnl: Decimal,
27 pub options: Vec<OptionContract>,
28}
29
30#[derive(Debug, Clone)]
31pub struct Account {
32 pub id: WalletAddress,
33 pub portfolio: HashMap<String, Position>,
34 pub cash: f64,
35 pub address: Option<WalletAddress>,
36}
37
38#[derive(Debug, Clone)]
39pub struct MarginDetails {
40 pub account_id: WalletAddress,
41 pub scanning_risk: Decimal,
42 pub option_floor: Decimal,
43 pub gamma_overlay: Decimal,
44 pub net_option_value: Decimal,
45 pub equity: Decimal,
46 pub initial_margin_required: Decimal,
47 pub maintenance_margin_required: Decimal,
48}
49
50#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
51pub enum ScenarioType {
52 SpotChange,
53 VolChange,
54 SkewChange,
55 KurtosisChange,
56}
57
58#[derive(Debug, Clone, Serialize, Deserialize)]
59pub struct Scenario {
60 pub scenario_type: ScenarioType,
61 pub value: f64,
62}