Coder Social home page Coder Social logo

c-blackscholesfinancialmodel's Introduction

OptionPricing - Solution notes Dustin

My implementation of the Black-Scholes option pricing model for call and put options & unit testing using the NUnit framework.

Implementation notes by Dustin:

  • Added new startup program project to the solution to keep my implementation separate from the provided IEquityOption inferface and MarketInformation struct ("Startup Program")
    • implemented a new OptionPricer class against the provided IEquityOption interface, adding a constructor, as well as method bodies
    • implemented the OptionPricer.Price method for Black-Scholes Call and Put options, depending on the OptionType provided when instantiating a new OptionPricer
    • defined a custom dustinsMath project to implement the CDF of the Black-Scholes model
    • set a Main method in Program.cs from where to call the model implementation after setting market information parameters of a new instance of MarketInformation

image

  • Added a set of currently 5 (as of 2022-10-23) unit tests
    • compare returned call option price to an externally calculated result
    • compare returned put option price to an externally calculated result
    • ensure that negative times to expiry throw exception
    • ensure that negative spot prices or strike prices throw exception
    • check that with zero volatility and interest rate, a call option should return spot price - strike price

image

/// ORIGINAL TASK
The goal is to implement some code in C-sharp to price an equity option. This should be done by creating a class EquityOption, for example, which inherits from the provided IEquityOption interface and implements the methods specified there.

Some background reading on options and the pricing of them can be found here:

https://en.wikipedia.org/wiki/Option_(finance)

https://www.investopedia.com/terms/s/stockoption.asp

https://www.investopedia.com/articles/optioninvestor/07/options_beat_market.asp

Visual Studio Community is available free if you need a C-sharp IDE

https://visualstudio.microsoft.com/free-developer-offers/

And a guide on using Visual Studio to create a C-sharp hello world program can be found here:

https://docs.microsoft.com/en-us/visualstudio/ide/quickstart-csharp-console?view=vs-2019

c-blackscholesfinancialmodel's People

Contributors

herrmanndus avatar

Stargazers

 avatar

Watchers

 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.