Skip to content

Commit 289f100

Browse files
committed
Added documentation using pdoc
1 parent d8607fb commit 289f100

File tree

7 files changed

+254
-300
lines changed

7 files changed

+254
-300
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- Removed `BaseLeg` from models.py.
99
- Changed `StrategyType` to `StrategyLegType` in models.py for clarity.
1010
- Removed "normal" as an alias for "black-scholes" to avoid confusion with Bachelier model.
11+
- Updated Readme.md.
1112

1213
## 1.4.2 (2025-01-25)
1314

README.md

Lines changed: 8 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
![OptionLab](optionlab.png)
2+
13
# OptionLab
24

35
This package is a lightweight library written entirely in Python, designed to provide
4-
quick evaluation of option strategies.
6+
quick evaluation of option strategy ideas.
57

68
The code produces various outputs, including the profit/loss profile of the strategy on
79
a user-defined target date, the range of stock prices for which the strategy is
@@ -10,22 +12,16 @@ each leg of the strategy using the Black-Sholes model, the resulting debit or cr
1012
trading account, the maximum and minimum returns within a specified lower and higher price
1113
range of the underlying asset, and an estimate of the strategy's probability of profit.
1214

13-
The probability of profit (PoP) on the user-defined target date for the strategy is calculated
14-
by default using the Black-Scholes model. Alternatively, the user can provide an array of
15-
underlying asset prices following a distribution other than the normal (e.g. Laplace) or
16-
model other than the Black-Scholes model (e.g. Heston model) that will be used in the calculations.
17-
18-
Despite the code having been developed with option strategies in mind, it can also be
19-
used for strategies that combine options with stocks and/or take into account the
20-
profits or losses of closed trades.
21-
2215
If you have any questions, corrections, comments or suggestions, just
2316
[drop a message](mailto:[email protected]).
2417

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

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).
24+
2925
## Installation
3026

3127
The easiest way to install **OptionLab** is using **pip**:
@@ -34,55 +30,9 @@ The easiest way to install **OptionLab** is using **pip**:
3430
pip install optionlab
3531
```
3632

37-
## Basic usage
38-
39-
The evaluation of a strategy is done by calling the `run_strategy` function provided by
40-
the library. This function receives the input data either as a Python dictionary or an
41-
`Inputs` object. For example, let's say we wanted to calculate the probability of profit
42-
for naked calls on Apple stocks with maturity on December 17, 2021. The strategy setup
43-
consisted of selling 100 175.00 strike calls for 1.15 each on November 22, 2021.
44-
45-
```python
46-
input_data = {
47-
"stock_price": 164.04,
48-
"start_date": "2021-11-22",
49-
"target_date": "2021-12-17",
50-
"volatility": 0.272,
51-
"interest_rate": 0.0002,
52-
"min_stock": 120,
53-
"max_stock": 200,
54-
"strategy": [
55-
{
56-
"type": "call",
57-
"strike": 175.0,
58-
"premium": 1.15,
59-
"n": 100,
60-
"action":"sell"
61-
}
62-
],
63-
}
64-
```
65-
66-
After defining the input data as a Python dictionary, we pass it to the `run_strategy`
67-
function as shown below:
68-
69-
```python
70-
from optionlab import run_strategy, plot_pl
71-
72-
out = run_strategy(input_data)
73-
74-
print(out)
75-
76-
plot_pl(out)
77-
```
78-
79-
The variable `out` is an `Outputs` object that contains the results from the
80-
calculations. By calling `print` with `out` as an argument, these results are
81-
displayed on screen. The `plot_pl` function, in turn, takes an `Outputs` object as
82-
its argument and plots the profit/loss diagram for the strategy.
33+
## Documentation
8334

84-
Usage examples for a number of popular options trading strategies can be found in the
85-
Jupyter notebooks in the **examples** directory.
35+
You can access the API documentation for **OptionLab** on the [project's GitHub Pages site](https://rgaveiga.github.io/optionlab).
8636

8737
## Contributions
8838

0 commit comments

Comments
 (0)