option-prices 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: option_prices
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Option pricing using the Black Scholes Model
|
|
5
|
+
Author-email: Shreenivas Dani <shreenivasdani@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.8
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: numpy
|
|
11
|
+
Requires-Dist: scipy
|
|
12
|
+
Dynamic: license-file
|
|
13
|
+
|
|
14
|
+
# BSM
|
|
15
|
+
|
|
16
|
+
This package is to be used for option price calculation using the Black Scholes Model
|
|
17
|
+
|
|
18
|
+
## Description
|
|
19
|
+
|
|
20
|
+
This package provides a simple and easy-to-use implementation of the Black Scholes Model for calculating European call and put option prices. It is designed for students, traders, and developers who want a lightweight and reliable tool for option pricing without the complexity of larger libraries.
|
|
21
|
+
|
|
22
|
+
## Getting Started
|
|
23
|
+
|
|
24
|
+
### Dependencies
|
|
25
|
+
|
|
26
|
+
Numpy,Scipy
|
|
27
|
+
|
|
28
|
+
### Installing
|
|
29
|
+
|
|
30
|
+
pip install bsm
|
|
31
|
+
|
|
32
|
+
### Executing program
|
|
33
|
+
|
|
34
|
+
from bsm import bsm
|
|
35
|
+
|
|
36
|
+
## example when time scale is in year
|
|
37
|
+
price=bsm(S=50,K=50,T=1,r=6,sigma=25,option_type = "call",time_scale="Year")
|
|
38
|
+
print(price)
|
|
39
|
+
## example when time scale is in month
|
|
40
|
+
price = bsm(S=50,K=50,T=6,r=6,sigma=25,option_type = "call",time_scale="Month")
|
|
41
|
+
print(price)
|
|
42
|
+
|
|
43
|
+
Note:
|
|
44
|
+
When time_scale="Year", enter T in years.
|
|
45
|
+
When time_scale="Month", enter T in months.
|
|
46
|
+
## Authors
|
|
47
|
+
|
|
48
|
+
Shreenivas Dani
|
|
49
|
+
|
|
50
|
+
shreenivasdani@gmail.com
|
|
51
|
+
## Version History
|
|
52
|
+
|
|
53
|
+
* 0.1
|
|
54
|
+
* Initial Release
|
|
55
|
+
|
|
56
|
+
## License
|
|
57
|
+
|
|
58
|
+
This project is licensed under the MIT License - see the LICENSE.md file for details
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
option_prices-0.1.0.dist-info/licenses/LICENSE,sha256=S_fbX1OLfL7GYfxafKhn4E6-9cDMpbxy3-OgQisZr5A,1087
|
|
2
|
+
option_pricings/__init__.py,sha256=BxB2eTmLv0SnZmRQvBPxsAMjxGi9IzUybs13ydxrBKA,20
|
|
3
|
+
option_pricings/bsm.py,sha256=XpJwqKC1K8KKNaDZmwiIyNUaCyGsqwQWdew3elvw-2Y,852
|
|
4
|
+
option_prices-0.1.0.dist-info/METADATA,sha256=J78QP_UejtnQLRYNzIwqOSV-uMkq09AXPee8ZzYRC3U,1480
|
|
5
|
+
option_prices-0.1.0.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
|
|
6
|
+
option_prices-0.1.0.dist-info/top_level.txt,sha256=l0EOs-Inr3wtGhBYn7jleXhMdO3ieLmttoU5twwomAE,16
|
|
7
|
+
option_prices-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Your Name
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
option_pricings
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .bsm import bsm
|
option_pricings/bsm.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
from scipy.stats import norm
|
|
3
|
+
N= norm.cdf
|
|
4
|
+
#call = C = S₀N(d₁) - Ke⁻ʳᵗN(d₂)
|
|
5
|
+
#put=ke^(-rT)*N(-d2)-S*N(-d1)
|
|
6
|
+
#d₁ = [ln(S₀/K) + (r + σ²/2)t] / (σ√t)
|
|
7
|
+
#d₂ = d₁ - σ√t
|
|
8
|
+
|
|
9
|
+
def bsm(S,K,T,r,sigma,option_type="call",time_scale="Year"):
|
|
10
|
+
if time_scale == "Month":
|
|
11
|
+
T = T/12
|
|
12
|
+
r = r/100
|
|
13
|
+
sigma = sigma/100
|
|
14
|
+
denominator = (sigma*np.sqrt(T))
|
|
15
|
+
numerator = np.log(S/K)+(r+(sigma**2*0.5))*T
|
|
16
|
+
d1 = numerator/denominator
|
|
17
|
+
d2 = d1-denominator
|
|
18
|
+
if option_type == "call":
|
|
19
|
+
price = (S*N(d1))-((K*np.exp(-1*r*T))*(N(d2)))
|
|
20
|
+
elif option_type == "put":
|
|
21
|
+
price = ((K*np.exp(-1*r*T))*(N(-1*d2)))-(S*N(-d1))
|
|
22
|
+
else:
|
|
23
|
+
"Plz put the correct option type"
|
|
24
|
+
return round(price,2)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
if __name__ =="__main__":
|
|
29
|
+
a=bsm(50,50,1,6,25,option_type = "call")
|
|
30
|
+
|