diff --git a/stock_indicators/_cslib/__init__.py b/stock_indicators/_cslib/__init__.py index 4297ec2a..980f3c5d 100644 --- a/stock_indicators/_cslib/__init__.py +++ b/stock_indicators/_cslib/__init__.py @@ -51,6 +51,3 @@ from Skender.Stock.Indicators import PivotPointType as CsPivotPointType from Skender.Stock.Indicators import PivotTrend as CsPivotTrend from Skender.Stock.Indicators import Match as CsMatch - -# Exceptions -from System import FormatException as CsFormatException diff --git a/stock_indicators/_cstypes/datetime.py b/stock_indicators/_cstypes/datetime.py index 83833c9e..8ffb0f3f 100644 --- a/stock_indicators/_cstypes/datetime.py +++ b/stock_indicators/_cstypes/datetime.py @@ -20,8 +20,7 @@ class DateTime: 3/26/2021 10:02:22 PM """ def __new__(cls, datetime) -> CsDateTime: - if isinstance(datetime, PyDateTime): - return CsDateTime.Parse(datetime.isoformat()) + return CsDateTime.Parse(datetime.isoformat()) def to_pydatetime(cs_datetime): @@ -31,5 +30,4 @@ def to_pydatetime(cs_datetime): Parameter: cs_datetime : `System.DateTime` of C#. """ - if isinstance(cs_datetime, CsDateTime): - return PyDateTime.fromisoformat(cs_datetime.ToString("s", CsCultureInfo.InvariantCulture)) + return PyDateTime.fromisoformat(cs_datetime.ToString("s", CsCultureInfo.InvariantCulture)) diff --git a/stock_indicators/_cstypes/decimal.py b/stock_indicators/_cstypes/decimal.py index a3bd9b75..4d7f81fe 100644 --- a/stock_indicators/_cstypes/decimal.py +++ b/stock_indicators/_cstypes/decimal.py @@ -1,9 +1,9 @@ from decimal import Decimal as PyDecimal from stock_indicators._cslib import CsDecimal -from stock_indicators._cslib import CsFormatException from stock_indicators._cslib import CsCultureInfo + class Decimal: """ Class for converting a number into C#'s `System.Decimal` class. @@ -19,11 +19,7 @@ class Decimal: 2.5 """ def __new__(cls, decimal) -> CsDecimal: - try: - return CsDecimal.Parse(str(decimal), CsCultureInfo.InvariantCulture) - except CsFormatException as e: - raise ValueError("You may be using numeric data that is incompatible with your locale environment settings.\n" - "For example, you may be using decimal points instead of commas.") from e + return CsDecimal.Parse(str(decimal), CsCultureInfo.InvariantCulture) def to_pydecimal(cs_decimal): diff --git a/stock_indicators/indicators/common/candles.py b/stock_indicators/indicators/common/candles.py index d1da59f8..a6345fab 100644 --- a/stock_indicators/indicators/common/candles.py +++ b/stock_indicators/indicators/common/candles.py @@ -59,7 +59,6 @@ def is_bearish(self) -> bool: 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/vwap.py b/stock_indicators/indicators/vwap.py index 7833da69..cec0e32e 100644 --- a/stock_indicators/indicators/vwap.py +++ b/stock_indicators/indicators/vwap.py @@ -42,7 +42,7 @@ def get_vwap(quotes, start = None, month = 1, day = 1, hour = 0, minute = 0): if isinstance(start, int): start = datetime(start, month, day, hour, minute) - results = CsIndicator.GetVwap[Quote](CsList(Quote, quotes), CsDateTime(start)) + results = CsIndicator.GetVwap[Quote](CsList(Quote, quotes), CsDateTime(start) if start else None) return VWAPResults(results, VWAPResult)