Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Financial Analysis Platform

A modular Python library for quantitative financial analysis: option and bond pricing, portfolio optimization, risk measurement, technical analysis, and strategy backtesting.


Key Features

  • Option Pricing: Analytical Black-Scholes, Monte Carlo, and binomial trees (European, American, Cox-Ross-Rubinstein, Leisen-Reimer with delta and gamma).
  • Fixed Income: Present/future value, zero-coupon and coupon bond pricing, yield to maturity, modified duration, convexity, yield-curve bootstrapping, and forward rates.
  • Portfolio Construction: A Portfolio container plus mean-variance optimization — maximum Sharpe, minimum variance, and the efficient frontier.
  • Risk & Performance: Parametric and Monte Carlo Value at Risk; total/annualized return, volatility, Sharpe ratio, and maximum drawdown.
  • Factor Models: CAPM beta and alpha, OLS factor regression, and PCA on asset returns.
  • Technical Analysis Library: Composable indicators (SMA, EMA, RSI, MACD, Bollinger Bands) that take a price Series and return a Series or DataFrame.
  • Econometrics & Simulation: GARCH volatility fitting, ADF/KPSS stationarity tests, Engle-Granger cointegration, and stochastic process simulation (GBM, Ornstein-Uhlenbeck, Wiener).
  • Backtesting Engine: A backtrader-based runner supporting single- and multi-asset data feeds, with a set of example technical, pairs-trading, and machine-learning strategies.

Getting Started

Prerequisites

  • Python 3.9+
  • Git

Installation

  1. Clone the repository:

    git clone https://github.com/noahbean33/financial_analysis_platform.git
    cd financial_analysis_platform
  2. Install the required dependencies:

    pip install -r requirements.txt

Quick Start

from src.portfolio import Portfolio
from src.performance import buy_and_hold_performance

portfolio = Portfolio(['AAPL', 'MSFT', 'GOOG'], start_date='2020-01-01', end_date='2023-01-01')
metrics = buy_and_hold_performance(portfolio)
print(f"Sharpe ratio: {metrics['sharpe_ratio']:.2f}")

Documentation

For detailed information on how to use and extend the platform, please see our guides:

  • User Guide: For users who want to run backtests, analyze data, and use the platform's features.
  • Developer Guide: For developers who want to contribute to the platform by adding new strategies or indicators.

Testing

pytest

Future Development Roadmap

  1. Enhance the Risk Module: Add historical VaR, Conditional VaR (Expected Shortfall), and rolling volatility alongside the existing parametric and Monte Carlo VaR.
  2. Add Option Greeks: Analytical delta, gamma, vega, theta and rho, plus an implied volatility solver.
  3. Broaden Data Access: Abstract the data layer behind a provider-agnostic interface so sources other than yfinance can be plugged in, with caching and retries.
  4. Extend Portfolio Optimization: Risk parity, Black-Litterman, weight constraints, and transaction-cost-aware rebalancing.

Disclaimer

This platform is for informational and educational purposes only. The information and tools provided should not be construed as investment advice. All financial decisions are your own responsibility. The creators and contributors of this platform are not liable for any losses or damages arising from the use of this software. Always do your own research.

About

quant library

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages