Spaces:
Sleeping
Sleeping
Commit
·
bb2e7f7
1
Parent(s):
412440d
introduced does_ticker_exist method to TickerFinder
Browse files- src/ticker_finder.py +20 -4
src/ticker_finder.py
CHANGED
|
@@ -195,9 +195,25 @@ class TickerFinder():
|
|
| 195 |
numalign='left',
|
| 196 |
stralign='left')
|
| 197 |
return pretty_string
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 198 |
|
| 199 |
|
| 200 |
-
if __name__ == "__main__":
|
| 201 |
-
# results = TickerFinder().
|
| 202 |
-
|
| 203 |
-
|
|
|
|
|
|
| 195 |
numalign='left',
|
| 196 |
stralign='left')
|
| 197 |
return pretty_string
|
| 198 |
+
|
| 199 |
+
def does_ticker_exist(
|
| 200 |
+
self,
|
| 201 |
+
ticker: str
|
| 202 |
+
) -> bool:
|
| 203 |
+
"""
|
| 204 |
+
Check whether a given ticker exists in the ticker data.
|
| 205 |
+
Args:
|
| 206 |
+
ticker : str
|
| 207 |
+
The ticker to check
|
| 208 |
+
Returns:
|
| 209 |
+
exists : bool
|
| 210 |
+
True if the ticker exists, False otherwise
|
| 211 |
+
"""
|
| 212 |
+
return ticker in self.df['ticker'].values
|
| 213 |
|
| 214 |
|
| 215 |
+
# if __name__ == "__main__":
|
| 216 |
+
# results = TickerFinder().find_best_matching_ticker_or_title("microsoft")
|
| 217 |
+
# print(results)
|
| 218 |
+
# exists = TickerFinder().does_ticker_exist('bbbbb')
|
| 219 |
+
# print(f'Ticker exists') if exists else print(f'Ticker does not exist')
|