shortfall 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
shortfall/__init__.py ADDED
@@ -0,0 +1,742 @@
1
+ """shortfall — a portfolio risk engine, in pure Python with no dependencies."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from .backtest import (
6
+ ADVISORY_MINIMUM,
7
+ BadForecast,
8
+ CoverageTest,
9
+ Exceedances,
10
+ ExpectedShortfallTest,
11
+ TrafficLight,
12
+ Validation,
13
+ Zone,
14
+ conditional_coverage,
15
+ exceedances,
16
+ expected_shortfall_test,
17
+ independence,
18
+ simulate_expected_shortfall_null,
19
+ traffic_light,
20
+ unconditional_coverage,
21
+ validate,
22
+ )
23
+ from .bounds import (
24
+ DEFAULT_SWEEP_PATIENCE,
25
+ DEFAULT_TAIL_POINTS,
26
+ MAX_REARRANGEMENT_SWEEPS,
27
+ Arrangement,
28
+ BestCase,
29
+ Bounds,
30
+ LossTail,
31
+ NoTailMean,
32
+ NotIncreasing,
33
+ WorstCase,
34
+ best_case_value_at_risk,
35
+ completely_mixable_level,
36
+ dependence_bounds,
37
+ exponential_loss,
38
+ normal_loss,
39
+ pareto_loss,
40
+ rearrange,
41
+ uniform_loss,
42
+ worst_case_value_at_risk,
43
+ )
44
+ from .cleaning import (
45
+ BadDimensions,
46
+ Cleaned,
47
+ OutOfSample,
48
+ clip_spectrum,
49
+ compare_estimators,
50
+ detection_threshold,
51
+ eigenvector_overlap,
52
+ implied_spike,
53
+ marchenko_pastur_density,
54
+ marchenko_pastur_edges,
55
+ spike_location,
56
+ )
57
+ from .contributions import (
58
+ Allocation,
59
+ DidNotConverge,
60
+ NegativeContribution,
61
+ NoRiskToAllocate,
62
+ PrincipalBets,
63
+ RiskParity,
64
+ concentration,
65
+ diversification_ratio,
66
+ effective_bets,
67
+ historical_shortfall_contributions,
68
+ principal_bets,
69
+ risk_contributions,
70
+ risk_parity,
71
+ unit_risk,
72
+ volatility_contributions,
73
+ )
74
+ from .copula import (
75
+ COPULA_BATCHES,
76
+ MAX_COPULA_ASSETS,
77
+ MAX_COPULA_DEGREES,
78
+ MAX_COPULA_PATHS,
79
+ MIN_COPULA_DEGREES,
80
+ MIN_COPULA_OBSERVATIONS,
81
+ MIN_COPULA_PATHS,
82
+ TAIL_FRACTION,
83
+ CopulaRisk,
84
+ Family,
85
+ FittedCopula,
86
+ Marginal,
87
+ NoGaussianBaseline,
88
+ NotIdentified,
89
+ TailDependence,
90
+ copula_risk,
91
+ fit_copula,
92
+ gaussian_copula_log_likelihood,
93
+ joint_exceedance_rate,
94
+ simulate_copula,
95
+ student_t_copula_log_likelihood,
96
+ tail_dependence_coefficient,
97
+ )
98
+ from .covariance import (
99
+ Diagnostics,
100
+ Shrunk,
101
+ average_correlation,
102
+ blend,
103
+ constant_correlation_target,
104
+ correlation,
105
+ diagnose,
106
+ ledoit_wolf,
107
+ portfolio_variance,
108
+ sample_covariance,
109
+ )
110
+ from .distributions import (
111
+ OutOfDomain,
112
+ binomial_cdf,
113
+ binomial_sf,
114
+ chi_square_cdf,
115
+ chi_square_ppf,
116
+ chi_square_sf,
117
+ normal_cdf,
118
+ normal_pdf,
119
+ normal_ppf,
120
+ standardised_t_log_pdf,
121
+ student_t_cdf,
122
+ student_t_pdf,
123
+ student_t_ppf,
124
+ )
125
+ from .drawdown import (
126
+ Drawdown,
127
+ calmar,
128
+ downside_deviation,
129
+ drawdown_series,
130
+ drawdowns,
131
+ longest_underwater,
132
+ martin_ratio,
133
+ maximum_drawdown,
134
+ rolling,
135
+ rolling_maximum_drawdown,
136
+ rolling_ulcer_index,
137
+ rolling_volatility,
138
+ sortino,
139
+ ulcer_index,
140
+ wealth_curve,
141
+ )
142
+ from .entropy import (
143
+ MAX_POOL_ITERATIONS,
144
+ POOL_TOLERANCE,
145
+ STALL_TOLERANCE,
146
+ Posterior,
147
+ View,
148
+ ViewsInfeasible,
149
+ ViewsNotIdentified,
150
+ effective_scenarios,
151
+ mean_view,
152
+ pool,
153
+ probability_view,
154
+ relative_entropy,
155
+ stressed_risk,
156
+ temper,
157
+ weighted_expected_shortfall,
158
+ weighted_quantile,
159
+ )
160
+ from .expectile import (
161
+ BadLevel,
162
+ Expectile,
163
+ Match,
164
+ asymmetric_squared_loss,
165
+ comonotonic_gap,
166
+ expectile_identity,
167
+ matching_level,
168
+ normal_expectile,
169
+ sample_expectile,
170
+ student_t_expectile,
171
+ subadditivity_gap,
172
+ )
173
+ from .extreme import (
174
+ MINIMUM_EXCEEDANCES,
175
+ ExtremeRisk,
176
+ GeneralisedPareto,
177
+ HillShape,
178
+ ImpossibleFit,
179
+ MeanExcess,
180
+ NotEnoughTail,
181
+ OutsideTheFit,
182
+ TailMethod,
183
+ UndefinedTailMean,
184
+ excesses_over,
185
+ extreme_risk,
186
+ fit_generalised_pareto,
187
+ fit_tail,
188
+ hill_curve,
189
+ hill_shape,
190
+ mean_excess_curve,
191
+ threshold_for,
192
+ )
193
+ from .factors import (
194
+ Attribution,
195
+ FactorModel,
196
+ Regression,
197
+ attribute_risk,
198
+ fit_factor_model,
199
+ regress,
200
+ )
201
+ from .historical import (
202
+ Coherence,
203
+ Filtered,
204
+ HistoricalRisk,
205
+ Interval,
206
+ QuantileMethod,
207
+ bootstrap_interval,
208
+ check_subadditivity,
209
+ empirical_quantile,
210
+ ewma_volatility,
211
+ filtered_historical_risk,
212
+ historical_risk,
213
+ sample_expected_shortfall,
214
+ )
215
+ from .horizon import (
216
+ BATCHES,
217
+ MAX_PATHS,
218
+ MAX_TOTAL_STEPS,
219
+ MIN_OBSERVED_RESIDUALS,
220
+ MIN_PATHS,
221
+ HorizonRisk,
222
+ Innovations,
223
+ horizon_risk,
224
+ )
225
+ from .linalg import (
226
+ NotPositiveDefinite,
227
+ NotSquare,
228
+ NotSymmetric,
229
+ RankDeficient,
230
+ cholesky,
231
+ condition_number,
232
+ eigenvalues,
233
+ eigh,
234
+ is_positive_semidefinite,
235
+ least_squares,
236
+ nearest_psd,
237
+ quadratic_form,
238
+ solve_upper,
239
+ upper_inverse_gram,
240
+ )
241
+ from .mixture import (
242
+ BadMixture,
243
+ Component,
244
+ Fitted,
245
+ MixtureRisk,
246
+ NormalMixture,
247
+ Occupation,
248
+ averaged_shortfall,
249
+ convolve,
250
+ diversification_gap,
251
+ fit_mixture,
252
+ horizon_mixture,
253
+ mixture_risk,
254
+ occupation_law,
255
+ responsibilities,
256
+ stationary,
257
+ tail_ratio,
258
+ )
259
+ from .parametric import (
260
+ Distribution,
261
+ NotAQuantileFunction,
262
+ Risk,
263
+ cornish_fisher_risk,
264
+ normal_risk,
265
+ parametric_risk,
266
+ portfolio_risk,
267
+ student_t_risk,
268
+ )
269
+ from .quadratic import (
270
+ NEAR_MEAN,
271
+ DidNotSolve,
272
+ Exposure,
273
+ NotQuadratic,
274
+ OutsideSupport,
275
+ QuadraticRisk,
276
+ StandardForm,
277
+ Whitening,
278
+ cgf,
279
+ cgf_curvature,
280
+ cgf_domain,
281
+ cgf_slope,
282
+ cumulants,
283
+ delta_normal_quantile,
284
+ form_support,
285
+ linear_form,
286
+ negated,
287
+ quadratic_cdf,
288
+ quadratic_quantile,
289
+ quadratic_risk,
290
+ quadratic_shortfall,
291
+ quadratic_tail,
292
+ saddlepoint_argument,
293
+ standard_form,
294
+ whitening,
295
+ )
296
+ from .ranks import (
297
+ MINIMUM_RANK_OBSERVATIONS,
298
+ correlation_from_kendall,
299
+ correlation_from_spearman,
300
+ elliptical_correlation,
301
+ kendall_matrix,
302
+ kendall_tau,
303
+ kendall_tau_quadratic,
304
+ ranks_of,
305
+ spearman_matrix,
306
+ spearman_rho,
307
+ )
308
+ from .realised import (
309
+ BadBar,
310
+ Bar,
311
+ Bars,
312
+ Estimator,
313
+ close_to_close,
314
+ efficiency,
315
+ garman_klass,
316
+ garman_klass_yang_zhang,
317
+ parkinson,
318
+ realised_variance,
319
+ realised_volatility,
320
+ rogers_satchell,
321
+ tick_bias_factor,
322
+ yang_zhang,
323
+ )
324
+ from .saddlepoint import (
325
+ SADDLE_FLOOR,
326
+ SPAN_DENOMINATOR,
327
+ Exceedance,
328
+ LossPortfolio,
329
+ Obligor,
330
+ SaddlepointError,
331
+ exact_distribution,
332
+ exact_shortfall,
333
+ exact_tail,
334
+ exceedance_probability,
335
+ lattice_span,
336
+ normal_tail,
337
+ saddlepoint,
338
+ saddlepoint_shortfall,
339
+ shortfall_contributions,
340
+ tail_probability,
341
+ )
342
+ from .scoring import (
343
+ BadScore,
344
+ Comparison,
345
+ Scores,
346
+ compare,
347
+ fz0_loss,
348
+ quantile_loss,
349
+ )
350
+ from .series import (
351
+ ANNUAL,
352
+ DAILY_CALENDAR,
353
+ DAILY_TRADING,
354
+ MONTHLY,
355
+ QUARTERLY,
356
+ WEEKLY,
357
+ Convention,
358
+ Misaligned,
359
+ Panel,
360
+ ReturnSeries,
361
+ TooShort,
362
+ )
363
+ from .spectral import (
364
+ BadSpectrum,
365
+ Coherent,
366
+ ExponentialSpectrum,
367
+ MixtureSpectrum,
368
+ PowerSpectrum,
369
+ ShortfallSpectrum,
370
+ TailShare,
371
+ WangSpectrum,
372
+ check_coherence,
373
+ matching_shift,
374
+ normal_spectral,
375
+ spectral_risk,
376
+ tail_share,
377
+ )
378
+ from .stress import (
379
+ MaximumLoss,
380
+ OneAtATime,
381
+ Scenario,
382
+ linear_maximum_loss,
383
+ maximum_loss,
384
+ one_at_a_time,
385
+ radius_for,
386
+ worst_case_scenario,
387
+ )
388
+ from .volatility import (
389
+ FatTail,
390
+ Garch,
391
+ Innovation,
392
+ fat_tail_test,
393
+ fit_garch,
394
+ garch_forecast_series,
395
+ garch_variances,
396
+ )
397
+
398
+ __version__ = "0.1.0"
399
+
400
+ __all__ = [
401
+ "ADVISORY_MINIMUM",
402
+ "ANNUAL",
403
+ "BATCHES",
404
+ "COPULA_BATCHES",
405
+ "DAILY_CALENDAR",
406
+ "DAILY_TRADING",
407
+ "DEFAULT_SWEEP_PATIENCE",
408
+ "DEFAULT_TAIL_POINTS",
409
+ "MAX_COPULA_ASSETS",
410
+ "MAX_COPULA_DEGREES",
411
+ "MAX_COPULA_PATHS",
412
+ "MAX_PATHS",
413
+ "MAX_POOL_ITERATIONS",
414
+ "MAX_REARRANGEMENT_SWEEPS",
415
+ "MAX_TOTAL_STEPS",
416
+ "MINIMUM_EXCEEDANCES",
417
+ "MINIMUM_RANK_OBSERVATIONS",
418
+ "MIN_COPULA_DEGREES",
419
+ "MIN_COPULA_OBSERVATIONS",
420
+ "MIN_COPULA_PATHS",
421
+ "MIN_OBSERVED_RESIDUALS",
422
+ "MIN_PATHS",
423
+ "MONTHLY",
424
+ "NEAR_MEAN",
425
+ "POOL_TOLERANCE",
426
+ "QUARTERLY",
427
+ "SADDLE_FLOOR",
428
+ "SPAN_DENOMINATOR",
429
+ "STALL_TOLERANCE",
430
+ "TAIL_FRACTION",
431
+ "WEEKLY",
432
+ "Allocation",
433
+ "Arrangement",
434
+ "Attribution",
435
+ "BadBar",
436
+ "BadDimensions",
437
+ "BadForecast",
438
+ "BadLevel",
439
+ "BadMixture",
440
+ "BadScore",
441
+ "BadSpectrum",
442
+ "Bar",
443
+ "Bars",
444
+ "BestCase",
445
+ "Bounds",
446
+ "Cleaned",
447
+ "Coherence",
448
+ "Coherent",
449
+ "Comparison",
450
+ "Component",
451
+ "Convention",
452
+ "CopulaRisk",
453
+ "CoverageTest",
454
+ "Diagnostics",
455
+ "DidNotConverge",
456
+ "DidNotSolve",
457
+ "Distribution",
458
+ "Drawdown",
459
+ "Estimator",
460
+ "Exceedance",
461
+ "Exceedances",
462
+ "ExpectedShortfallTest",
463
+ "Expectile",
464
+ "ExponentialSpectrum",
465
+ "Exposure",
466
+ "ExtremeRisk",
467
+ "FactorModel",
468
+ "Family",
469
+ "FatTail",
470
+ "Filtered",
471
+ "Fitted",
472
+ "FittedCopula",
473
+ "Garch",
474
+ "GeneralisedPareto",
475
+ "HillShape",
476
+ "HistoricalRisk",
477
+ "HorizonRisk",
478
+ "ImpossibleFit",
479
+ "Innovation",
480
+ "Innovations",
481
+ "Interval",
482
+ "LossPortfolio",
483
+ "LossTail",
484
+ "Marginal",
485
+ "Match",
486
+ "MaximumLoss",
487
+ "MeanExcess",
488
+ "Misaligned",
489
+ "MixtureRisk",
490
+ "MixtureSpectrum",
491
+ "NegativeContribution",
492
+ "NoGaussianBaseline",
493
+ "NoRiskToAllocate",
494
+ "NoTailMean",
495
+ "NormalMixture",
496
+ "NotAQuantileFunction",
497
+ "NotEnoughTail",
498
+ "NotIdentified",
499
+ "NotIncreasing",
500
+ "NotPositiveDefinite",
501
+ "NotQuadratic",
502
+ "NotSquare",
503
+ "NotSymmetric",
504
+ "Obligor",
505
+ "Occupation",
506
+ "OneAtATime",
507
+ "OutOfDomain",
508
+ "OutOfSample",
509
+ "OutsideSupport",
510
+ "OutsideTheFit",
511
+ "Panel",
512
+ "Posterior",
513
+ "PowerSpectrum",
514
+ "PrincipalBets",
515
+ "QuadraticRisk",
516
+ "QuantileMethod",
517
+ "RankDeficient",
518
+ "Regression",
519
+ "ReturnSeries",
520
+ "Risk",
521
+ "RiskParity",
522
+ "SaddlepointError",
523
+ "Scenario",
524
+ "Scores",
525
+ "ShortfallSpectrum",
526
+ "Shrunk",
527
+ "StandardForm",
528
+ "TailDependence",
529
+ "TailMethod",
530
+ "TailShare",
531
+ "TooShort",
532
+ "TrafficLight",
533
+ "UndefinedTailMean",
534
+ "Validation",
535
+ "View",
536
+ "ViewsInfeasible",
537
+ "ViewsNotIdentified",
538
+ "WangSpectrum",
539
+ "Whitening",
540
+ "WorstCase",
541
+ "Zone",
542
+ "__version__",
543
+ "asymmetric_squared_loss",
544
+ "attribute_risk",
545
+ "average_correlation",
546
+ "averaged_shortfall",
547
+ "best_case_value_at_risk",
548
+ "binomial_cdf",
549
+ "binomial_sf",
550
+ "blend",
551
+ "bootstrap_interval",
552
+ "calmar",
553
+ "cgf",
554
+ "cgf_curvature",
555
+ "cgf_domain",
556
+ "cgf_slope",
557
+ "check_coherence",
558
+ "check_subadditivity",
559
+ "chi_square_cdf",
560
+ "chi_square_ppf",
561
+ "chi_square_sf",
562
+ "cholesky",
563
+ "clip_spectrum",
564
+ "close_to_close",
565
+ "comonotonic_gap",
566
+ "compare",
567
+ "compare_estimators",
568
+ "completely_mixable_level",
569
+ "concentration",
570
+ "condition_number",
571
+ "conditional_coverage",
572
+ "constant_correlation_target",
573
+ "convolve",
574
+ "copula_risk",
575
+ "cornish_fisher_risk",
576
+ "correlation",
577
+ "correlation_from_kendall",
578
+ "correlation_from_spearman",
579
+ "cumulants",
580
+ "delta_normal_quantile",
581
+ "dependence_bounds",
582
+ "detection_threshold",
583
+ "diagnose",
584
+ "diversification_gap",
585
+ "diversification_ratio",
586
+ "downside_deviation",
587
+ "drawdown_series",
588
+ "drawdowns",
589
+ "effective_bets",
590
+ "effective_scenarios",
591
+ "efficiency",
592
+ "eigenvalues",
593
+ "eigenvector_overlap",
594
+ "eigh",
595
+ "elliptical_correlation",
596
+ "empirical_quantile",
597
+ "ewma_volatility",
598
+ "exact_distribution",
599
+ "exact_shortfall",
600
+ "exact_tail",
601
+ "exceedance_probability",
602
+ "exceedances",
603
+ "excesses_over",
604
+ "expected_shortfall_test",
605
+ "expectile_identity",
606
+ "exponential_loss",
607
+ "extreme_risk",
608
+ "fat_tail_test",
609
+ "filtered_historical_risk",
610
+ "fit_copula",
611
+ "fit_factor_model",
612
+ "fit_garch",
613
+ "fit_generalised_pareto",
614
+ "fit_mixture",
615
+ "fit_tail",
616
+ "form_support",
617
+ "fz0_loss",
618
+ "garch_forecast_series",
619
+ "garch_variances",
620
+ "garman_klass",
621
+ "garman_klass_yang_zhang",
622
+ "gaussian_copula_log_likelihood",
623
+ "hill_curve",
624
+ "hill_shape",
625
+ "historical_risk",
626
+ "historical_shortfall_contributions",
627
+ "horizon_mixture",
628
+ "horizon_risk",
629
+ "implied_spike",
630
+ "independence",
631
+ "is_positive_semidefinite",
632
+ "joint_exceedance_rate",
633
+ "kendall_matrix",
634
+ "kendall_tau",
635
+ "kendall_tau_quadratic",
636
+ "lattice_span",
637
+ "least_squares",
638
+ "ledoit_wolf",
639
+ "linear_form",
640
+ "linear_maximum_loss",
641
+ "longest_underwater",
642
+ "marchenko_pastur_density",
643
+ "marchenko_pastur_edges",
644
+ "martin_ratio",
645
+ "matching_level",
646
+ "matching_shift",
647
+ "maximum_drawdown",
648
+ "maximum_loss",
649
+ "mean_excess_curve",
650
+ "mean_view",
651
+ "mixture_risk",
652
+ "nearest_psd",
653
+ "negated",
654
+ "normal_cdf",
655
+ "normal_expectile",
656
+ "normal_loss",
657
+ "normal_pdf",
658
+ "normal_ppf",
659
+ "normal_risk",
660
+ "normal_spectral",
661
+ "normal_tail",
662
+ "occupation_law",
663
+ "one_at_a_time",
664
+ "parametric_risk",
665
+ "pareto_loss",
666
+ "parkinson",
667
+ "pool",
668
+ "portfolio_risk",
669
+ "portfolio_variance",
670
+ "principal_bets",
671
+ "probability_view",
672
+ "quadratic_cdf",
673
+ "quadratic_form",
674
+ "quadratic_quantile",
675
+ "quadratic_risk",
676
+ "quadratic_shortfall",
677
+ "quadratic_tail",
678
+ "quantile_loss",
679
+ "radius_for",
680
+ "ranks_of",
681
+ "realised_variance",
682
+ "realised_volatility",
683
+ "rearrange",
684
+ "regress",
685
+ "relative_entropy",
686
+ "responsibilities",
687
+ "risk_contributions",
688
+ "risk_parity",
689
+ "rogers_satchell",
690
+ "rolling",
691
+ "rolling_maximum_drawdown",
692
+ "rolling_ulcer_index",
693
+ "rolling_volatility",
694
+ "saddlepoint",
695
+ "saddlepoint_argument",
696
+ "saddlepoint_shortfall",
697
+ "sample_covariance",
698
+ "sample_expected_shortfall",
699
+ "sample_expectile",
700
+ "shortfall_contributions",
701
+ "simulate_copula",
702
+ "simulate_expected_shortfall_null",
703
+ "solve_upper",
704
+ "sortino",
705
+ "spearman_matrix",
706
+ "spearman_rho",
707
+ "spectral_risk",
708
+ "spike_location",
709
+ "standard_form",
710
+ "standardised_t_log_pdf",
711
+ "stationary",
712
+ "stressed_risk",
713
+ "student_t_cdf",
714
+ "student_t_copula_log_likelihood",
715
+ "student_t_expectile",
716
+ "student_t_pdf",
717
+ "student_t_ppf",
718
+ "student_t_risk",
719
+ "subadditivity_gap",
720
+ "tail_dependence_coefficient",
721
+ "tail_probability",
722
+ "tail_ratio",
723
+ "tail_share",
724
+ "temper",
725
+ "threshold_for",
726
+ "tick_bias_factor",
727
+ "traffic_light",
728
+ "ulcer_index",
729
+ "unconditional_coverage",
730
+ "uniform_loss",
731
+ "unit_risk",
732
+ "upper_inverse_gram",
733
+ "validate",
734
+ "volatility_contributions",
735
+ "wealth_curve",
736
+ "weighted_expected_shortfall",
737
+ "weighted_quantile",
738
+ "whitening",
739
+ "worst_case_scenario",
740
+ "worst_case_value_at_risk",
741
+ "yang_zhang",
742
+ ]