We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 542b86f + 4cca791 commit c2e5f4fCopy full SHA for c2e5f4f
financetoolkit/portfolio/portfolio_controller.py
@@ -830,7 +830,19 @@ def collect_historical_data(
830
self._currency_column # type: ignore
831
].items():
832
data_currency = self._historical_statistics.loc["Currency", ticker]
833
- if self._historical_statistics.loc["Currency", ticker] != currency:
+
834
+ # Skip when either currency code is missing or NaN,
835
+ # otherwise a bogus symbol like "NAN=X" gets sent to
836
+ # Yahoo Finance and triggers a 404.
837
+ if (
838
+ not currency
839
+ or not data_currency
840
+ or pd.isna(currency)
841
+ or pd.isna(data_currency)
842
+ ):
843
+ continue
844
845
+ if data_currency != currency:
846
currency_conversions[ticker] = (
847
f"{currency}{data_currency}=X".upper()
848
)
0 commit comments