Skip to navigation

Historical News

View as MarkdownOpen in Claude

Introduction

With the appropriate API news subscription, historical news headlines can be requested from the API using the function EClient.reqHistoricalNews. The resulting headlines are returned to EWrapper.historicalNews.


Request Historical News

EClient.reqHistoricalNews(requestId, conId, providerCodes, startDateTime, endDateTime, totalResults, historicalNewsOptions)

Requests historical news headlines.

requestId
int

Request identifier used to track data.

conId
int

Contract id of ticker. See Contract Details for how to retrieve conId.

providerCodes
string

A ’+‘-separated list of provider codes.

startDateTime
string

Marks the (exclusive) start of the date range. The format is yyyy-MM-dd HH:mm:ss. You can set either startDateTime or endDateTime. If both are set, endDateTime is ignored.

endDateTime
string

Marks the (inclusive) end of the date range. The format is yyyy-MM-dd HH:mm:ss. You can set either startDateTime or endDateTime. If both are set, endDateTime is ignored.

totalResults
int

The maximum number of headlines to fetch (1 – 300).

historicalNewsOptions
Null

Reserved for internal use. Should be defined as null.


self.reqHistoricalNews(reqId, 8314, "BRFG", "", "", 10, [])

Receive Historical News

EWrapper.historicalNews(requestId, time, providerCode, articleId, headline)

Returns news headlines for requested contracts.

requestId
int

Request identifier used to track data.

time
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.


def historicalNews(self, requestId: int, time: int, providerCode: str, articleId: str, headline: str):
print("historicalNews. RequestId:", requestId, "Time:", time, "ProviderCode:", providerCode, "ArticleId:", articleId, "Headline:", headline)

EWrapper.historicalNewsEnd

EWrapper.historicalNewsEnd(requestId, hasMore)

Returns news headlines end marker.

requestId
int

Request identifier used to track data.

hasMore
bool

Returns whether there is more data (true) or not (false).

def historicalDataEnd(self, reqId: int, hasMore: bool):
print("historicalDataEnd. ReqId:", reqId, "Has More:", hasMore)