我正在使用 Bloomberg Java api 下载交易数据。我需要有人告诉我是否存在可以返回交易假期列表的函数。我翻遍了手册,但没有找到。如果没有这样的东西,有没有一种好方法可以创建一个?谢谢。
问问题
12702 次
5 回答
8
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"));
于 2012-08-30T16:51:48.383 回答
1
对于给定的证券,Bloomberg API 将告诉您使用 DS853 (CALENDAR_CODE) 的适当日历代码。给定一个日历代码,我不相信彭博提供了一种下载假日日历的方法。您可能需要使用第三方供应商,例如Financial Calendar。
于 2011-10-26T19:03:22.087 回答
1
我在获得接受的答案时遇到问题。结果证明不需要 SETTLEMENT_CALENDAR_CODE。以下工作:
{
securities[] = {
/bbgid/BBG00HZZLBT7
}
fields[] = {
CALENDAR_NON_SETTLEMENT_DATES
}
overrides[] = {
overrides = {
fieldId = "CALENDAR_START_DATE"
value = "20180101"
}
overrides = {
fieldId = "CALENDAR_END_DATE"
value = "20190101"
}
}
tableOverrides[] = {
}
}
回复:
{
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 = ...
}
...
}
}
}
}
}
于 2018-07-18T08:10:29.920 回答
1
Python实现如下。请注意,我们在阿姆斯特丹使用日历“AM”,将复活节的第二天标记为国定假日。
refDataService = session.getService("//blp/refdata")
request = refDataService.createRequest("ReferenceDataRequest")
request.append("securities", "AAPL US Equity")
request.append("fields", "CALENDAR_HOLIDAYS")
overrides = request.getElement("overrides")
override2 = overrides.appendElement()
override2.setElement("fieldId", "CALENDAR_START_DATE")
override2.setElement("value", "20200101")
override3 = overrides.appendElement()
override3.setElement("fieldId", "CALENDAR_END_DATE")
override3.setElement("value", "20210501")
override4 = overrides.appendElement()
override4.setElement("fieldId", "SETTLEMENT_CALENDAR_CODE")
override4.setElement("value", "AM")
session.sendRequest(request)
于 2021-02-24T12:05:54.057 回答
0
有时缺乏彭博假日数据。您可以尝试专门交易假期数据的服务,例如 TradingHours.com。
https://www.tradinghours.com/docs/3.x/enterprise/market-holidays.html
于 2021-01-06T15:25:53.940 回答