-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add error classes for symbol delisting errors, closes #270
- Loading branch information
1 parent
098e776
commit 685ef71
Showing
3 changed files
with
75 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,49 @@ | ||
class YFinanceException(Exception): | ||
pass | ||
def __init__(self, description=""): | ||
super().__init__(description) | ||
|
||
|
||
class YFinanceDataException(YFinanceException): | ||
pass | ||
|
||
|
||
class YFinanceChartError(YFinanceException): | ||
def __init__(self, ticker, description): | ||
self.ticker = ticker | ||
super().__init__(f"{self.ticker}: {description}") | ||
|
||
|
||
class YFNotImplementedError(NotImplementedError): | ||
def __init__(self, method_name): | ||
super().__init__(f"Have not implemented fetching '{method_name}' from Yahoo API") | ||
|
||
|
||
class YFinanceTickerMissingError(YFinanceException): | ||
def __init__(self, ticker, rationale): | ||
super().__init__(f"${ticker}: possibly delisted; {rationale}") | ||
self.rationale = rationale | ||
self.ticker = rationale | ||
|
||
|
||
class YFinanceTimezoneMissingError(YFinanceTickerMissingError): | ||
def __init__(self, ticker): | ||
super().__init__(ticker, "No timezone found") | ||
|
||
|
||
class YFinancePriceDataMissingError(YFinanceTickerMissingError): | ||
def __init__(self, ticker, debug_info): | ||
self.debug_info = debug_info | ||
super().__init__(ticker, f"No price data found {debug_info}") | ||
|
||
|
||
class YFinanceEarningsDateMissing(YFinanceTickerMissingError): | ||
def __init__(self, ticker): | ||
super().__init__(ticker, "No earnings dates found") | ||
|
||
|
||
class YFinanceInvalidPeriodError(YFinanceException): | ||
def __init__(self, ticker, invalid_period, valid_ranges): | ||
self.ticker = ticker | ||
self.invalid_period = invalid_period | ||
self.valid_ranges = valid_ranges | ||
super().__init__(f"{self.ticker}: Period '{invalid_period}' is invalid, must be one of {valid_ranges}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters