Giter Club home page Giter Club logo

black_scholes's People

Contributors

ronniec95 avatar simonsan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

black_scholes's Issues

Calcuating greeks

First off thank you so much for writing this crate! If it wasn't for this I wouldn't even know where to start. I'm working on trying to calculate some greeks and seeing if it matches data the nasdaq is producing. I'm using the $1000 2022-01-28 PUT for tesla as an example. Using the following code:

    use black_scholes_pricer::put_greeks;
    use chrono::NaiveDate;

    let expiry = NaiveDate::from_ymd(2022, 1, 28);
    let today = NaiveDate::from_ymd(2021, 12, 25);
    let days_until_expire = expiry.signed_duration_since(today).num_days();
    println!("Days until expire: {}", days_until_expire);
    let greeks = put_greeks(
        &[52.0],
        &[1000.0],
        &[days_until_expire as f32 / 252.0],
        &[0.0],
        &[0.62578],
        &[0.0],
    );
    println!("{:?}", greeks);

I get this output:

Days until expire: 34
Greeks { pv: [948.0, NaN, NaN, NaN, NaN, NaN, NaN, NaN], delta: [-1.0, NaN, NaN, NaN, NaN, NaN, NaN, NaN], theta: [-3409717700000000000000000000000000000.0, NaN, NaN, NaN, NaN, NaN, NaN, NaN], gamma: [-6440186000000000000000000000000000.0, NaN, NaN, NaN, NaN, NaN, NaN, NaN], rho: [-134.92064, NaN, NaN, NaN, NaN, NaN, NaN, NaN], vega: [1470297200000000000000000000000000000.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] }

If I modify the inputs and remove the division by 252 from the days_util_expire and actually gets pretty close to the nasdaq output.

Greeks { pv: [987.7166, NaN, NaN, NaN, NaN, NaN, NaN, NaN], delta: [-0.15524423, NaN, NaN, NaN, NaN, NaN, NaN, NaN], theta: [-1.8617551, NaN, NaN, NaN, NaN, NaN, NaN, NaN], gamma: [-0.0035164347, NaN, NaN, NaN, NaN, NaN, NaN, NaN], rho: [-33856.836, NaN, NaN, NaN, NaN, NaN, NaN, NaN], vega: [202.30647, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] }

I'm likely not understanding something about how to use this function.
image

Test failing: bs_f32x8_::tests::check_ir_from_price_f32x8

This test is failing when I try on aarch64 or x86_64 targets. Is this left intentionally broken, or otherwise? ๐Ÿค”

I'm currently investigating what's available in Rust for black scholes. Would be nice to be able to use your work but I'm not sure if it's too experimental at the moment ๐Ÿ˜…

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.