Skip to main content

rust_types/ledger_models/
position.rs

1#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
2#[repr(i32)]
3pub enum PositionStatusProto {
4    Unknown = 0,
5    /// This trade may never happen
6    Hypothetical = 1,
7    /// This trade is expected to happen, but hasn't been executed yet
8    Intended = 2,
9    /// Beneficial ownership changes related to this transaction are now legally binding
10    Executed = 3,
11}
12impl PositionStatusProto {
13    /// String value of the enum field names used in the ProtoBuf definition.
14    ///
15    /// The values are not transformed in any way and thus are considered stable
16    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
17    pub fn as_str_name(&self) -> &'static str {
18        match self {
19            PositionStatusProto::Unknown => "UNKNOWN",
20            PositionStatusProto::Hypothetical => "HYPOTHETICAL",
21            PositionStatusProto::Intended => "INTENDED",
22            PositionStatusProto::Executed => "EXECUTED",
23        }
24    }
25}
26#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
27#[repr(i32)]
28pub enum MeasureProto {
29    UnknownMeasure = 0,
30    DirectedQuantity = 1,
31    MarketValue = 2,
32    UnadjustedCostBasis = 3,
33    AdjustedCostBasis = 4,
34}
35impl MeasureProto {
36    /// String value of the enum field names used in the ProtoBuf definition.
37    ///
38    /// The values are not transformed in any way and thus are considered stable
39    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
40    pub fn as_str_name(&self) -> &'static str {
41        match self {
42            MeasureProto::UnknownMeasure => "UNKNOWN_MEASURE",
43            MeasureProto::DirectedQuantity => "DIRECTED_QUANTITY",
44            MeasureProto::MarketValue => "MARKET_VALUE",
45            MeasureProto::UnadjustedCostBasis => "UNADJUSTED_COST_BASIS",
46            MeasureProto::AdjustedCostBasis => "ADJUSTED_COST_BASIS",
47        }
48    }
49}
50#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
51#[repr(i32)]
52pub enum FieldProto {
53    UnknownField = 0,
54    /// (UUID.class)
55    Id = 1,
56    /// Attribute fields. Likely to be fields that one would pivot on.
57    ///
58    /// LocalDate.class
59    EffectiveDate = 10,
60    /// common.model.strategy.Strategy.class
61    Strategy = 11,
62    /// common.model.security.Security.class
63    Security = 12,
64    SecurityDescription = 61,
65    /// common.model.security.Security.class
66    CashImpactSecurity = 13,
67    /// Security Fields
68    ///
69    ///   AssetClass(String.class), //FixedIncome, Equity, etc
70    AssetClass = 50,
71    /// ProductClass(String.class), //Bond, CashEquity, etc
72    ProductClass = 51,
73    /// ProductType (String.class), //TBILL, BOND, etc
74    ProductType = 52,
75    SecurityId = 53,
76    Identifier = 54,
77    /// 1M
78    Tenor = 55,
79    MaturityDate = 56,
80    AdjustedTenor = 57,
81    /// Portfolio fields
82    ///
83    /// common.model.portfolio.Portfolio.class
84    Portfolio = 14,
85    /// UUID
86    PortfolioId = 15,
87    PortfolioName = 60,
88    /// common.model.price.Price.class
89    Price = 16,
90    /// UUID
91    PriceId = 17,
92    /// Boolean.class
93    IsCancelled = 18,
94    /// PositionStatus.class
95    PositionStatus = 19,
96    /// Transaction only
97    ///
98    /// TradeDate(LocalDate.class),
99    TradeDate = 30,
100    ///   SettlementDate(LocalDate.class),
101    SettlementDate = 31,
102    /// BUY, SELL, MATURATION, etc (TransactionType.class)
103    TransactionType = 32,
104    /// Tax Lot only
105    ///
106    ///   TaxLotOpenDate(LocalDate.class),
107    TaxLotOpenDate = 40,
108    ///   TaxLotCloseDate(LocalDate.class),
109    TaxLotCloseDate = 41,
110}
111impl FieldProto {
112    /// String value of the enum field names used in the ProtoBuf definition.
113    ///
114    /// The values are not transformed in any way and thus are considered stable
115    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
116    pub fn as_str_name(&self) -> &'static str {
117        match self {
118            FieldProto::UnknownField => "UNKNOWN_FIELD",
119            FieldProto::Id => "ID",
120            FieldProto::EffectiveDate => "EFFECTIVE_DATE",
121            FieldProto::Strategy => "STRATEGY",
122            FieldProto::Security => "SECURITY",
123            FieldProto::SecurityDescription => "SECURITY_DESCRIPTION",
124            FieldProto::CashImpactSecurity => "CASH_IMPACT_SECURITY",
125            FieldProto::AssetClass => "ASSET_CLASS",
126            FieldProto::ProductClass => "PRODUCT_CLASS",
127            FieldProto::ProductType => "PRODUCT_TYPE",
128            FieldProto::SecurityId => "SECURITY_ID",
129            FieldProto::Identifier => "IDENTIFIER",
130            FieldProto::Tenor => "TENOR",
131            FieldProto::MaturityDate => "MATURITY_DATE",
132            FieldProto::AdjustedTenor => "ADJUSTED_TENOR",
133            FieldProto::Portfolio => "PORTFOLIO",
134            FieldProto::PortfolioId => "PORTFOLIO_ID",
135            FieldProto::PortfolioName => "PORTFOLIO_NAME",
136            FieldProto::Price => "PRICE",
137            FieldProto::PriceId => "PRICE_ID",
138            FieldProto::IsCancelled => "IS_CANCELLED",
139            FieldProto::PositionStatus => "POSITION_STATUS",
140            FieldProto::TradeDate => "TRADE_DATE",
141            FieldProto::SettlementDate => "SETTLEMENT_DATE",
142            FieldProto::TransactionType => "TRANSACTION_TYPE",
143            FieldProto::TaxLotOpenDate => "TAX_LOT_OPEN_DATE",
144            FieldProto::TaxLotCloseDate => "TAX_LOT_CLOSE_DATE",
145        }
146    }
147}
148#[derive(Clone, PartialEq, ::prost::Message)]
149pub struct FieldMapEntry {
150    #[prost(enumeration = "FieldProto", tag = "1")]
151    pub field: i32,
152    /// Used for position filters, but not for responses
153    #[prost(enumeration = "PositionFilterOperator", tag = "20")]
154    pub operator: i32,
155    #[prost(oneof = "field_map_entry::FieldMapValueOneOf", tags = "4, 5, 6")]
156    pub field_map_value_one_of: ::core::option::Option<
157        field_map_entry::FieldMapValueOneOf,
158    >,
159}
160/// Nested message and enum types in `FieldMapEntry`.
161pub mod field_map_entry {
162    #[derive(Clone, PartialEq, ::prost::Oneof)]
163    pub enum FieldMapValueOneOf {
164        #[prost(message, tag = "4")]
165        FieldValuePacked(::prost_types::Any),
166        #[prost(string, tag = "5")]
167        EnumValue(::prost::alloc::string::String),
168        #[prost(message, tag = "6")]
169        Identifier(super::super::security::IdentifierProto),
170    }
171}
172#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
173#[repr(i32)]
174pub enum PositionFilterOperator {
175    UnknownOperator = 0,
176    Equals = 1,
177    NotEquals = 2,
178    LessThan = 3,
179    LessThanOrEquals = 4,
180    MoreThan = 5,
181    MoreThanOrEquals = 6,
182}
183impl PositionFilterOperator {
184    /// String value of the enum field names used in the ProtoBuf definition.
185    ///
186    /// The values are not transformed in any way and thus are considered stable
187    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
188    pub fn as_str_name(&self) -> &'static str {
189        match self {
190            PositionFilterOperator::UnknownOperator => "UNKNOWN_OPERATOR",
191            PositionFilterOperator::Equals => "EQUALS",
192            PositionFilterOperator::NotEquals => "NOT_EQUALS",
193            PositionFilterOperator::LessThan => "LESS_THAN",
194            PositionFilterOperator::LessThanOrEquals => "LESS_THAN_OR_EQUALS",
195            PositionFilterOperator::MoreThan => "MORE_THAN",
196            PositionFilterOperator::MoreThanOrEquals => "MORE_THAN_OR_EQUALS",
197        }
198    }
199}
200#[derive(Clone, PartialEq, ::prost::Message)]
201pub struct MeasureMapFieldEntry {
202    #[prost(enumeration = "MeasureProto", tag = "1")]
203    pub measure: i32,
204    #[prost(message, optional, tag = "2")]
205    pub measure_decimal_value: ::core::option::Option<super::util::DecimalValueProto>,
206}
207#[derive(Clone, PartialEq, ::prost::Message)]
208pub struct PositionProto {
209    #[prost(string, tag = "1")]
210    pub object_class: ::prost::alloc::string::String,
211    #[prost(string, tag = "2")]
212    pub version: ::prost::alloc::string::String,
213    #[prost(enumeration = "PositionViewProto", tag = "10")]
214    pub position_view: i32,
215    #[prost(enumeration = "PositionTypeProto", tag = "11")]
216    pub position_type: i32,
217    #[prost(message, repeated, tag = "20")]
218    pub measures: ::prost::alloc::vec::Vec<MeasureMapFieldEntry>,
219    #[prost(message, repeated, tag = "21")]
220    pub fields: ::prost::alloc::vec::Vec<FieldMapEntry>,
221}
222#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
223#[repr(i32)]
224pub enum PositionViewProto {
225    UnknownPositionView = 0,
226    DefaultView = 1,
227    StrategyView = 2,
228}
229impl PositionViewProto {
230    /// String value of the enum field names used in the ProtoBuf definition.
231    ///
232    /// The values are not transformed in any way and thus are considered stable
233    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
234    pub fn as_str_name(&self) -> &'static str {
235        match self {
236            PositionViewProto::UnknownPositionView => "UNKNOWN_POSITION_VIEW",
237            PositionViewProto::DefaultView => "DEFAULT_VIEW",
238            PositionViewProto::StrategyView => "STRATEGY_VIEW",
239        }
240    }
241}
242#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
243#[repr(i32)]
244pub enum PositionTypeProto {
245    UnknownPositionType = 0,
246    Transaction = 1,
247    TaxLot = 2,
248}
249impl PositionTypeProto {
250    /// String value of the enum field names used in the ProtoBuf definition.
251    ///
252    /// The values are not transformed in any way and thus are considered stable
253    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
254    pub fn as_str_name(&self) -> &'static str {
255        match self {
256            PositionTypeProto::UnknownPositionType => "UNKNOWN_POSITION_TYPE",
257            PositionTypeProto::Transaction => "TRANSACTION",
258            PositionTypeProto::TaxLot => "TAX_LOT",
259        }
260    }
261}
262#[derive(Clone, PartialEq, ::prost::Message)]
263pub struct PositionFilterProto {
264    #[prost(string, tag = "1")]
265    pub object_class: ::prost::alloc::string::String,
266    #[prost(string, tag = "2")]
267    pub version: ::prost::alloc::string::String,
268    #[prost(message, repeated, tag = "21")]
269    pub filters: ::prost::alloc::vec::Vec<FieldMapEntry>,
270}
271#[derive(Clone, PartialEq, ::prost::Message)]
272pub struct PositionRequestProto {
273    #[prost(string, tag = "1")]
274    pub object_class: ::prost::alloc::string::String,
275    #[prost(string, tag = "2")]
276    pub version: ::prost::alloc::string::String,
277    #[prost(enumeration = "super::util::RequestOperationTypeProto", tag = "10")]
278    pub operation_type: i32,
279    #[prost(enumeration = "PositionTypeProto", tag = "20")]
280    pub position_type: i32,
281    #[prost(enumeration = "PositionViewProto", tag = "21")]
282    pub position_view: i32,
283    #[prost(enumeration = "FieldProto", repeated, tag = "30")]
284    pub fields: ::prost::alloc::vec::Vec<i32>,
285    #[prost(enumeration = "MeasureProto", repeated, tag = "31")]
286    pub measures: ::prost::alloc::vec::Vec<i32>,
287    #[prost(message, optional, tag = "32")]
288    pub filter_fields: ::core::option::Option<PositionFilterProto>,
289    #[prost(message, optional, tag = "33")]
290    pub as_of: ::core::option::Option<super::util::LocalTimestampProto>,
291}
292#[derive(Clone, PartialEq, ::prost::Message)]
293pub struct PositionResponseProto {
294    #[prost(string, tag = "1")]
295    pub object_class: ::prost::alloc::string::String,
296    #[prost(string, tag = "2")]
297    pub version: ::prost::alloc::string::String,
298    #[prost(message, optional, tag = "11")]
299    pub position_request: ::core::option::Option<PositionRequestProto>,
300    /// TODO - Think about how to model this long term; ISO code vs. UUID vs. full security object
301    #[prost(string, tag = "12")]
302    pub reporting_currency: ::prost::alloc::string::String,
303    #[prost(message, repeated, tag = "30")]
304    pub positions: ::prost::alloc::vec::Vec<PositionProto>,
305}