diff --git a/docs/docs/guide/ticker/historical.md b/docs/docs/guide/ticker/historical.md
index f8860e3..df327bc 100644
--- a/docs/docs/guide/ticker/historical.md
+++ b/docs/docs/guide/ticker/historical.md
@@ -16,6 +16,7 @@
| end | Specific ending date | `str` or `datetime.datetime` | | optional | If a string is passed, use the format `YYYY-MM-DD`
| adj_timezone | Adjust datetime to the specific symbol's timezone | `bool` | `True` | optional | `True`
`False`
| adj_ohlc | Calculates an adjusted open, high, low and close prices according to split and dividend information | `bool` | `False` | optional | `True`
`False`
+ | prepost | Include Pre and Post market data | `bool` | `False` | optional | `True`
`False`
!!! tip "One Minute Interval Data"
The Yahoo Finance API restricts the amount of one minute interval data to seven days per request. However, the data availability extends to 30 days. The following will allow the user to retrieve the last 30 days of one minute interval data, with the one caveat that **4 requests are made in 7 day ranges to retrieve the desired data**:
diff --git a/tests/test_ticker.py b/tests/test_ticker.py
index c5495b8..acf359a 100644
--- a/tests/test_ticker.py
+++ b/tests/test_ticker.py
@@ -141,15 +141,17 @@ def test_p_get_financial_data(ticker):
@pytest.mark.parametrize(
- "period, interval",
+ "period, interval, prepost",
[
- (p, i)
- for p, i in zip(
- ["1d", "1mo", "1y", "5y", "max"], ["1m", "1m", "1d", "1wk", "3mo"]
+ (p, i, prepost)
+ for p, i, prepost in zip(
+ ["1d", "1mo", "1y", "5y", "max"],
+ ["1m", "1m", "1d", "1wk", "3mo"],
+ [True, False, True, False, False],
)
],
)
-def test_history(ticker, period, interval):
+def test_history(ticker, period, interval, prepost):
assert isinstance(ticker.history(period, interval), pd.DataFrame)
diff --git a/yahooquery/base.py b/yahooquery/base.py
index 0162d29..d9c226a 100644
--- a/yahooquery/base.py
+++ b/yahooquery/base.py
@@ -684,6 +684,7 @@ class _YahooFinance(object):
"events": {"required": False, "default": "div,split"},
"numberOfPoints": {"required": False, "default": None},
"formatted": {"required": False, "default": False},
+ "includePrePost": {"required": False, "default": None},
},
},
"options": {
diff --git a/yahooquery/ticker.py b/yahooquery/ticker.py
index 37cb549..efdcd9e 100644
--- a/yahooquery/ticker.py
+++ b/yahooquery/ticker.py
@@ -1231,6 +1231,7 @@ def history(
end=None,
adj_timezone=True,
adj_ohlc=False,
+ prepost=False,
):
"""
Historical pricing data
@@ -1256,6 +1257,8 @@ def history(
adj_ohlc: bool, default False, optional
Calculates an adjusted open, high, low and close prices according
to split and dividend information
+ prepost: bool, default False, optional
+ Include Pre and Post market data.
Returns
-------
@@ -1287,6 +1290,7 @@ def history(
"Interval values must be one of {}".format(", ".join(intervals))
)
params["interval"] = interval.lower()
+ params["includePrePost"] = prepost
if params["interval"] == "1m" and period == "1mo":
df = self._history_1m(adj_timezone, adj_ohlc)
else: