C# Client Library
A C# Client Library for the AnalyzeRe REST API
Loading...
Searching...
No Matches
PortfolioView.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Runtime.Serialization;
5
8
9namespace AnalyzeRe
10{
13 {
14 #region Private Attributes
17 internal class LayerViewsDefault : ServerHasDefault
18 {
19 public LayerViewsDefault() : base(true) { }
20
21 public override object GetDefaultValue(object owner)
22 {
23 if (owner is PortfolioView portfolio_view && portfolio_view.portfolio != null)
24 return new HashSet<IReference<ILayerView>>(
25 portfolio_view.portfolio.GetValue().layers.Select(lyr_ref =>
26 LayerViews.Create(lyr_ref.GetValue(), portfolio_view.analysis_profile)
27 .Post().ToReference()));
28 throw new NotSupportedException("A PortfolioView instance that contains a " +
29 "reference to a Portfolio must be supplied to determine what its default " +
30 "layer_views collection would be.");
31 }
32 }
33 #endregion Private Attributes
34
35 #region APIResource Interface Members
37 public static readonly string CLASS_COLLECTION_NAME = "portfolio_views";
38
40 [IgnoreDataMember]
41 public override string collection_name => CLASS_COLLECTION_NAME;
42 #endregion APIResource Interface Members
43
44 #region Public Properties
46 // [DataMember(Order = 10)]
47 // public string name { get; set; }
48
54 [DataMember(Order = 21)]
55 [LayerViewsDefault]
56 public HashSet<IReference<ILayerView>> layer_views { get; set; }
57
60 [DataMember(Order = 22)]
62
64 [DataMember(Order = 23)]
66 public MonetaryUnit premium { get; set; }
67 #endregion Public Properties
68
72 {
73 layer_views = new HashSet<IReference<ILayerView>>();
74 }
75
83 IEnumerable<IReference<ILayerView>> layerViewsToAdd = null,
84 IEnumerable<IReference<ILayerView>> layerViewsToRemove = null,
85 int? timeout = null)
86 {
87 return API.PortfolioViewMarginals.Post(this.ToReference(),
88 layerViewsToAdd, layerViewsToRemove, timeout: timeout);
89 }
90 }
91}
PortfolioView and LayerView abstract base class.
Represents the endpoint on the server for requesting marginal portfolios.
static IReference< PortfolioView > Post(IReference< PortfolioView > basePortfolio, IEnumerable< IReference< ILayerView > > layerViewsToAdd=null, IEnumerable< IReference< ILayerView > > layerViewsToRemove=null, IEnumerable< Parameter > requestParameters=null, int? timeout=null)
Construct a "marginal" PortfolioView by adding and/or removing one or more LayerViews to/from some ba...
API methods / requests made available to the user.
Specifies that a property is generated by the server and should not be specified on the client side d...
Indicates that the property, if left null, will have a default value generated and filled in by the s...
LayerView factory class.
Definition LayerViews.cs:9
Representation of a monetary value with a currency.
Represents the Analysis of a Portfolio.
override string collection_name
The collection endpoint at which resources of this type reside on the server.
static readonly string CLASS_COLLECTION_NAME
The collection endpoint at which resources of this type reside on the server.
PortfolioView()
Construct a new PortfolioView with an empty layer_views HashSet and a reference to the default Analys...
IReference< StaticPortfolio > portfolio
The portfolio from which this portfolioView was constructed. Can be supplied by the user on POST inst...
HashSet< IReference< ILayerView > > layer_views
The LayerViews included in this PortfolioView. Must be supplied when posting a new PortfolioView,...
IReference< PortfolioView > PostMarginalPortfolio(IEnumerable< IReference< ILayerView > > layerViewsToAdd=null, IEnumerable< IReference< ILayerView > > layerViewsToRemove=null, int? timeout=null)
Construct a new "marginal" PortfolioView by adding and/or removing one or more LayerViews to/from thi...
MonetaryUnit premium
The computed premium of this portfolio.
Base interface for all reference entities.