How do I get trading holidays from the Bloomberg API

痞子三分冷 提交于 2019-12-06 01:34:06

问题


I'm using Bloomberg Java api to download trading data. I need somebody to tell me if there exists a function which can return a list of trading holidays. I looked through the manual but couldn't find one. If there's no such a thing, is there a good way that I can create one? Thanks.


回答1:


String field = "CALENDAR_HOLIDAYS";
//String field = "CALENDAR_NON_SETTLEMENT_DATES";
Request request = this._refDataServiceM.CreateRequest("ReferenceDataRequest");
Element securities = request.GetElement("securities");
securities.AppendValue("AAPL US Equity");
Element fields = request.GetElement("fields");
fields.AppendValue(field);

Element overridefields = request.GetElement("overrides");
Element overrides = request.GetElement("overrides");
Element override1 = overrides.AppendElement();
override1.SetElement("fieldId", "SETTLEMENT_CALENDAR_CODE");
override1.SetElement("value", calendar_code);
Element override2 = overrides.AppendElement();
override2.SetElement("fieldId", "CALENDAR_START_DATE");
override2.SetElement("value", startDate.ToString("yyyyMMdd"));
Element override3 = overrides.AppendElement();
override3.SetElement("fieldId", "CALENDAR_END_DATE");
override3.SetElement("value", endDate.ToString("yyyyMMdd"));



回答2:


The Bloomberg API will tell you, for a given security, the appropriate calendar code using DS853 (CALENDAR_CODE). Given a calendar code, I do not believe that Bloomberg provides a way to download a holiday calendar. You may need to use a third party vendor such as Financial Calendar.




回答3:


I had issues getting the accepted answer to work. Turned out the SETTLEMENT_CALENDAR_CODE isn't needed. The following worked:

{
securities[] = {
    /bbgid/BBG00HZZLBT7
}
fields[] = {
    CALENDAR_NON_SETTLEMENT_DATES
}
overrides[] = {
    overrides = {
        fieldId = "CALENDAR_START_DATE"
        value = "20180101"
    }
    overrides = {
        fieldId = "CALENDAR_END_DATE"
        value = "20190101"
    }
}
tableOverrides[] = {
}
}

Response:

{
securityData[] = {
    securityData = {
        security = "UXA INDEX"
        eidData[] = {
        }
        fieldExceptions[] = {
        }
        sequenceNumber = 0
        fieldData = {
            CALENDAR_NON_SETTLEMENT_DATES[] = {
                CALENDAR_NON_SETTLEMENT_DATES = {
                    Holiday Date = ...
                }
                CALENDAR_NON_SETTLEMENT_DATES = {
                    Holiday Date = ...
                }
                ...
            }
        }
    }
}
}


来源:https://stackoverflow.com/questions/7906254/how-do-i-get-trading-holidays-from-the-bloomberg-api

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!