Skip to content

Commit

Permalink
Adjust the exchange rate functionality so that it works with quarterl…
Browse files Browse the repository at this point in the history
…y=True
  • Loading branch information
JerBouma committed Sep 7, 2024
1 parent 47d556d commit 8f8613d
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions financetoolkit/toolkit_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -2652,24 +2652,28 @@ def get_exchange_rates(
tqdm_message="Obtaining exchange data",
)
else:
# In case there is no conversion needed, it should just create an empty DataFrame
# In case there is no conversion needed, it should create a placeholder
# DataFrame that works with the rest of the Toolkit.
self._daily_exchange_rate_data = pd.DataFrame(
data=1,
index=pd.PeriodIndex(
pd.date_range(
start=self._start_date, end=self._end_date, freq="D"
)
),
columns=[
"Open",
"High",
"Low",
"Close",
"Adj Close",
"Volume",
"Return",
"Volatility",
"Cumulative Return",
],
columns=pd.MultiIndex.from_tuples(
[
("Open", "USDUSD=X"),
("High", "USDUSD=X"),
("Low", "USDUSD=X"),
("Close", "USDUSD=X"),
("Adj Close", "USDUSD=X"),
("Volume", "USDUSD=X"),
("Return", "USDUSD=X"),
("Volatility", "USDUSD=X"),
("Cumulative Return", "USDUSD=X"),
]
),
)

# For exchange data, it is possible that a ticker such as USDUSD=X
Expand Down

0 comments on commit 8f8613d

Please sign in to comment.