Skip to navigation

Contract Specific News

View as MarkdownOpen in Claude

Introduction

Important: in order to obtain news feeds via the TWS API you need to acquire the relevant API-specific subscriptions via your Account Management.

News articles provided through the API may not correspond to what is available directly through the Trader Workstation. Off-platform distribution of data is at the discretion of the news source provider, not by Interactive Brokers.

When invoking EClient.reqMktData, for a specific Contract you will follow the same format convention as any other basic contracts. The News Source is identified by the genericTickList argument.

Note: The error message “invalid tick type” will be returned if the username has not added the appropriate API news subscription.

Note: For Briefing Trader live headlines via the API is only offered on a case-by-case basis directly from Briefing.com offers Briefing Trader subscribers access to the subscription live headlines via the API. For more information and to submit an API entitlement application, please contact Briefing.com directly at dbeasley@briefing.com.


Request Contract Specific News

EClient.reqMktData(reqId, contract, genericTickList, snapshot, regulatorySnapshot, mktDataOptions)

Used to request market data typically, but can also be used to retrieve news. “mdoff” can be specified to disable standard market data while retrieving news. For news sources, genericTick 292 needs to be specified followed by a colon and the news provider’s code.

reqId
int

Request identifier for tracking data.

contract
Contract

Contract object used for specifying an instrument.

genericTickList
string

Comma separated ids of the available generic ticks.

snapshot
bool

Always set to false for news data.

regulatorySnapshot
bool

Always set to false for news data.

mktDataOptions
List<TagValue>

Internal use only.


self.reqMktData(reqId, contract, "mdoff,292:BRFG", False, False, [])

Request BroadTape News

For BroadTape News you specify the contract for the specific news source. This is uniquely identified by the symbol and exchange. The symbol of an instrument can easily be obtained via the EClient.reqContractDetails request.

The symbol is typically the provider code, a colon, then the news provider codes appended with “_ALL”.

contract = Contract()
contract.symbol = "BRF:BRF_ALL"
contract.secType = "NEWS"
contract.exchange = "BRF"

Then request market data using “mdoff,292”:

self.reqMktData(reqId, contract, "mdoff,292", False, False, [])

Receive Live News Headlines

EWrapper.tickNews(tickerId, timeStamp, providerCode, articleId, headline, extraData)

Returns news headlines for requested contracts.

tickerId
int

Request identifier used to track data.

timeStamp
int

Epoch time of the article’s published time.

providerCode
string

News provider code based on requested data.

articleId
string

Identifier used to track the particular article.

headline
string

Headline of the provided news article.

extraData
string

Returns any additional data available about the article.


def tickNews(self, tickerId: int, timeStamp: int, providerCode: str, articleId: str, headline: str, extraData: str):
print("TickNews. TickerId:", tickerId, "TimeStamp:", timeStamp, "ProviderCode:", providerCode, "ArticleId:", articleId, "Headline:", headline, "ExtraData:", extraData)