Skip to content

Commit

Permalink
Merge branch 'main' into add-api
Browse files Browse the repository at this point in the history
  • Loading branch information
marc committed Mar 24, 2024
2 parents ec079bb + 2379a4a commit 1804d94
Show file tree
Hide file tree
Showing 10 changed files with 612 additions and 600 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# CHANGELOG

## 1.2.0 (2024-03-21)
## 1.2.0 (2024-03-25)

- Add API to call yfinance to receive stock information and future options chain

## 1.1.0 (2024-03-24)

- Refactor the engine's `run` method for readability.
- Accept dictionary of inputs to `StratgyEngine` init.

## 1.0.1 (2024-03-18)

- Refactor __holidays__.py to a utils function using the `holiday` library
Expand Down
20 changes: 4 additions & 16 deletions examples/black_scholes_calculator.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,14 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 1,
"metadata": {
"ExecuteTime": {
"end_time": "2024-03-15T17:36:52.330797Z",
"start_time": "2024-03-15T17:36:52.121865Z"
"end_time": "2024-03-15T21:15:37.010803Z",
"start_time": "2024-03-15T21:15:36.450216Z"
}
},
"outputs": [
{
"ename": "ImportError",
"evalue": "cannot import name 'get_bs_info' from 'optionlab' (/Users/mnhmbp/PycharmProjects/optionlab/optionlab/__init__.py)",
"output_type": "error",
"traceback": [
"\u001B[0;31m---------------------------------------------------------------------------\u001B[0m",
"\u001B[0;31mImportError\u001B[0m Traceback (most recent call last)",
"Cell \u001B[0;32mIn[6], line 3\u001B[0m\n\u001B[1;32m 1\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01m__future__\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m print_function\n\u001B[1;32m 2\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01m__future__\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m division\n\u001B[0;32m----> 3\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01moptionlab\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m VERSION, get_bs_info\n\u001B[1;32m 4\u001B[0m \u001B[38;5;28;01mimport\u001B[39;00m \u001B[38;5;21;01msys\u001B[39;00m\n",
"\u001B[0;31mImportError\u001B[0m: cannot import name 'get_bs_info' from 'optionlab' (/Users/mnhmbp/PycharmProjects/optionlab/optionlab/__init__.py)"
]
}
],
"outputs": [],
"source": [
"from __future__ import print_function\n",
"from __future__ import division\n",
Expand Down
30 changes: 15 additions & 15 deletions examples/naked_call.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"execution_count": 1,
"metadata": {
"ExecuteTime": {
"end_time": "2024-03-15T17:50:56.431755Z",
"start_time": "2024-03-15T17:50:55.507652Z"
"end_time": "2024-03-15T21:16:28.614458Z",
"start_time": "2024-03-15T21:16:27.865860Z"
}
},
"outputs": [],
Expand All @@ -31,7 +31,7 @@
"import datetime as dt\n",
"import sys\n",
"\n",
"from optionlab import VERSION, StrategyEngine, Inputs\n",
"from optionlab import VERSION, StrategyEngine, Inputs, plot_pl\n",
"\n",
"%matplotlib inline"
]
Expand Down Expand Up @@ -64,11 +64,11 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 3,
"metadata": {
"ExecuteTime": {
"end_time": "2024-03-13T02:27:33.629312Z",
"start_time": "2024-03-13T02:27:33.621905Z"
"end_time": "2024-03-15T21:16:37.874205Z",
"start_time": "2024-03-15T21:16:37.868325Z"
}
},
"outputs": [],
Expand Down Expand Up @@ -100,20 +100,20 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 4,
"metadata": {
"ExecuteTime": {
"end_time": "2024-03-13T02:27:36.676391Z",
"start_time": "2024-03-13T02:27:36.670314Z"
"end_time": "2024-03-15T21:16:40.959949Z",
"start_time": "2024-03-15T21:16:40.942429Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 1.94 ms, sys: 1.22 ms, total: 3.16 ms\n",
"Wall time: 2.36 ms\n"
"CPU times: user 2.23 ms, sys: 1.28 ms, total: 3.51 ms\n",
"Wall time: 2.57 ms\n"
]
}
],
Expand All @@ -131,11 +131,11 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 5,
"metadata": {
"ExecuteTime": {
"end_time": "2024-03-13T02:27:38.761229Z",
"start_time": "2024-03-13T02:27:38.445697Z"
"end_time": "2024-03-15T21:16:42.811428Z",
"start_time": "2024-03-15T21:16:42.639286Z"
}
},
"outputs": [
Expand All @@ -158,7 +158,7 @@
}
],
"source": [
"st.plot_pl()"
"plot_pl(st)"
]
},
{
Expand Down
5 changes: 5 additions & 0 deletions optionlab/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
get_theta,
)
from .engine import StrategyEngine
from .plot import plot_pl
from .support import (
get_pl_profile,
get_pl_profile_stock,
Expand Down Expand Up @@ -85,6 +86,8 @@
"get_delta",
"get_gamma",
"get_theta",
# plot
"plot_pl",
# api
"get_options_chain",
"get_stock_history",
Expand Down Expand Up @@ -128,6 +131,8 @@
"get_delta": (__package__, ".black_scholes"),
"get_gamma": (__package__, ".black_scholes"),
"get_theta": (__package__, ".black_scholes"),
# plot
"plot_pl": (__package__, ".plot"),
# api
"get_options_chain": (__package__, ".api"),
"get_stock_history": (__package__, ".api"),
Expand Down
Loading

0 comments on commit 1804d94

Please sign in to comment.