Skip to content

Commit 8f8613d

Browse files
committed
Adjust the exchange rate functionality so that it works with quarterly=True
1 parent 47d556d commit 8f8613d

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

financetoolkit/toolkit_controller.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2652,24 +2652,28 @@ def get_exchange_rates(
26522652
tqdm_message="Obtaining exchange data",
26532653
)
26542654
else:
2655-
# In case there is no conversion needed, it should just create an empty DataFrame
2655+
# In case there is no conversion needed, it should create a placeholder
2656+
# DataFrame that works with the rest of the Toolkit.
26562657
self._daily_exchange_rate_data = pd.DataFrame(
2658+
data=1,
26572659
index=pd.PeriodIndex(
26582660
pd.date_range(
26592661
start=self._start_date, end=self._end_date, freq="D"
26602662
)
26612663
),
2662-
columns=[
2663-
"Open",
2664-
"High",
2665-
"Low",
2666-
"Close",
2667-
"Adj Close",
2668-
"Volume",
2669-
"Return",
2670-
"Volatility",
2671-
"Cumulative Return",
2672-
],
2664+
columns=pd.MultiIndex.from_tuples(
2665+
[
2666+
("Open", "USDUSD=X"),
2667+
("High", "USDUSD=X"),
2668+
("Low", "USDUSD=X"),
2669+
("Close", "USDUSD=X"),
2670+
("Adj Close", "USDUSD=X"),
2671+
("Volume", "USDUSD=X"),
2672+
("Return", "USDUSD=X"),
2673+
("Volatility", "USDUSD=X"),
2674+
("Cumulative Return", "USDUSD=X"),
2675+
]
2676+
),
26732677
)
26742678

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

0 commit comments

Comments
 (0)