All Projects → krivi95 → option-pricing-models

krivi95 / option-pricing-models

Licence: other
Simple python/streamlit web app for European option pricing using Black-Scholes model, Monte Carlo simulation and Binomial model. Spot prices for the underlying are fetched from Yahoo Finance API.

Programming Languages

python
139335 projects - #7 most used programming language
Dockerfile
14818 projects

Projects that are alternatives of or similar to option-pricing-models

Algorithmic-Trading
I have been deeply interested in algorithmic trading and systematic trading algorithms. This Repository contains the code of what I have learnt on the way. It starts form some basic simple statistics and will lead up to complex machine learning algorithms.
Stars: ✭ 47 (+193.75%)
Mutual labels:  monte-carlo-simulation, option-pricing, black-scholes
streamlit-project
This repository provides a simple deployment-ready project layout for a Streamlit app. Simply swap out the code in `app.py` for your own and hit deploy!
Stars: ✭ 33 (+106.25%)
Mutual labels:  google-cloud, streamlit
Option-Pricing
European/American/Asian option pricing module. BSM/Monte Carlo/Binomial
Stars: ✭ 44 (+175%)
Mutual labels:  option-pricing, black-scholes
PROJ Option Pricing Matlab
Quant Option Pricing - Exotic/Vanilla: Barrier, Asian, European, American, Parisian, Lookback, Cliquet, Variance Swap, Swing, Forward Starting, Step, Fader
Stars: ✭ 85 (+431.25%)
Mutual labels:  option-pricing, black-scholes
PyFENG
Python Financial ENGineering (PyFENG package in PyPI.org)
Stars: ✭ 51 (+218.75%)
Mutual labels:  option-pricing, black-scholes
arc gcs
Provides an Arc backend for Google Cloud Storage
Stars: ✭ 48 (+200%)
Mutual labels:  google-cloud
pipeline-editor
Cloud Pipelines Editor is a web app that allows the users to build and run Machine Learning pipelines without having to set up development environment.
Stars: ✭ 22 (+37.5%)
Mutual labels:  google-cloud
end-to-end-machine-learning-with-google-cloud
End to End Machine Learning with Google Cloud Platform
Stars: ✭ 39 (+143.75%)
Mutual labels:  google-cloud
hoomd-examples
HOOMD-blue example scripts.
Stars: ✭ 15 (-6.25%)
Mutual labels:  monte-carlo-simulation
terraform-cloudinit-container-server
A batteries included cloud-init config to quickly and easily deploy a single Docker image or Docker Compose file to any Cloud™ VM.
Stars: ✭ 52 (+225%)
Mutual labels:  google-cloud
socket.io-pubsub
Socket.io adapter for Google Pub/Sub, allowing to setup a socket.io cluster
Stars: ✭ 29 (+81.25%)
Mutual labels:  google-cloud
bigtable
TypeScript Bigtable Client with 🔋🔋 included.
Stars: ✭ 13 (-18.75%)
Mutual labels:  google-cloud
secrets-init
minimalistic init system for containers with AWS/GCP secrets support
Stars: ✭ 114 (+612.5%)
Mutual labels:  google-cloud
rowy
Open-source Airtable-like experience for your database (Firestore) with GCP's scalability. Build any automation or cloud functions for your product. ⚡️✨
Stars: ✭ 2,676 (+16625%)
Mutual labels:  google-cloud
Story Generator
A Streamlit web app that generates Rick and Morty stories using GPT2.
Stars: ✭ 28 (+75%)
Mutual labels:  streamlit
gcptree
Like the unix tree command but for GCP Org Heirarchy
Stars: ✭ 24 (+50%)
Mutual labels:  google-cloud
restme
Template to bootstrap a fully functional, multi-region, REST service on GCP with a developer release pipeline.
Stars: ✭ 19 (+18.75%)
Mutual labels:  google-cloud
black-scholes
Black Scholes formula and greeks
Stars: ✭ 34 (+112.5%)
Mutual labels:  option-pricing
capbot2.0
Repository to hold code for the cap-bot varient that is being presented at the SIIC Defence Hackathon 2021.
Stars: ✭ 20 (+25%)
Mutual labels:  streamlit
keytotext
Keywords to Sentences
Stars: ✭ 226 (+1312.5%)
Mutual labels:  streamlit

