From time to time, IB sends out important News Bulletins, which can be accessed via the TWS API through the IBApi.EClient.reqNewsBulletins.
-
client.reqNewsBulletins(true);
-
client.reqNewsBulletins(true);
-
client.reqNewsBulletins(True)
-
m_pClient->reqNewsBulletins(true);
-
1 self.reqNewsBulletins(
True)
Bulletins are delivered via IBApi.EWrapper.updateNewsBulletin whenever there is a new bulletin:
-
public class EWrapperImpl : EWrapper
{
... public virtual void updateNewsBulletin(int msgId, int msgType, String message, String origExchange)
{
Console.WriteLine("News Bulletins. "+msgId+" - Type: "+msgType+", Message: "+message+", Exchange of Origin: "+origExchange+"\n");
}
-
public class EWrapperImpl implements EWrapper {
... @Override
public void updateNewsBulletin(int msgId, int msgType, String message, String origExchange) {
System.out.println("News Bulletin: " + EWrapperMsgGenerator.updateNewsBulletin( msgId, msgType, message, origExchange));
}
-
Public Class EWrapperImpl
Implements EWrapper
... Public Sub updateNewsBulletin(msgId As Integer, msgType As Integer, message As String, origExchange As String) Implements IBApi.EWrapper.updateNewsBulletin
Console.WriteLine("News Bulletins. " & msgId & " - Type: " & msgType & ", Message: " & message & ", Exchange of Origin: " & origExchange)
End Sub
-
class TestCppClient : public EWrapper
{
... void TestCppClient::updateNewsBulletin(int msgId, int msgType, const std::string& newsMessage, const std::string& originExch) {
printf( "News Bulletins. %d - Type: %d, Message: %s, Exchange of Origin: %s\n", msgId, msgType, newsMessage.c_str(), originExch.c_str());
}
-
1 class TestWrapper(wrapper.EWrapper):
... 1 def updateNewsBulletin(self, msgId: int, msgType: int, newsMessage: str,
3 super().updateNewsBulletin(msgId, msgType, newsMessage, originExch)
4 print(
"News Bulletins. MsgId:", msgId,
"Type:", msgType,
"Message:", newsMessage,
5 "Exchange of Origin: ", originExch)
In order to stop receiving bulletins you need to cancel the subscription:
-
client.cancelNewsBulletin();
-
client.cancelNewsBulletins();
-
client.cancelNewsBulletin()
-
m_pClient->cancelNewsBulletins();
-
1 self.cancelNewsBulletins()