Skip to content

Commit 1654418

Browse files
committed
Updated black-scholes caslculator test
1 parent 1cd5719 commit 1654418

File tree

2 files changed

+29
-17
lines changed

2 files changed

+29
-17
lines changed

README.md

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,36 @@
22

33
# OptionLab
44

5-
This package is a lightweight library written entirely in Python, designed to provide
6-
quick evaluation of option strategy ideas.
5+
This package is a lightweight library designed to provide quick evaluation of options trading
6+
strategies. It produces various outputs:
77

8-
The code produces various outputs, including the profit/loss profile of the strategy on
9-
a user-defined target date, the range of stock prices for which the strategy is
10-
profitable (i.e., generating a return greater than \$0.01), the Greeks associated with
11-
each leg of the strategy using the Black-Sholes model, the resulting debit or credit on the
12-
trading account, the maximum and minimum returns within a specified lower and higher price
13-
range of the underlying asset, and an estimate of the strategy's probability of profit.
8+
- the profit/loss profile of the strategy on a user-defined target date
9+
10+
- the range of stock prices for which the strategy is profitable (i.e., generating a return of
11+
at least \$0.01)
12+
13+
- the Greeks (delta, theta, rho, vega and gamma) associated with each leg of the strategy
14+
15+
- the resulting debit or credit on the trading account
16+
17+
- the maximum and minimum returns within a specified lower and higher price
18+
range of the underlying asset
19+
20+
- The expected profit when the strategy is profitable and the expected loss if it proves unprofitable
21+
22+
- the strategy's probability of profit.
23+
24+
## Contact
1425

1526
If you have any questions, corrections, comments or suggestions, just
1627
[drop a message](mailto:[email protected]).
1728

1829
You can also reach me on [Linkedin](https://www.linkedin.com/in/roberto-gomes-phd-8a718317b/) or
19-
follow me on [X](https://x.com/rgaveiga). When I have some free time, which is rare, I publish articles
20-
on [Medium](https://medium.com/@rgaveiga).
30+
follow me on [X](https://x.com/rgaveiga).
2131

22-
If you want to support this and other open source projects that I maintain, become a
23-
[sponsor on Github](https://github.com/sponsors/rgaveiga).
32+
> [!NOTE]
33+
> If you want to support this and other open source projects that I maintain, become a
34+
>[sponsor on Github](https://github.com/sponsors/rgaveiga).
2435
2536
## Installation
2637

@@ -48,8 +59,9 @@ This is free software and is provided as is. The author makes no guarantee that
4859
results are accurate and is not responsible for any losses caused by the use of the
4960
code.
5061

51-
Options are very risky derivatives and, like any other type of financial vehicle,
52-
trading options requires due diligence. This code is provided for educational and
53-
research purposes only.
54-
5562
Bugs can be reported as issues.
63+
64+
> [!CAUTION]
65+
> Options are very risky derivatives and, like any other type of financial vehicle,
66+
> trading options requires due diligence. This code is provided for educational and
67+
> research purposes only.

tests/test_core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def test_black_scholes():
8888
assert bs.call_theta == -8.780589609657586
8989
assert bs.call_rho == 0.04600635174517672
9090
assert bs.call_itm_prob == 0.2669832523577367
91-
assert bs.call_prob_of_touch == 0.5403744790632351
91+
assert round(bs.call_prob_of_touch, 12) == 0.540374479063
9292
assert bs.put_price == 6.27
9393
assert bs.put_delta == -0.7057027999944967
9494
assert bs.put_theta == -7.732314219179215

0 commit comments

Comments
 (0)