Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ranaroussi/quantstats
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.0.70
Choose a base ref
...
head repository: ranaroussi/quantstats
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0.0.71
Choose a head ref
  • 6 commits
  • 3 files changed
  • 1 contributor

Commits on Aug 14, 2025

  1. Fix RuntimeWarnings in tail_ratio function

    - Handle divide by zero when lower quantile is 0
    - Handle invalid values when quantiles return NaN
    - Return NaN gracefully instead of triggering warnings
    ranaroussi committed Aug 14, 2025
    Configuration menu
    Copy the full SHA
    4ca6255 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    80ae0c0 View commit details
    Browse the repository at this point in the history
  3. Fix tail_ratio to handle DataFrame inputs properly

    - Handle Series (multi-column) results from DataFrame.quantile()
    - Apply element-wise checks for NaN and zero values
    - Return Series for DataFrame input, scalar for Series input
    - Fixes ValueError when checking truth value of Series
    ranaroussi committed Aug 14, 2025
    Configuration menu
    Copy the full SHA
    e36103f View commit details
    Browse the repository at this point in the history
  4. Fix additional divide by zero warnings in stats functions

    - Fix gain_to_pain_ratio: Handle case when no negative returns (downside=0)
    - Fix recovery_factor: Handle case when no drawdown (max_dd=0)
    - Both functions now return NaN instead of triggering warnings
    ranaroussi committed Aug 14, 2025
    Configuration menu
    Copy the full SHA
    59d929f View commit details
    Browse the repository at this point in the history
  5. Add comprehensive divide by zero protection across stats functions

    Protected the following functions from divide by zero warnings:
    - sortino: Check for zero downside deviation
    - ulcer_performance_index: Check for zero ulcer index
    - serenity_index: Check for zero std and denominator
    - payoff_ratio: Check for zero average loss
    - outlier_win_ratio: Check for no positive returns
    - outlier_loss_ratio: Check for no negative returns
    - risk_return_ratio: Check for zero standard deviation
    - kelly_criterion: Check for zero or NaN win/loss ratio
    - greeks: Check for zero benchmark variance
    - rolling_greeks: Use replace(0, NaN) for benchmark std
    
    All functions now return NaN instead of triggering RuntimeWarnings
    ranaroussi committed Aug 14, 2025
    1 Configuration menu
    Copy the full SHA
    31b0ae4 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    74d2148 View commit details
    Browse the repository at this point in the history
Loading