Improve CI coverage.
This commit is contained in:
@@ -279,6 +279,17 @@ class MarketFundamentals:
|
|||||||
# Ensure reasonable bounds
|
# Ensure reasonable bounds
|
||||||
return np.clip(adjustment, 0.65, 0.75)
|
return np.clip(adjustment, 0.65, 0.75)
|
||||||
|
|
||||||
|
def calculate_confidence_adjustment(self, metrics, level):
|
||||||
|
"""Calculate how much to adjust confidence intervals based on market conditions."""
|
||||||
|
depth_impact = np.clip(metrics["market_depth"] * 0.2, 0, 0.2)
|
||||||
|
vol_impact = np.clip(metrics["volume_to_supply"] * 30, 0, 0.2)
|
||||||
|
total_adjustment = (depth_impact + vol_impact) * 0.5
|
||||||
|
|
||||||
|
if level >= 0.95:
|
||||||
|
total_adjustment *= 0.5
|
||||||
|
|
||||||
|
return level + (1 - level) * total_adjustment
|
||||||
|
|
||||||
|
|
||||||
def compare_adjustments(df, fundamentals):
|
def compare_adjustments(df, fundamentals):
|
||||||
"""
|
"""
|
||||||
@@ -756,10 +767,9 @@ def project_prices(
|
|||||||
for level in confidence_levels:
|
for level in confidence_levels:
|
||||||
# Get market metrics for confidence interval adjustment
|
# Get market metrics for confidence interval adjustment
|
||||||
metrics = fundamentals.get_market_maturity_metrics(df, current_date)
|
metrics = fundamentals.get_market_maturity_metrics(df, current_date)
|
||||||
maturity_adjustment = np.clip(metrics["market_depth"], 0, 0.5)
|
|
||||||
|
|
||||||
# Calculate adjusted confidence level
|
# Calculate adjusted confidence level
|
||||||
effective_level = level + (1 - level) * maturity_adjustment
|
effective_level = fundamentals.calculate_confidence_adjustment(metrics, level)
|
||||||
|
|
||||||
lower_percentile = (1 - effective_level) * 100 / 2
|
lower_percentile = (1 - effective_level) * 100 / 2
|
||||||
upper_percentile = 100 - lower_percentile
|
upper_percentile = 100 - lower_percentile
|
||||||
|
|||||||
Reference in New Issue
Block a user