Skip to content

TZZheng/Option-Visualizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Option-Visualizer

This project's goal is to investigate the performance of various option strategies. It is divided into three main parts:

  1. Option Calculator: Calculate the basic return profile for individual options (e.g., calls or puts) given specific parameters.
  2. Strategy Analyzer: Analyze the return profiles of simple strategies like covered calls, cash-secured puts, bull call spreads, and seagulls.
  3. Backtest Analyzer: Evaluate the performance of strategies over longer time periods using historical data.

Project Structure

/web

Contains the web application built with Flask. This folder includes templates, static assets, and the main application logic.

  • /web/templates: HTML templates for the web interface.

    • index.html: The homepage with navigation to different tools.
    • option_calculator.html: Interface for calculating individual option prices and payoffs.
    • strategy_analyzer.html: Interface for analyzing option strategies.
    • backtest_analyzer.html: Interface for backtesting strategies over historical data.
  • /web/static: Static assets such as CSS and JavaScript files.

    • css/style.css: Styles for the web application.
  • /web/app.py: The main Flask application file. Defines routes for the web interface and API endpoints for calculations and backtesting.

/core

Core logic and utilities for option pricing, strategy creation, and calculations.

  • /core/strategies: Contains strategy definitions and a factory for creating strategies.

    • strategy_base.py: Base classes for option and stock positions, and the trading strategy framework.
    • strategy_factory.py: Factory for creating predefined strategies like covered calls and cash-secured puts.
  • /core/pricing: Implements pricing models for options.

    • black_scholes.py: Black-Scholes model for option pricing and greeks calculation.
  • /core/utils: Utility functions for date calculations and other helpers.

    • date_utils.py: Functions for calculating time-to-maturity and other date-related utilities.

/analytics

Modules for analyzing and backtesting strategies.

  • /analytics/backtest_engine.py: Engine for running backtests on strategies, including buy-and-hold and cash-secured put comparisons.
  • /analytics/returns.py: Functions for calculating returns and performance metrics.

/tests

Contains unit tests for the application. (Currently not included but recommended for future development.)

/data

(Optional) Placeholder for storing any data files, such as historical price data or backtest results.

/config

(Optional) Placeholder for configuration files, such as environment variables or settings.

/README.md

This file. Provides an overview of the project and its structure.

/pyproject.toml

Defines the project metadata and dependencies for Python.

/requirements.txt

(Optional) Placeholder for listing Python dependencies if not using pyproject.toml.

/static

(Optional) Placeholder for additional static assets if needed.

How to Run

I use uv to manage the package dependency.

uv run -m web.app
  1. Open the application in your browser at http://localhost:8080.

Future Improvements

About

Option data calculator

Resources

License

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors