C# Client Library
A C# Client Library for the AnalyzeRe REST API
Loading...
Searching...
No Matches
ExtensionMethods.IAPIResourceView.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
4
5// Disable warnings about snake_case function names in this method. While it
6// C# best-practice, it's done intentionally to follow the API conventions closely.
7#pragma warning disable IDE1006
8
9namespace AnalyzeRe
10{
12 public static partial class ExtensionMethods
13 {
14 #region Blocking Metrics Requests
26 double probability, MetricsOptions options = null, PollingOptions pollingOptions = null)
27 {
28 return API.PollUntilReady(
29 () => thisView.tail_metrics(probability, options, pollingOptions?.MaxPollTotalTime),
30 pollingOptions);
31 }
32
43 public static List<TailMetrics> tail_metrics_blocking(this IAPIResourceView thisView,
44 IEnumerable<double> probabilities, MetricsOptions options = null,
45 PollingOptions pollingOptions = null)
46 {
47 return API.PollUntilReady(() =>
48 thisView.tail_metrics(probabilities, options, pollingOptions?.MaxPollTotalTime),
49 pollingOptions);
50 }
51
63 ProbabilityWindow range, MetricsOptions options = null, PollingOptions pollingOptions = null)
64 {
65 return API.PollUntilReady(
66 () => thisView.window_metrics(range, options, pollingOptions?.MaxPollTotalTime),
67 pollingOptions);
68 }
69
80 public static List<WindowMetrics> window_metrics_blocking(this IAPIResourceView thisView,
81 IEnumerable<ProbabilityWindow> ranges, MetricsOptions options = null,
82 PollingOptions pollingOptions = null)
83 {
84 return API.PollUntilReady(() =>
85 thisView.window_metrics(ranges, options, pollingOptions?.MaxPollTotalTime),
86 pollingOptions);
87 }
88
102 this IAPIResourceView thisView, ProbabilityWindow range,
103 IReference<T> component, CoMetricsOptions options = null,
104 PollingOptions pollingOptions = null)
105 where T : IAPIResourceView
106 {
107 return API.PollUntilReady(() =>
108 thisView.co_metrics(range, component, options, pollingOptions?.MaxPollTotalTime),
109 pollingOptions);
110 }
111
124 public static List<CoMetrics> co_metrics_blocking<T>(
125 this IAPIResourceView thisView, IEnumerable<ProbabilityWindow> ranges,
126 IReference<T> component, CoMetricsOptions options = null,
127 PollingOptions pollingOptions = null)
128 where T : IAPIResourceView
129 {
130 return API.PollUntilReady(() =>
131 thisView.co_metrics(ranges, component, options, pollingOptions?.MaxPollTotalTime),
132 pollingOptions);
133 }
134
147 this IAPIResourceView thisView, double threshold,
148 ExceedanceProbabilityOptions options = null, PollingOptions pollingOptions = null)
149 {
150 return API.PollUntilReady(() =>
151 thisView.exceedance_probability(threshold, options, pollingOptions?.MaxPollTotalTime),
152 pollingOptions);
153 }
154
166 public static List<ExceedanceProbability> exceedance_probability_blocking(
167 this IAPIResourceView thisView, IEnumerable<double> thresholds,
168 ExceedanceProbabilityOptions options = null, PollingOptions pollingOptions = null)
169 {
170 return API.PollUntilReady(() =>
171 thisView.exceedance_probability(thresholds, options, pollingOptions?.MaxPollTotalTime),
172 pollingOptions);
173 }
174
184 [Obsolete("POST a BackAllocatedLayer structure instead.")]
186 this IAPIResourceView thisView, string source_id, PollingOptions pollingOptions = null)
187 {
188 return API.PollUntilReady(() =>
189 thisView.back_allocations(source_id, pollingOptions?.MaxPollTotalTime),
190 pollingOptions);
191 }
192 #endregion Blocking Metrics Requests
193
194 #region Metrics Aliases
202 public static double expected_loss(
203 this IAPIResourceView thisView, MetricsOptions options = null, int? timeout = null)
204 {
205 return thisView.tail_metrics(1.0, options, timeout).mean;
206 }
217 public static double tvar(this IAPIResourceView thisView,
218 double probability, MetricsOptions options = null, int? timeout = null)
219 {
220 return thisView.tail_metrics(probability, options, timeout).mean;
221 }
222
232 public static double var(this IAPIResourceView thisView,
233 double probability, MetricsOptions options = null, int? timeout = null)
234 {
235 return thisView.tail_metrics(probability, options, timeout).min;
236 }
237 #endregion Metrics Aliases
238 }
239}
API methods / requests made available to the user.
Provides the REST request methods available to data endpoints.
static double tvar(this IAPIResourceView thisView, double probability, MetricsOptions options=null, int? timeout=null)
Returns the Tail Value at Risk (TVaR), which is equivalent to requesting the mean value of the tail_m...
static List< ExceedanceProbability > exceedance_probability_blocking(this IAPIResourceView thisView, IEnumerable< double > thresholds, ExceedanceProbabilityOptions options=null, PollingOptions pollingOptions=null)
Returns exceedance probability - but if the simulation isn't ready (503 with retry-after),...
static CoMetrics co_metrics_blocking< T >(this IAPIResourceView thisView, ProbabilityWindow range, IReference< T > component, CoMetricsOptions options=null, PollingOptions pollingOptions=null)
Returns co-metrics - but if co-metrics aren't ready (503 with retry-after), it blocks until they are ...
static WindowMetrics window_metrics_blocking(this IAPIResourceView thisView, ProbabilityWindow range, MetricsOptions options=null, PollingOptions pollingOptions=null)
Returns window metrics - but if window metrics aren't ready (503 with retry-after),...
static List< WindowMetrics > window_metrics_blocking(this IAPIResourceView thisView, IEnumerable< ProbabilityWindow > ranges, MetricsOptions options=null, PollingOptions pollingOptions=null)
Returns window metrics - but if window metrics aren't ready (503 with retry-after),...
static List< TailMetrics > tail_metrics_blocking(this IAPIResourceView thisView, IEnumerable< double > probabilities, MetricsOptions options=null, PollingOptions pollingOptions=null)
Returns tail metrics - but if tail metrics aren't ready (503 with retry-after), it blocks until they ...
static double var(this IAPIResourceView thisView, double probability, MetricsOptions options=null, int? timeout=null)
Returns the Value at Risk (VaR), which is equivalent to requesting the minimum value of the tail_metr...
static TailMetrics tail_metrics_blocking(this IAPIResourceView thisView, double probability, MetricsOptions options=null, PollingOptions pollingOptions=null)
Returns tail metrics - but if tail metrics aren't ready (503 with retry-after), it blocks until they ...
static ExceedanceProbability exceedance_probability_blocking(this IAPIResourceView thisView, double threshold, ExceedanceProbabilityOptions options=null, PollingOptions pollingOptions=null)
Returns exceedance probability - but if the simulation isn't ready (503 with retry-after),...
static BackAllocations back_allocations_blocking(this IAPIResourceView thisView, string source_id, PollingOptions pollingOptions=null)
Returns back-allocations - but if back-allocations aren't ready (503 with retry-after),...
static double expected_loss(this IAPIResourceView thisView, MetricsOptions options=null, int? timeout=null)
Returns the Expected Loss, which is equivalent to requesting the mean value of the tail_metrics distr...
The structure returned when requesting back-allocated metrics for a view.
Optional parameters which can be specified for co-metrics requests.
The structure returned when requesting Co-Metrics for a view.
Optional parameters which can be specified for exceedance probability requests.
The structure returned when requesting Exceedance Probability for a view.
Optional parameters which can be specified for all metrics requests.
double mean
The mean of the distribution.
double min
The minimum value in the distribution.
The structure returned when requesting Tail Metrics for a view.
The structure returned when requesting Window Metrics for a view, containing the core window distribu...
Determines the behaviour of the API when automatically retrying a request whose result is not yet rea...
A probability range used to dictate the set of ordered trial losses in a loss distribution that shoul...
PortfolioView and LayerView interface.
TailMetrics tail_metrics(double probability, MetricsOptions options=null, int? timeout=null)
Returns the tail metrics of this view at a given probability.
WindowMetrics window_metrics(ProbabilityWindow range, MetricsOptions options=null, int? timeout=null)
Returns the window metrics of this view for a given probability range.
ExceedanceProbability exceedance_probability(double threshold, ExceedanceProbabilityOptions options=null, int? timeout=null)
Returns the exceedance probability for this view for the given loss. That is, the probability the spe...
BackAllocations back_allocations(string source_id, int? timeout=null)
Returns a URL to the YELT of this view back-allocated to some component loss source.
Base interface for all reference entities.