From 696b1011b7fcf7646116acec5e76d4b9025ba68f Mon Sep 17 00:00:00 2001 From: DongGeon Lee Date: Thu, 7 Mar 2024 22:31:40 +0900 Subject: [PATCH] feat: Declare quote wrappers as class for better linting (#356) --- stock_indicators/indicators/common/candles.py | 8 +++----- stock_indicators/indicators/common/quote.py | 5 +++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/stock_indicators/indicators/common/candles.py b/stock_indicators/indicators/common/candles.py index ee3e0574..36cefaf0 100644 --- a/stock_indicators/indicators/common/candles.py +++ b/stock_indicators/indicators/common/candles.py @@ -23,10 +23,6 @@ def condense(self) -> Self: class _CandleProperties(_Quote): - """ - A wrapper class for `CsCandleProperties`, which is an extended version of `Quote`. - It contains additional calculated properties. - """ @property def size(self) -> Optional[Decimal]: return to_pydecimal(self.high - self.low) @@ -71,7 +67,9 @@ def is_bearish(self) -> bool: return self.Close < self.Open -CandleProperties = generate_cs_inherited_class(_CandleProperties, CsCandleProperties, "CandleProperties") +class CandleProperties(generate_cs_inherited_class(_CandleProperties, CsCandleProperties)): + """An extended version of Quote that contains additional calculated properties.""" + pass class CandleResult(ResultBase): diff --git a/stock_indicators/indicators/common/quote.py b/stock_indicators/indicators/common/quote.py index 4e0fe136..c6e35f37 100644 --- a/stock_indicators/indicators/common/quote.py +++ b/stock_indicators/indicators/common/quote.py @@ -49,7 +49,6 @@ def _set_volume(quote, value): quote.Volume = CsDecimal(value) class _Quote: - """A base wrapper class for a single unit of historical quotes.""" date = property(_get_date, _set_date) open = property(_get_open, _set_open) high = property(_get_high, _set_high) @@ -86,4 +85,6 @@ def use(cls, quotes: Iterable["Quote"], candle_part: CandlePart): return CsQuoteUtility.Use[Quote](CsList(Quote, quotes), candle_part.cs_value) -Quote = generate_cs_inherited_class(_Quote, CsQuote, "Quote") +class Quote(generate_cs_inherited_class(_Quote, CsQuote)): + """A single dated quote containing OHLCV elements.""" + pass