Join the 80,000 other DTN customers who enjoy the fastest, most reliable data available. There is no better value than DTN!

(Move your cursor to this area to pause scrolling)




"Previously I was using *******. IQFeed is WAY more economical, and for my charting needs is just as good, if not better." - Comment from Public Forum Post
"I cannot believe what a difference it makes trading with ProphetX!" - Comment from Bruce in Los Angeles
"Boy, probably spent a thousand hours trying to get ******* API to work right. And now two hours to have something running with IQFeed. Hmmm, guess I was pretty stupid to fight rather than switch all this time. And have gotten more customer service from you guys already than total from them… in five years." - Comment from Jim
"I'm very glad I switched to IQFeed. It's working perfectly with no lag, even during fast market conditions." - Comment from Andy via Email
"You are either overstaffed or people just don't have problems with your feed because customer support always answers the phone quickly." - Comment from Jay via Email
"You have an excellent feed. Very few spikes for Spot Forex." - Comment from Public Forum Post
"My broker in Davenport suggested I give you a try as he uses your service and says its the best." - Comment from Bill via RT Chat
"Very impressed with the quality of your feed - ******* is a real donkey in comparison." - Comment from A.C. via Email
"Its working FABULOUSLY for me!! Holy cow...there has been so much I've been missing lately, and with this feed and Linnsoft software...I'm in the game now." - Comment from Chris R.
"I "bracket trade" all major news releases and I have not found one lag or glitch with DTN.IQ feed. I am very comfortable with their feed under all typical news conditions (Fed releases, employment numbers, etc)." - Comment from Public Forum
Home  Search  Register  Login  Recent Posts

Information on DTN's Industries:
DTN Oil & Gas | DTN Trading | DTN Agriculture | DTN Weather
Follow DTNMarkets on Twitter
DTN.IQ/IQFeed on Twitter
DTN News and Analysis on Twitter
»Forums Index »Archive (2017 and earlier) »IQFeed Developer Support »NHL News Headlines Request
Author Topic: NHL News Headlines Request (6 messages, Page 1 of 1)

PyDev
-Interested User-
Posts: 4
Joined: Mar 10, 2019


Posted: Mar 10, 2019 08:14 PM          Msg. 1 of 6
Hi,

I'm attempting to retrieve news headlines for a specific date, however, upon sending the requests for a specific Source, I receive a message displaying all of the possible Sources and no headline.

I'm coding in Python as below:

#use context manager to initialize socket
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:

#connect to host and port
s.connect((host,port))

#setting protocol
s.sendall(b'(S,SET PROTOCOL, 6.0.0.5\r\n')

#sending news headline request
s.sendall(b'NHL,RTK,,t,,20190310,\r\n')

#storing message in variable
news=s.recv(1024).decode()

This is what I receive:

'News,CATEGORY,All News\r\nNews,MAJOR,DTN,DTN News,1D,10\r\nNews,MINOR,DT5,Treasuries, Most Actives, Gainers, Losers,1D,10\r\nNews,MINOR,RTL,Derivatives - Selected Futures and Options,2Ab,10\r\nNews,MINOR,DT7,Quote List Changes,1D,10\r\nNews,MINOR,RTI,Calendars and Reports,2Ab,10\r\nNews,MAJOR,CPR,PR Newswire,1X,5\r\nNews,MAJOR,CBW,Business Wire,1X,2\r\nNews,MAJOR,RTT,Real-Time Trader,2Ab,10\r\nNews,MINOR,RTB,Breaking News Headlines,2Ab,10\r\nNews,MINOR,RTC,Big Stories,2Ab,10\r\nNews,MINOR,RTD,Analyst Updates,2Ab,10\r\nNews,MINOR,RTE,Analyst Comments,2Ab,10\r\nNews,MINOR,RTF,Stocks on the Move,2Ab,10\r\nNews,MINOR,RTG,Corporate Actions,2Ab,10\r\nNews,MINOR,RTH,Market Overview,2Ab,10\r\nNews,MINOR,RTK,Economic News,2Ab,10\r\nNews,MINOR,RTJ,Canadian Stocks and Market Overview,2Ab,10\r\nNews,MINOR,RTM,Asian Market,2Ab,10\r\nNews,MINOR,RTN,Wall Street Events/Conference Calls,2Ab,10\r\nNews,MAJOR,CPZ,GlobeNewswire Inc,2Ag,10\r\nNews,MAJOR,BEN,Benzinga Pro,1a,10\r\nNews,!ENDMSG!,\r\n'

I'm aware that there are some headlines within the filter provided from viewing the news desktop app. How can I resolve this discrepancy?

Thanks

DTN_Steve_S
-DTN Guru-
Posts: 2093
Joined: Nov 21, 2005


