Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion financetoolkit/portfolio/portfolio_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,19 @@ def collect_historical_data(
self._currency_column # type: ignore
].items():
data_currency = self._historical_statistics.loc["Currency", ticker]
if self._historical_statistics.loc["Currency", ticker] != currency:

# Skip when either currency code is missing or NaN,
# otherwise a bogus symbol like "NAN=X" gets sent to
# Yahoo Finance and triggers a 404.
if (
not currency
or not data_currency
or pd.isna(currency)
or pd.isna(data_currency)
):
continue

if data_currency != currency:
currency_conversions[ticker] = (
f"{currency}{data_currency}=X".upper()
)
Expand Down
Loading