Skip to content

IntermediateOptions, Derivatives & FinancePython

Run this module

cd "Finance - Correlation Analysis"
python "correlation_analysis.py"

View source on GitHub


Correlation Analysis

Analyze correlations between financial instruments for portfolio construction and risk management.

Features

  • Pearson Correlation
  • Rolling Correlation
  • Correlation Matrix
  • EWMA Correlation
  • Rank Correlation (Spearman)
  • Tail Correlation
  • Correlation Stability Analysis

Usage

from correlation_analysis import pearson_correlation, rolling_correlation

returns1 = [0.01, -0.02, 0.015, -0.01, 0.02]
returns2 = [0.008, -0.015, 0.012, -0.008, 0.018]

corr = pearson_correlation(returns1, returns2)
print(f"Correlation: {corr:.4f}")

rolling = rolling_correlation(returns1, returns2, window=3)

Applications

  • Portfolio diversification
  • Pairs trading identification
  • Risk management
  • Hedge effectiveness
  • Market regime detection

Continue in Options, Derivatives & Finance

  • Advanced Options Pricing

    This module covers advanced mathematical techniques for pricing financial derivatives. The focus is on models beyond the standard assumptions. Rather than assuming constant volatility, we explore dynamic and local volatility models. These models are crucial for correctly valuing exotic options and managing the risks of complex derivatives portfolios.

  • Black-Scholes Option Pricing

    This module lets you price basic stock options (calls and puts) using the Black-Scholes formula, a foundation of modern financial analysis.

  • Bond Price and Yield

    This utility lets you calculate the fair price of a bond or estimate its yield to maturity (YTM), two of the most basic (and important!) ideas in investing.

  • CAPM

    CAPM is the idea that won a Nobel Prize and still anchors how the industry

  • Discounted Cash Flow (DCF)

    This tool calculates the present value of a series of future cash flows—the basic principle behind valuing businesses, real estate, projects, and stocks!

  • Dividend Tracker

    This utility does NOT use any external APIs. All data is managed locally for learning and experimentation.

Browse all modules Learning paths