When fetching monthly data using xbbg, I have been running into an issue when I mix the BAUBIL Index with the LEGATRAH Index.
I am expecting to get a dataframe with one entry at the end of each month, but end up with two in some months, with one as NaN and the other populating with data, as in the image below. I think this has to do with the fact that some of the days are weekends and probably some sort of a time zone issue (is this possible?) but I don't know how to fix this issue.
from xbbg import blp
import pandas as pd
import numpy as np
tickers_list=['BAUBIL Index','LEGATRAH Index']
input_start_date,input_end_date = '2022-06-30', '2022-08-30'
df = blp.bdh(
tickers=tickers_list,
flds=['px_last'],
start_date=input_start_date, end_date=input_end_date,
Per='M', Fill='P', Days='A',
)
df.columns = df.columns.droplevel(1)
df = df[::-1]
This gives me a dataframe looking like this:
How do I have the dates roll over properly like the result I get from excel?
Thanks in advance.
Edit: I've tried changing the days override to Days='T' without success.
Edit2: Fixed code to properly reflect the screenshot.