Option Pricing Models

Introduction

This repository represents simple web app for calculating option prices (European Options). It uses three different methods for option pricing:

  1. Black-Scholes model
  2. Monte Carlo simulation
  3. Binomial model

Each model has various parameters that user needs to import:

  • Ticker
  • Strike price
  • Expiry date
  • Risk-free rate
  • Volatility

Option pricing models are implemented in Python 3.7. Latest spot price, for specified ticker, is fetched from Yahoo Finance API using pandas-datareader. Visualization of the models through simple web app is implemented using streamlit library.

When data is fetched from Yahoo Finance API using pandas-datareader, it's cached with request-cache library is sqlite db, so any subsequent testing and changes in model parameters with same underlying instrument won't result in duplicated request for fethcing already fetched data.

This implementation was done as project work on the course Special Functions (Applied Mathematics) on Master's degree in Software Engineering.

Streamlit web app

  1. Black-Scholes model
    black-scholes-demo

  2. Monte Carlo Option Pricing
    monte-carlo-demo

  3. Binomial model
    binomial-tree-demo

Project structure

In this repository you will find:

  • demo directory - contains .gif files as example of streamlit app.
  • option_pricing package - python package where models are implemented.
  • option_pricing_test.py script - example code for testing option pricing models (without webapp).
  • streamlit_app.py script - web app for testing models using streamlit library.
  • Requirements.txt file - python pip package requirements.
  • Dockerfile file - for running containerized streamlit web app.
  • app.yaml file - for deploying dockerized app on GCP(Google Cloud Platform).

How to run code?

You can use simple streamlit web app to test option pricing models either by manually setting up python environment and running streamlit app or by running docker container.

1. Running docker container

Dockerfile has exposed 8080 (default web browser port), so when you deploy it to some cloud provider, it would be automatically possible to access your recently deployed webb app through browser.

1.1 Running docker container locally
First you will need to build the docker image (this may take a while, because it's downloading all the python libraries from Requirements.txt file) and specify tag e.g. option-pricing:initial:
docker build -t option-pricing:initial .

When image is built, you can execute following command, that lists all docker images, to check if image was successfully build:
docker image ls

Now, you can run docker container with following command:
docker run -p 8080:8080 option-pricing:initial

When you see output in command line that streamlit app is running on port 8080, you can access it with browser:
http://localhost:8080/

1.2 Deploying docker container to Google Cloud Platform
Before you deploy to GCP, please make sure you have google acount, created project on Google Developer Console, set up the billing method (please make sure you understand how Google is charging for hosting!) and downloaded Google Cloud SDK.

To chech which project (one from list of projects created on Google Developer Console) is currently used with Google Cloud SDK, use:
gcloud config get-value project

To chage/set project use:
gcloud config set project project-name

When you have correct project in use for Cloud SDK, now you can deploy it using following command (it will use .yaml file from project structure as instructiong on how to deploy it):
gcloud app deploy
After choosing neared physical server to host your app, you will have to wait a bit for whole process to finish. Once everything is over, you will be prompted with a link to your web app (you can check that on Developer console as well).
Link for your webb app will be something like this: https://project-name.ey.r.appspot.com/.

2. Running streamlit app locally with python

It is recommended that you create new virtual environment: python3 -m venv option-pricing

Then you would need to activate that newly created python environment:

  • On Windows: option-pricing\Scripts\activate.bat
  • On Linux: source option-pricing/bin/activate

Once you have your python environment activated, first you would need to download all necessary python modules with pip. There is Requirements.txt file in scr directory. You can use the following command to automatically download all dependencies: pip install -r Requirements.txt

When the download is completed, you can run streamlit app with: streamlit run streamlit_app.py

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].