Posted: Mar 11, 2019 08:41 AM          Msg. 2 of 6
Hello. There are a couple things to consider here. Your S,SET PROTOCOL command isn't correct. You should be getting an error message back on that request. It only uses Major/Minor. The results you are getting are for a config request. You have to be sending this request somewhere in your code (nothing automatically does this for you in the API itself).

Other than that, your request works fine for me and returns headlines (only a few results copied here for brevity):

N,RTK,22120099247,:DKK:,20190311092941,Denmark Inflation Slows In February
N,RTK,22120096642,:EUR:,20190311091801,German BDI Cuts 2019 Growth Forecast To 1.2% From 1.5%
N,RTK,22120096422,:NOK:,20190311091351,Norway Inflation At 7-Month Low
N,RTK,22120093159,:EUR:,20190311085320,Estonia Trade Gap Narrows In January
N,RTK,22120087392,:USD:,20190311083820,U.S. Retail Sales Unexpectedly Rise 0.2% In January
N,RTK,22120086279,:USD:,20190311083100,U.S. Retail Sales Rise 0.2% In January, Ex-Auto Sales Climb...
N,RTK,22120062151,:EUR:,20190311065957,Ireland Construction Growth At 7-Month High
N,RTK,22120056465,:EUR:,20190311062747,Malta Jan Industrial Production +2.3% On Month Vs. -7.0% In...
!ENDMSG!,

PyDev
-Interested User-
Posts: 4
Joined: Mar 10, 2019


Posted: Mar 11, 2019 09:45 AM          Msg. 3 of 6
Steve,

Thanks. The protocol wasn't the issue. Before increasing the precision of the protocol I used only the major and minor version and got the same issue as above. Both return the same messages.

One fix that I implemented was after the NCG confiq request, was to store that message in a variable of which was what I was receiving before. Initially, this alleviated the config. message I was receiving but I still wasn't receiving headlines.

I then commented out the entire config. message and was able to get headlines. (below message was received using exact protocol precision)

Response from Server:
S,CURRENT PROTOCOL,6.0

news:
N,RTK,22120124744,:EUR:,20190311102326,Bank Of France Lowers Q1 Growth Estimate To 0.3%
N,RTK,22120122646,:USD:,20190311101736,U.S. Business Inventories Climb In Line With Estimates In D...
N,RTK,22120120618,:CZK:,20190311100815,Czech Inflation Accelerates Further
N,RTK,22120113602,:USD:,20190311100055,U.S. Business Inventories Climb 0.6% In December
N,RTK,22120104959,:EUR:,20190311094951,Spain Retail Sales Rise For Fourth Month
N,RTK,22120101980,:USD:,20190311093901,U.S. Retail Sales Unexpectedly Show Modest Rebound In January
N,RTK,22120099247,:DKK:,20190311092941,Denmark Inflation Slows In February
N,RTK,22120096642,:EUR:,20190311091801,German BDI Cuts 2019 Growth Forecast To 1.2% From 1.5%
N,RTK,22120096422,:NOK:,20190311091351,Norway Inflation At 7-Month Low
N,RTK,22120093159,:EUR:,20190311085320,Estonia Trade Gap Narrows In January
!ENDMSG!,

I noticed that even though I set the NCG message to return text, it would still return XML. I received the above headlines after I commented out the NCG message and manually placing 't' in the NHL request.

In the prior post, I was iterating through a list of symbols. The RTK filter symbols are country symbols and my symbol list were futures contracts, this was the issue. I fixed this but left the NCG request commented and received the following:(i.e. news for each country)
Response from Server:
S,CURRENT PROTOCOL,6.0

news:
N,RTK,22120122646,:USD:,20190311101736,U.S. Business Inventories Climb In Line With Estimates In D...
N,RTK,22120113602,:USD:,20190311100055,U.S. Business Inventories Climb 0.6% In December
N,RTK,22120101980,:USD:,20190311093901,U.S. Retail Sales Unexpectedly Show Modest Rebound In January
N,RTK,22120087392,:USD:,20190311083820,U.S. Retail Sales Unexpectedly Rise 0.2% In January
N,RTK,22120086279,:USD:,20190311083100,U.S. Retail Sales Rise 0.2% In January, Ex-Auto Sales Climb...
!ENDMSG!,

Response from Server:
S,CURRENT PROTOCOL,6.0

news:
N,RTK,22120124744,:EUR:,20190311102326,Bank Of France Lowers Q1 Growth Estimate To 0.3%
N,RTK,22120104959,:EUR:,20190311094951,Spain Retail Sales Rise For Fourth Month
N,RTK,22120096642,:EUR:,20190311091801,German BDI Cuts 2019 Growth Forecast To 1.2% From 1.5%
N,RTK,22120093159,:EUR:,20190311085320,Estonia Trade Gap Narrows In January
N,RTK,22120062151,:EUR:,20190311065957,Ireland Construction Growth At 7-Month High
N,RTK,22120056465,:EUR:,20190311062747,Malta Jan Industrial Production +2.3% On Month Vs. -7.0% In...
N,RTK,22120056323,:EUR:,20190311062637,Malta Jan Industrial Production +2.8% On Year Vs. -0.9% In ...
N,RTK,22120026553,:EUR:,20190311053427,Slovenia Jan Industrial Production Up 6.0% On Month
N,RTK,22120026315,:EUR:,20190311053347,Slovenia Jan Industrial Production Up 5.8% On Year
N,RTK,22120012753,:EUR:,20190311044750,German Industrial Production Unexpectedly Declines In Janua...
!ENDMSG!,

