diff --git a/src/pybroker/common.py b/src/pybroker/common.py index 7b55570..632a3f2 100644 --- a/src/pybroker/common.py +++ b/src/pybroker/common.py @@ -24,7 +24,6 @@ "h": "hour", "d": "day", "w": "week", - "mo": "month", } _CENTS: Final = Decimal(".01") @@ -225,7 +224,6 @@ def parse_timeframe(timeframe: str) -> list[tuple[int, str]]: - ``"h"``/``"hour"``: hours - ``"d"``/``"day"``: days - ``"w"``/``"week"``: weeks - - ``"mo"``/``"month"``: months An example timeframe string is ``1h 30m``. @@ -261,7 +259,6 @@ def to_seconds(timeframe: Optional[str]) -> int: - ``"h"``/``"hour"``: hours - ``"d"``/``"day"``: days - ``"w"``/``"week"``: weeks - - ``"mo"``/``"month"``: months An example timeframe string is ``1h 30m``. diff --git a/src/pybroker/data.py b/src/pybroker/data.py index 0010d65..de92861 100644 --- a/src/pybroker/data.py +++ b/src/pybroker/data.py @@ -57,7 +57,7 @@ def get_cached( - ``"h"``/``"hour"``: hours - ``"d"``/``"day"``: days - ``"w"``/``"week"``: weeks - - ``"mo"``/``"month"``: months + An example timeframe string is ``1h 30m``. start_date: Starting date of the cached data (inclusive). @@ -126,7 +126,6 @@ def set_cached( - ``"h"``/``"hour"``: hours - ``"d"``/``"day"``: days - ``"w"``/``"week"``: weeks - - ``"mo"``/``"month"``: months An example timeframe string would be ``1h 30m``. start_date: Starting date of the data to cache (inclusive). @@ -191,7 +190,6 @@ def query( - ``"h"``/``"hour"``: hours - ``"d"``/``"day"``: days - ``"w"``/``"week"``: weeks - - ``"mo"``/``"month"``: months An example timeframe string is ``1h 30m``. adjust: The type of adjustment to make. @@ -275,7 +273,6 @@ def _fetch_data( - ``"h"``/``"hour"``: hours - ``"d"``/``"day"``: days - ``"w"``/``"week"``: weeks - - ``"mo"``/``"month"``: months An example timeframe string is ``1h 30m``. adjust: The type of adjustment to make. @@ -309,8 +306,6 @@ def _parse_alpaca_timeframe( unit = TimeFrameUnit.Day elif tf[1] == "week": unit = TimeFrameUnit.Week - elif tf[1] == "month": - unit = TimeFrame.Month else: raise ValueError(f"Invalid Alpaca timeframe: {timeframe}") return tf[0], unit diff --git a/src/pybroker/strategy.py b/src/pybroker/strategy.py index 97d9c5d..bd9ce39 100644 --- a/src/pybroker/strategy.py +++ b/src/pybroker/strategy.py @@ -1023,7 +1023,6 @@ def backtest( - ``"h"``/``"hour"``: hours - ``"d"``/``"day"``: days - ``"w"``/``"week"``: weeks - - ``"mo"``/``"month"``: months An example timeframe string is ``1h 30m``. between_time: ``tuple[str, str]`` of times of day e.g. @@ -1112,7 +1111,6 @@ def walkforward( - ``"h"``/``"hour"``: hours - ``"d"``/``"day"``: days - ``"w"``/``"week"``: weeks - - ``"mo"``/``"month"``: months An example timeframe string is ``1h 30m``. between_time: ``tuple[str, str]`` of times of day e.g. diff --git a/tests/test_common.py b/tests/test_common.py index fb4a873..26d2f88 100644 --- a/tests/test_common.py +++ b/tests/test_common.py @@ -77,7 +77,6 @@ def test_bar_data_get_custom_data_when_no_attr_then_error(): ("10week", [(10, "week")]), ("3d 20m", [(3, "day"), (20, "min")]), ("30s", [(30, "sec")]), - ("2mo", [(2, "month")]), ], ) def test_parse_timeframe_success(tf, expected): diff --git a/tests/test_data.py b/tests/test_data.py index be668bc..f0c02b8 100644 --- a/tests/test_data.py +++ b/tests/test_data.py @@ -397,7 +397,7 @@ def test_query_when_symbols_empty(self, empty_symbols): ): alpaca.query(empty_symbols, START_DATE, END_DATE, TIMEFRAME) - @pytest.mark.parametrize("timeframe", ["1mo 2d", "30s"]) + @pytest.mark.parametrize("timeframe", ["1w 2d", "30s"]) def test_query_when_invalid_timeframe_then_error(self, symbols, timeframe): alpaca = Alpaca(API_KEY, API_SECRET) with pytest.raises( @@ -482,7 +482,7 @@ def test_query_when_empty_result(self, symbols, columns): ) ) - @pytest.mark.parametrize("timeframe", ["1mo 2d", "30s"]) + @pytest.mark.parametrize("timeframe", ["1w 2d", "30s"]) def test_query_when_invalid_timeframe_then_error(self, symbols, timeframe): crypto = AlpacaCrypto(API_KEY, API_SECRET) with pytest.raises(