GithubHelp home page GithubHelp logo

qwq-cwq / pyfeng Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pyfe/pyfeng

0.0 0.0 0.0 2.61 MB

Python Financial ENGineering (PyFENG package in PyPI.org)

License: GNU General Public License v2.0

Python 100.00%

pyfeng's Introduction

PyFENG: Python Financial ENGineering

PyPI version Documentation Status Downloads

PyFENG is the python implemention of the standard option pricing models in financial engineering.

Models implemented

  • Black-Scholes-Merton (and displaced diffusion) model
  • Bachelier (Normal) model
  • Constant-elasticity-of-variance (CEV) model
  • Stochastic-alpha-beta-rho (SABR) model
  • Hyperbolic normal stochastic volatility (NSVh) model
  • Heston model
  • Ornstein-Uhlenbeck driven stochastic volatility model

About the package

  • It assumes variables are numpy arrays. So the computations are naturally vectorized.
  • It is purely in Python (i.e., no C, C++, cython).
  • It is implemented with python class.
  • It is intended for, but not limited to, academic use. By providing reference models, it saves researchers' time.

Installation

pip install pyfeng

For upgrade,

pip install pyfeng --upgrade

Code Snippets

In [1]:

import numpy as np
import pyfeng as pf
m = pf.Bsm(sigma=0.2, intr=0.05, divr=0.1)
m.price(strike=np.arange(80, 121, 10), spot=100, texp=1.2)

Out [1]:

array([15.71361973,  9.69250803,  5.52948546,  2.94558338,  1.48139131])

In [2]:

sigma = np.array([[0.2], [0.5]])
m = pf.Bsm(sigma, intr=0.05, divr=0.1) # sigma in axis=0
m.price(strike=[90, 95, 100], spot=100, texp=1.2, cp=[-1,1,1])

Out [2]:

array([[ 5.75927238,  7.38869609,  5.52948546],
       [16.812035  , 18.83878533, 17.10541288]])

Author

Others

pyfeng's People

Contributors

jaehyukchoi avatar delia810 avatar hejinzefinance avatar feng-yuze avatar lantianxue avatar chenyingong avatar qwq-cwq avatar charliescc avatar 1901212564 avatar jiangxunmu avatar ahrmnd avatar zaynmalivski avatar rachelczy avatar lililiyf avatar cy-wang15 avatar panyuli avatar xueyanghu avatar daifengqi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.