deriv_api_schema/
proposal_request.rs

1
2// Generated automatically by schema_generator.rs - DO NOT EDIT.
3// Source: ./deriv-api-docs/config/v3/proposal/send.json
4
5// Use direct crate names for imports
6use serde::{Deserialize, Serialize};
7use serde_json::Value;
8
9use chrono::{DateTime, Utc};
10
11// Import required types from the *same* crate
12use crate::contract_type::ContractType;
13use crate::limit_order::LimitOrder;
14use crate::barrier_range::BarrierRange;
15use crate::duration_unit::DurationUnit;
16
17/// Gets latest price for a specific contract.
18#[derive(Debug, Clone, Serialize, Deserialize)]
19#[serde(rename_all = "snake_case")]
20pub struct ProposalRequest {
21    /// [Optional] Proposed contract payout or stake, or multiplier (for lookbacks).\n
22    // Correct serde attribute construction - Use helper
23    #[serde(skip_serializing_if = "Option::is_none")] 
24    pub amount: Option<f64>,
25    /// [Optional] Barrier for the contract (or last digit prediction for digit contracts). Contracts less than 24 hours in duration would need a relative barrier (barriers which need +/-), where entry spot would be adjusted accordingly with that amount to define a barrier, except for Synthetic Indices as they support both relative and absolute barriers. Not needed for lookbacks.\n
26    // Correct serde attribute construction - Use helper
27    #[serde(skip_serializing_if = "Option::is_none")] 
28    pub barrier: Option<String>,
29    /// [Optional] Low barrier for the contract (for contracts with two barriers). Contracts less than 24 hours in duration would need a relative barrier (barriers which need +/-), where entry spot would be adjusted accordingly with that amount to define a barrier, except for Synthetic Indices as they support both relative and absolute barriers. Not needed for lookbacks.\n
30    // Correct serde attribute construction - Use helper
31    #[serde(skip_serializing_if = "Option::is_none")] 
32    pub barrier2: Option<String>,
33    /// [Optional] Barrier range for callputspread.\n
34    // Correct serde attribute construction - Use helper
35    #[serde(skip_serializing_if = "Option::is_none")] 
36    pub barrier_range: Option<BarrierRange>,
37    /// [Optional] Indicates type of the `amount`.\n
38    // Correct serde attribute construction - Use helper
39    #[serde(skip_serializing_if = "Option::is_none")] 
40    pub basis: Option<String>,
41    /// Cancellation duration option (only for `MULTUP` and `MULTDOWN` contracts).\n
42    // Correct serde attribute construction - Use helper
43    #[serde(skip_serializing_if = "Option::is_none")] 
44    pub cancellation: Option<String>,
45    /// The proposed contract type\n
46    // Correct serde attribute construction - Use helper
47    
48    pub contract_type: ContractType,
49    /// This can only be the account-holder's currency (obtained from `payout_currencies` call).\n
50    // Correct serde attribute construction - Use helper
51    
52    pub currency: String,
53    /// [Optional] Epoch value of the expiry time of the contract. Either date_expiry or duration is required.\n
54    // Correct serde attribute construction - Use helper
55    #[serde(skip_serializing_if = "Option::is_none")] 
56    pub date_expiry: Option<String>,
57    /// [Optional] Indicates epoch value of the starting time of the contract. If left empty, the start time of the contract is now.\n
58    // Correct serde attribute construction - Use helper
59    #[serde(skip_serializing_if = "Option::is_none")] 
60    pub date_start: Option<DateTime<Utc>>,
61    /// [Optional] Duration quantity. Either date_expiry or duration is required.\n
62    // Correct serde attribute construction - Use helper
63    #[serde(skip_serializing_if = "Option::is_none")] 
64    pub duration: Option<i64>,
65    /// [Optional] Duration unit - `s`: seconds, `m`: minutes, `h`: hours, `d`: days, `t`: ticks.\n
66    // Correct serde attribute construction - Use helper
67    #[serde(skip_serializing_if = "Option::is_none")] 
68    pub duration_unit: Option<DurationUnit>,
69    /// [Optional] Growth rate of an accumulator contract.\n
70    // Correct serde attribute construction - Use helper
71    #[serde(skip_serializing_if = "Option::is_none")] 
72    pub growth_rate: Option<f64>,
73    /// Add an order to close the contract once the order condition is met (only for `MULTUP` and `MULTDOWN` and 'ACCU' contracts). Supported orders: `take_profit`, `stop_loss`.\n
74    // Correct serde attribute construction - Use helper
75    #[serde(skip_serializing_if = "Option::is_none")] 
76    pub limit_order: Option<LimitOrder>,
77    /// [Optional] The login id of the user. Mandatory when multiple tokens were provided during authorize.\n
78    // Correct serde attribute construction - Use helper
79    #[serde(skip_serializing_if = "Option::is_none")] 
80    pub loginid: Option<String>,
81    /// [Optional] The multiplier for non-binary options. E.g. lookbacks.\n
82    // Correct serde attribute construction - Use helper
83    #[serde(skip_serializing_if = "Option::is_none")] 
84    pub multiplier: Option<f64>,
85    /// [Optional] Used to pass data through the websocket, which may be retrieved via the `echo_req` output field.\n
86    // Correct serde attribute construction - Use helper
87    #[serde(skip_serializing_if = "Option::is_none")] 
88    pub passthrough: Option<Value>,
89    /// [Optional] Clients can provide payout_per_point directly, and the barrier will be calculated based on this payout_per_point value.\n
90    // Correct serde attribute construction - Use helper
91    #[serde(skip_serializing_if = "Option::is_none")] 
92    pub payout_per_point: Option<String>,
93    /// [Optional] The product type.\n
94    // Correct serde attribute construction - Use helper
95    #[serde(skip_serializing_if = "Option::is_none")] 
96    pub product_type: Option<String>,
97    /// Field 'proposal' mapped to Value due to complexity/potential issues.\n
98    // Correct serde attribute construction - Use helper
99    
100    pub proposal: Value,
101    /// [Optional] Used to map request to response.\n
102    // Correct serde attribute construction - Use helper
103    #[serde(skip_serializing_if = "Option::is_none")] 
104    pub req_id: Option<i64>,
105    /// [Optional] The tick that is predicted to have the highest/lowest value - for `TICKHIGH` and `TICKLOW` contracts.\n
106    // Correct serde attribute construction - Use helper
107    #[serde(skip_serializing_if = "Option::is_none")] 
108    pub selected_tick: Option<String>,
109    /// [Optional] 1 - to initiate a realtime stream of prices. Note that tick trades (without a user-defined barrier), digit trades and less than 24 hours at-the-money contracts for the following underlying symbols are not streamed: `R_10`, `R_25`, `R_50`, `R_75`, `R_100`, `RDBULL`, `RDBEAR` (this is because their price is constant).\n
110    // Correct serde attribute construction - Use helper
111    #[serde(skip_serializing_if = "Option::is_none")] 
112    pub subscribe: Option<String>,
113    /// The short symbol name (obtained from `active_symbols` call).\n
114    // Correct serde attribute construction - Use helper
115    
116    pub symbol: String,
117    /// [Only for Snowball] The trade risk profile for the Snowball contract. Higher risk profile offers higher coupon rate at the expense of higher probability of breaching caution price\n
118    // Correct serde attribute construction - Use helper
119    #[serde(skip_serializing_if = "Option::is_none")] 
120    pub trade_risk_profile: Option<String>,
121    /// [Optional] Required only for multi-barrier trading. Defines the epoch value of the trading period start time.\n
122    // Correct serde attribute construction - Use helper
123    #[serde(skip_serializing_if = "Option::is_none")] 
124    pub trading_period_start: Option<DateTime<Utc>>,
125}
126