Response from Server:
S,CURRENT PROTOCOL,6.0

news:
!ENDMSG!,

Response from Server:
S,CURRENT PROTOCOL,6.0

news:
!ENDMSG!,

Response from Server:
S,CURRENT PROTOCOL,6.0

news:
!ENDMSG!,

Response from Server:
S,CURRENT PROTOCOL,6.0

news:
!ENDMSG!,


However, when I uncommented the NCG request and set the return type to 't' and removed the 't' from the NHL request, I still received news in XML format(excerpt below):
Response from Server:
S,CURRENT PROTOCOL,6.0

news:
<?xml version='1.0'?>
<news_headlines>
<news_headline>
<id>22120122646</id>
<source>RTK</source>
<timestamp>20190311101736</timestamp>
<symbols>:USD:</symbols>
<text>U.S. Business Inventories Climb In Line With Estimates In D...</text>
</news_headline>
<news_headline>
<id>22120113602</id>
<source>RTK</source>
<timestamp>20190311100055</timestamp>
<symbols>:USD:</symbols>
<text>U.S. Business Inventories Climb 0.6% In December</text>
</news_headline>
<news_headline>
<id>22120101980</id>
<source>RTK</source>
<timestamp>20190311093901</timestamp>
<symbols>:USD:</symbols>
<text>U.S. Retail Sales Unexpectedly Show Modest Rebound In January</text>
</news_headline>
<news_headline>
<id>22120087392</id>
<source>RTK</source>
<timestamp>20190311083820</timestamp>
<symbols>:USD:</symbols>
<text>U.S. Retail Sales Unexpectedly Rise 0.2% In January</text>
</news_headline>
<news_headline>
<id>22120086279</id>
<source>RTK</source>
<timestam
Response from Server:
S,CURRENT PROTOCOL,6.0

Not sure why this is but the core issue was iterating through incorrect symbol list. I can set the return type via NHL until the issue with NCG is fixed.

Thanks

DTN_Steve_S
-DTN Guru-
Posts: 2093
Joined: Nov 21, 2005


Posted: Mar 11, 2019 10:27 AM          Msg. 4 of 6
I don't see anything that would indicate any of these issues are results of an error in the API (not 100% sure if that's what you were indicating or not but figured I'd mention it).

At this point, I would recommend turning on the logging in IQConnect to show you the Lookup Requests and Data for troubleshooting. You can do this via the example app.

I'm fairly certain you have something mixed up in your request/response processing code and hopefully the logfile will show you exactly what the feed is receiving from your app and sending in response.

The text vs XML issue has to be an error where you're either not actually sending the t or you are sending the t in the wrong field.

altmany
-Interested User-
Posts: 73
Joined: Jul 30, 2018

IQML - IQFeed-MATLAB connector


Posted: Mar 12, 2019 03:15 PM          Msg. 5 of 6
PyDev - I think that you may be misunderstanding the purpose of the NCG request and its relation to NHL, and that this causes your confusion.

In fact, NCG is entirely unrelated to NHL - NCG is simply a request for IQFeed to send you your account's news-sources configuration, in either text or XML format. NCG does not modify anything for subsequent NHL queries, nor does it update anything in your account's news configuration, which does not change during the run-time of your program. The text/XML field in the NCG query only affects the response message for this query and not for any other subsequent query. Also, NCG does not start streaming any news headlines.

In contrast, NHL is a query to retrieve news headlines, in either text or XML formats. It is entirely unrelated to NCG, except for the fact that the 3-letter news source is described in the NCG response message (for example, CPR = PR Newswire). You can ask the NHL query responses in either text or XML format, but this is separate from the format that you asked in the NCG query.

Your program should query NCG just once, at the beginning of your program run, and then call NHL multiple times later. There is no point in calling NCG more than once in the program since the config information does not change.

Note: I am not a DTN employee; my post reflects my personal opinion and not necessarily DTN's

- Yair
IQML - IQFeed-Matlab connector
https://UndocumentedMatlab.com/IQML

PyDev
-Interested User-
Posts: 4
Joined: Mar 10, 2019


Posted: Mar 14, 2019 01:05 PM          Msg. 6 of 6
altmany,

Thanks for the clarity. I was running NCG once but misinterpreted use in relation to NHL.
 

 

Time: Wed May 1, 2024 12:26 PM CFBB v1.2.0 19 ms.
© AderSoftware 2002-2003