ledger_models/
fintekkers.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    /// Hypothetical status means a transaction, tax lot or position that may never occur. This can be used to understand how potential actions could impact a portfolio
6    Hypothetical = 1,
7    /// Intended status means a transaction, tax lot or position that is expected to occur if nothing changes. For example a fixed income bond that is expected to pay a coupon, or a security that is expected to mature in a specific point in the future
8    Intended = 2,
9    /// Executed status means a transaction, tax lot or position that is the result of a legally binding transaction
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    /// Creates an enum from field names used in the ProtoBuf definition.
26    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
27        match value {
28            "UNKNOWN" => Some(Self::Unknown),
29            "HYPOTHETICAL" => Some(Self::Hypothetical),
30            "INTENDED" => Some(Self::Intended),
31            "EXECUTED" => Some(Self::Executed),
32            _ => None,
33        }
34    }
35}
36#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
37#[repr(i32)]
38pub enum MeasureProto {
39    UnknownMeasure = 0,
40    DirectedQuantity = 1,
41    MarketValue = 2,
42    UnadjustedCostBasis = 3,
43    AdjustedCostBasis = 4,
44    /// The current yield of the security, essentially coupon / current price. The price can be
45    /// unadjusted cost basis, adjusted cost basis, market value, and so on. This is a bond-centric
46    /// calculation. For equity securities, the TTM dividends will be used as a coupon equivalent (not
47    /// currently supported).
48    CurrentYield = 5,
49    /// The yield if the security is held to maturity. For equities, this will be blank.
50    /// For bonds this will be calculated as: <https://www.wallstreetprep.com/knowledge/yield-to-maturity-ytm/>
51    /// For TIPS, no future inflation adjustments to principal will be included.
52    /// For FRNs, the assumption is the floating rate doesn't change between now and maturity.
53    /// In the future, context-overrides will allow customization of these assumptions
54    YieldToMaturity = 7,
55}
56impl MeasureProto {
57    /// String value of the enum field names used in the ProtoBuf definition.
58    ///
59    /// The values are not transformed in any way and thus are considered stable
60    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
61    pub fn as_str_name(&self) -> &'static str {
62        match self {
63            MeasureProto::UnknownMeasure => "UNKNOWN_MEASURE",
64            MeasureProto::DirectedQuantity => "DIRECTED_QUANTITY",
65            MeasureProto::MarketValue => "MARKET_VALUE",
66            MeasureProto::UnadjustedCostBasis => "UNADJUSTED_COST_BASIS",
67            MeasureProto::AdjustedCostBasis => "ADJUSTED_COST_BASIS",
68            MeasureProto::CurrentYield => "CURRENT_YIELD",
69            MeasureProto::YieldToMaturity => "YIELD_TO_MATURITY",
70        }
71    }
72    /// Creates an enum from field names used in the ProtoBuf definition.
73    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
74        match value {
75            "UNKNOWN_MEASURE" => Some(Self::UnknownMeasure),
76            "DIRECTED_QUANTITY" => Some(Self::DirectedQuantity),
77            "MARKET_VALUE" => Some(Self::MarketValue),
78            "UNADJUSTED_COST_BASIS" => Some(Self::UnadjustedCostBasis),
79            "ADJUSTED_COST_BASIS" => Some(Self::AdjustedCostBasis),
80            "CURRENT_YIELD" => Some(Self::CurrentYield),
81            "YIELD_TO_MATURITY" => Some(Self::YieldToMaturity),
82            _ => None,
83        }
84    }
85}
86#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
87#[repr(i32)]
88pub enum FieldProto {
89    UnknownField = 0,
90    /// (UUID.class)
91    Id = 1,
92    /// ZonedDateTime
93    AsOf = 2,
94    /// Attribute fields. Likely to be fields that one would pivot on.
95    ///
96    /// LocalDate.class
97    EffectiveDate = 10,
98    /// common.model.strategy.Strategy.class
99    Strategy = 11,
100    /// common.model.security.Security.class
101    Security = 12,
102    SecurityDescription = 61,
103    SecurityIssuerName = 62,
104    /// common.model.security.Security.class
105    CashImpactSecurity = 13,
106    /// Security Fields
107    ///
108    ///   AssetClass(String.class), //FixedIncome, Equity, etc
109    AssetClass = 50,
110    /// ProductClass(String.class), //Bond, CashEquity, etc
111    ProductClass = 51,
112    /// ProductType (String.class), //TBILL, BOND, etc
113    ProductType = 52,
114    SecurityId = 53,
115    Identifier = 54,
116    /// 1M
117    Tenor = 55,
118    IssueDate = 58,
119    MaturityDate = 56,
120    AdjustedTenor = 57,
121    /// Portfolio fields
122    ///
123    /// common.model.portfolio.Portfolio.class
124    Portfolio = 14,
125    /// UUID
126    PortfolioId = 15,
127    PortfolioName = 60,
128    /// Miscellaneous
129    ///
130    /// common.model.price.Price.class
131    Price = 16,
132    /// UUID
133    PriceId = 17,
134    /// Boolean.class
135    IsCancelled = 18,
136    /// PositionStatus.class
137    PositionStatus = 19,
138    /// Transaction only
139    ///
140    /// TradeDate(LocalDate.class),
141    TradeDate = 30,
142    ///   SettlementDate(LocalDate.class),
143    SettlementDate = 31,
144    /// BUY, SELL, MATURATION, etc (TransactionType.class)
145    TransactionType = 32,
146    /// Tax Lot only
147    ///
148    ///   TaxLotOpenDate(LocalDate.class),
149    TaxLotOpenDate = 40,
150    ///   TaxLotCloseDate(LocalDate.class),
151    TaxLotCloseDate = 41,
152}
153impl FieldProto {
154    /// String value of the enum field names used in the ProtoBuf definition.
155    ///
156    /// The values are not transformed in any way and thus are considered stable
157    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
158    pub fn as_str_name(&self) -> &'static str {
159        match self {
160            FieldProto::UnknownField => "UNKNOWN_FIELD",
161            FieldProto::Id => "ID",
162            FieldProto::AsOf => "AS_OF",
163            FieldProto::EffectiveDate => "EFFECTIVE_DATE",
164            FieldProto::Strategy => "STRATEGY",
165            FieldProto::Security => "SECURITY",
166            FieldProto::SecurityDescription => "SECURITY_DESCRIPTION",
167            FieldProto::SecurityIssuerName => "SECURITY_ISSUER_NAME",
168            FieldProto::CashImpactSecurity => "CASH_IMPACT_SECURITY",
169            FieldProto::AssetClass => "ASSET_CLASS",
170            FieldProto::ProductClass => "PRODUCT_CLASS",
171            FieldProto::ProductType => "PRODUCT_TYPE",
172            FieldProto::SecurityId => "SECURITY_ID",
173            FieldProto::Identifier => "IDENTIFIER",
174            FieldProto::Tenor => "TENOR",
175            FieldProto::IssueDate => "ISSUE_DATE",
176            FieldProto::MaturityDate => "MATURITY_DATE",
177            FieldProto::AdjustedTenor => "ADJUSTED_TENOR",
178            FieldProto::Portfolio => "PORTFOLIO",
179            FieldProto::PortfolioId => "PORTFOLIO_ID",
180            FieldProto::PortfolioName => "PORTFOLIO_NAME",
181            FieldProto::Price => "PRICE",
182            FieldProto::PriceId => "PRICE_ID",
183            FieldProto::IsCancelled => "IS_CANCELLED",
184            FieldProto::PositionStatus => "POSITION_STATUS",
185            FieldProto::TradeDate => "TRADE_DATE",
186            FieldProto::SettlementDate => "SETTLEMENT_DATE",
187            FieldProto::TransactionType => "TRANSACTION_TYPE",
188            FieldProto::TaxLotOpenDate => "TAX_LOT_OPEN_DATE",
189            FieldProto::TaxLotCloseDate => "TAX_LOT_CLOSE_DATE",
190        }
191    }
192    /// Creates an enum from field names used in the ProtoBuf definition.
193    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
194        match value {
195            "UNKNOWN_FIELD" => Some(Self::UnknownField),
196            "ID" => Some(Self::Id),
197            "AS_OF" => Some(Self::AsOf),
198            "EFFECTIVE_DATE" => Some(Self::EffectiveDate),
199            "STRATEGY" => Some(Self::Strategy),
200            "SECURITY" => Some(Self::Security),
201            "SECURITY_DESCRIPTION" => Some(Self::SecurityDescription),
202            "SECURITY_ISSUER_NAME" => Some(Self::SecurityIssuerName),
203            "CASH_IMPACT_SECURITY" => Some(Self::CashImpactSecurity),
204            "ASSET_CLASS" => Some(Self::AssetClass),
205            "PRODUCT_CLASS" => Some(Self::ProductClass),
206            "PRODUCT_TYPE" => Some(Self::ProductType),
207            "SECURITY_ID" => Some(Self::SecurityId),
208            "IDENTIFIER" => Some(Self::Identifier),
209            "TENOR" => Some(Self::Tenor),
210            "ISSUE_DATE" => Some(Self::IssueDate),
211            "MATURITY_DATE" => Some(Self::MaturityDate),
212            "ADJUSTED_TENOR" => Some(Self::AdjustedTenor),
213            "PORTFOLIO" => Some(Self::Portfolio),
214            "PORTFOLIO_ID" => Some(Self::PortfolioId),
215            "PORTFOLIO_NAME" => Some(Self::PortfolioName),
216            "PRICE" => Some(Self::Price),
217            "PRICE_ID" => Some(Self::PriceId),
218            "IS_CANCELLED" => Some(Self::IsCancelled),
219            "POSITION_STATUS" => Some(Self::PositionStatus),
220            "TRADE_DATE" => Some(Self::TradeDate),
221            "SETTLEMENT_DATE" => Some(Self::SettlementDate),
222            "TRANSACTION_TYPE" => Some(Self::TransactionType),
223            "TAX_LOT_OPEN_DATE" => Some(Self::TaxLotOpenDate),
224            "TAX_LOT_CLOSE_DATE" => Some(Self::TaxLotCloseDate),
225            _ => None,
226        }
227    }
228}
229#[allow(clippy::derive_partial_eq_without_eq)]
230#[derive(Clone, PartialEq, ::prost::Message)]
231pub struct MeasureMapEntry {
232    #[prost(enumeration = "MeasureProto", tag = "1")]
233    pub measure: i32,
234    #[prost(message, optional, tag = "2")]
235    pub measure_decimal_value: ::core::option::Option<super::util::DecimalValueProto>,
236}
237#[allow(clippy::derive_partial_eq_without_eq)]
238#[derive(Clone, PartialEq, ::prost::Message)]
239pub struct FieldMapEntry {
240    #[prost(enumeration = "FieldProto", tag = "1")]
241    pub field: i32,
242    /// Used for position filters, but not for responses
243    #[prost(enumeration = "PositionFilterOperator", tag = "20")]
244    pub operator: i32,
245    #[prost(oneof = "field_map_entry::FieldMapValueOneOf", tags = "4, 5, 6")]
246    pub field_map_value_one_of: ::core::option::Option<
247        field_map_entry::FieldMapValueOneOf,
248    >,
249}
250/// Nested message and enum types in `FieldMapEntry`.
251pub mod field_map_entry {
252    #[allow(clippy::derive_partial_eq_without_eq)]
253    #[derive(Clone, PartialEq, ::prost::Oneof)]
254    pub enum FieldMapValueOneOf {
255        /// If the field is a 'complex' proto type (e.g. a full enum) we serialize the enum and wrap it in an Any. You can think of the Any as a string describing the type, and a binary of the proto itself
256        #[prost(message, tag = "4")]
257        FieldValuePacked(::prost_types::Any),
258        /// If the field is an enum type, then we use the number to denote which value it is
259        #[prost(int32, tag = "5")]
260        EnumValue(i32),
261        /// If the field is a string type, we just serialize the string (packing has an overhead)
262        #[prost(string, tag = "6")]
263        StringValue(::prost::alloc::string::String),
264    }
265}
266#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
267#[repr(i32)]
268pub enum PositionFilterOperator {
269    UnknownOperator = 0,
270    Equals = 1,
271    NotEquals = 2,
272    LessThan = 3,
273    LessThanOrEquals = 4,
274    MoreThan = 5,
275    MoreThanOrEquals = 6,
276}
277impl PositionFilterOperator {
278    /// String value of the enum field names used in the ProtoBuf definition.
279    ///
280    /// The values are not transformed in any way and thus are considered stable
281    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
282    pub fn as_str_name(&self) -> &'static str {
283        match self {
284            PositionFilterOperator::UnknownOperator => "UNKNOWN_OPERATOR",
285            PositionFilterOperator::Equals => "EQUALS",
286            PositionFilterOperator::NotEquals => "NOT_EQUALS",
287            PositionFilterOperator::LessThan => "LESS_THAN",
288            PositionFilterOperator::LessThanOrEquals => "LESS_THAN_OR_EQUALS",
289            PositionFilterOperator::MoreThan => "MORE_THAN",
290            PositionFilterOperator::MoreThanOrEquals => "MORE_THAN_OR_EQUALS",
291        }
292    }
293    /// Creates an enum from field names used in the ProtoBuf definition.
294    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
295        match value {
296            "UNKNOWN_OPERATOR" => Some(Self::UnknownOperator),
297            "EQUALS" => Some(Self::Equals),
298            "NOT_EQUALS" => Some(Self::NotEquals),
299            "LESS_THAN" => Some(Self::LessThan),
300            "LESS_THAN_OR_EQUALS" => Some(Self::LessThanOrEquals),
301            "MORE_THAN" => Some(Self::MoreThan),
302            "MORE_THAN_OR_EQUALS" => Some(Self::MoreThanOrEquals),
303            _ => None,
304        }
305    }
306}
307#[allow(clippy::derive_partial_eq_without_eq)]
308#[derive(Clone, PartialEq, ::prost::Message)]
309pub struct PositionProto {
310    #[prost(string, tag = "1")]
311    pub object_class: ::prost::alloc::string::String,
312    #[prost(string, tag = "2")]
313    pub version: ::prost::alloc::string::String,
314    #[prost(enumeration = "PositionViewProto", tag = "10")]
315    pub position_view: i32,
316    #[prost(enumeration = "PositionTypeProto", tag = "11")]
317    pub position_type: i32,
318    #[prost(message, repeated, tag = "20")]
319    pub measures: ::prost::alloc::vec::Vec<MeasureMapEntry>,
320    #[prost(message, repeated, tag = "21")]
321    pub fields: ::prost::alloc::vec::Vec<FieldMapEntry>,
322}
323#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
324#[repr(i32)]
325pub enum PositionViewProto {
326    UnknownPositionView = 0,
327    DefaultView = 1,
328    StrategyView = 2,
329}
330impl PositionViewProto {
331    /// String value of the enum field names used in the ProtoBuf definition.
332    ///
333    /// The values are not transformed in any way and thus are considered stable
334    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
335    pub fn as_str_name(&self) -> &'static str {
336        match self {
337            PositionViewProto::UnknownPositionView => "UNKNOWN_POSITION_VIEW",
338            PositionViewProto::DefaultView => "DEFAULT_VIEW",
339            PositionViewProto::StrategyView => "STRATEGY_VIEW",
340        }
341    }
342    /// Creates an enum from field names used in the ProtoBuf definition.
343    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
344        match value {
345            "UNKNOWN_POSITION_VIEW" => Some(Self::UnknownPositionView),
346            "DEFAULT_VIEW" => Some(Self::DefaultView),
347            "STRATEGY_VIEW" => Some(Self::StrategyView),
348            _ => None,
349        }
350    }
351}
352#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
353#[repr(i32)]
354pub enum PositionTypeProto {
355    UnknownPositionType = 0,
356    Transaction = 1,
357    TaxLot = 2,
358}
359impl PositionTypeProto {
360    /// String value of the enum field names used in the ProtoBuf definition.
361    ///
362    /// The values are not transformed in any way and thus are considered stable
363    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
364    pub fn as_str_name(&self) -> &'static str {
365        match self {
366            PositionTypeProto::UnknownPositionType => "UNKNOWN_POSITION_TYPE",
367            PositionTypeProto::Transaction => "TRANSACTION",
368            PositionTypeProto::TaxLot => "TAX_LOT",
369        }
370    }
371    /// Creates an enum from field names used in the ProtoBuf definition.
372    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
373        match value {
374            "UNKNOWN_POSITION_TYPE" => Some(Self::UnknownPositionType),
375            "TRANSACTION" => Some(Self::Transaction),
376            "TAX_LOT" => Some(Self::TaxLot),
377            _ => None,
378        }
379    }
380}
381#[allow(clippy::derive_partial_eq_without_eq)]
382#[derive(Clone, PartialEq, ::prost::Message)]
383pub struct PositionFilterProto {
384    #[prost(string, tag = "1")]
385    pub object_class: ::prost::alloc::string::String,
386    #[prost(string, tag = "2")]
387    pub version: ::prost::alloc::string::String,
388    #[prost(message, repeated, tag = "21")]
389    pub filters: ::prost::alloc::vec::Vec<FieldMapEntry>,
390}