Starting with TWS v985+ and after API v985+, Fundamental data from the Wall Street Horizon Event Calendar can be accessed via the TWS API through the functions IBApi.EClient.reqWshMetaData and IBApi.EClient.reqWshEventData. It is necessary to have the Wall Street Horizon Enchilada Pro research subscription activated first in Account Management.
WSH provides IBKR with corporate event datasets, including earnings dates, dividend dates, options expiration dates, splits, spinoffs and a wide variety of investor-related conferences.
The function IBApi.EClient.reqWshMetaData is used to request metadata describing calendar events.
-
client.reqWshMetaData(1100);
-
client.reqWshMetaData(1100);
-
client.reqWshMetaData(1100)
-
m_pClient->reqWshMetaData(30001);
-
1 self.reqWshMetaData(1100)
The metadata is then received via the callback IBApi.EWrapper.wshMetaData
-
public void wshMetaData(int reqId, string dataJson)
{
Console.WriteLine($"WSH Meta Data. Request Id: {reqId}, Data JSON: {dataJson}\n");
}
-
@Override
public void wshMetaData(int reqId, String dataJson) {
System.out.println(EWrapperMsgGenerator.wshMetaData(reqId, dataJson));
}
-
Public Sub wshMetaData(reqId As Integer, dataJson As String) Implements EWrapper.wshMetaData
Console.WriteLine($"WSH Meta Data. Request Id: {reqId}, Data JSON: {dataJson}")
End Sub
-
void TestCppClient::wshMetaData(int reqId, const std::string& dataJson) {
printf("WSH Meta Data. ReqId: %d, dataJson: %s\n", reqId, dataJson.c_str());
}
-
1 def wshMetaData(self, reqId: int, dataJson: str):
2 super().wshMetaData(reqId, dataJson)
3 print(
"WshMetaData.",
"ReqId:", reqId,
"Data JSON:", dataJson)
Pending metadata requests can be canceled with the function IBApi.EClient.cancelWshMetaData
The function IBApi.EClient.reqWshEventData is used to request the calendar events. Note: Prior to sending this message, it is expected that the API client request metadata via IBApi.EClient.reqWshMetaData, else an error may be reported.
-
client.reqWshEventData(1101, new WshEventData(8314, false, false, false, "20220511", "", 5));
-
client.reqWshEventData(1101, new WshEventData(8314, false, false, false, "20220511", "", 5));
-
client.reqWshEventData(1101, New WshEventData(8314, False, False, False, "20220511", "", 5))
-
m_pClient->reqWshEventData(30002, WshEventData(8314, false, false, false, "20220511", "", 5));
-
1 wshEventData1 = WshEventData()
2 wshEventData1.conId = 8314
3 wshEventData1.startDate =
"20220511"
4 wshEventData1.totalLimit = 5
5 self.reqWshEventData(1101, wshEventData1)
As seen above, currently the event data can only be filtered by conId. At a later point, filter parameters may be added for account, datePeriod, wholeMonthEvents, etc.
The event data is then received via the callback IBApi.EWrapper.wshEventData
-
public void wshEventData(int reqId, string dataJson)
{
Console.WriteLine($"WSH Event Data. Request Id: {reqId}, Data JSON: {dataJson}\n");
}
-
@Override
public void wshEventData(int reqId, String dataJson) {
System.out.println(EWrapperMsgGenerator.wshEventData(reqId, dataJson));
}
-
Public Sub wshEventData(reqId As Integer, dataJson As String) Implements EWrapper.wshEventData
Console.WriteLine($"WSH Event Data. Request Id: {reqId}, Data JSON: {dataJson}")
End Sub
-
void TestCppClient::wshEventData(int reqId, const std::string& dataJson) {
printf("WSH Event Data. ReqId: %d, dataJson: %s\n", reqId, dataJson.c_str());
}
-
1 def wshEventData(self, reqId: int, dataJson: str):
2 super().wshEventData(reqId, dataJson)
3 print(
"WshEventData.",
"ReqId:", reqId,
"Data JSON:", dataJson)
Pending event data requests can be canceled with the function IBApi.EClient.cancelWshEventData
Also note that TWS will not support multiple concurrent requests. Previous request should succeed, fail, or be cancelled by client before next one. TWS will reject such requests with text "Duplicate WSH meta-data request" or "Duplicate WSH event request".
In TWS API 10.15+ Wall Street Horizon Event Calendar queries and filters have been added. For guidelines and more information please visit Wall Street Horizon Corporate Event filters page.