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)




"I am a hedge fund manager here. It’s funny, I have a Bloomberg terminal and a Bridge feed, but I still like having my DTN feed!" - Comment from Feras
"I was with ******* for 4 years at $230 a month, this is a huge savings for me, GOD BLESS YOU PEOPLE," - Comment from T.S. via Email
"Everything is working great ! Very impressive client. The news refreshes better and is more pertinent than the ******* feed I paid $ 100/month for. I Also like the charts a lot." - Comment from Leon
"I have been using IQFeed now for a few years in MultiCharts and I have zero complaints. Very, very rare to have any data hiccups or anything at all go wrong." - Comment from Public Forum
"I like you guys better than *******...much more stable and a whole lot fewer issues." - Comment from Philip
"You have an excellent feed. Very few spikes for Spot Forex." - Comment from Public Forum Post
"I was on the phone with a friend who uses CQG and right after the Fed announcement, CQG was as much as 30 seconds behind DTN.IQ. Some quotes were off by as much as 15-18 cents. Your feed never missed a beat." - Comment from Roger
"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
"I just wanted to say how happy I am with your service. I was able to download the API docs last week and I was able to replicate Interactive Brokers historical bar queries and realtime bar queries over the weekend. That was about one of the fastest integrations that I've ever done and it works perfectly!!!!" - Comment from Jason via Email
"I've been using IQFeed 4 in a multi-threaded situation for the last week or two on 2600 symbols or so with 100 simultaneous daily charts, and I have had 100% responsiveness." - Comment from Scott
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 »IQFeed Developer »IQFeed Developer Support »Empty result from HTT request
Author Topic: Empty result from HTT request (13 messages, Page 1 of 1)

jayqwi
-Interested User-
Posts: 6
Joined: Jul 10, 2020


Posted: Dec 8, 2022 04:36 PM          Msg. 1 of 13
I often get an empty string from "socket.recv(1024).decode('latin-1')" when using IQFeed with wine & Python on Linux. If I restart the downloading process, and make the same HTT call, I get back a normal message (sometimes it's "NO_DATA", which is also normal).

Has anybody else experienced this, and knows how to fix it? My script auto-restarts the process whenever this happens, but it's still quite annoying.
Edited by jayqwi on Dec 8, 2022 at 04:48 PM

taa_dtn
-DTN Evangelist-
Posts: 146
Joined: May 7, 2004


Posted: Dec 8, 2022 05:57 PM          Msg. 2 of 13
My app is written in C++ rather than Python, but I've often seen equivalent behavior. I believe this to be due to a bug in Wine. I work around it by closing the socket, opening a new one, and retrying the request. This works always, so far as I can tell.

Coincidentally, I haven't seen this happen in over a week, so I was wondering if a recent Wine update had fixed it. My current Wine version is 7.22 (Staging), the default version for Fedora 36.

DTN_Gary_Stephen
-DTN Guru-
Posts: 290
Joined: Jul 3, 2019


Posted: Dec 9, 2022 07:55 AM          Msg. 3 of 13
I can't imagine why the same HTT request would return data some times and not others, unless it's running afoul of the "8/180" rule.

During regular trading hours (9:30 – 4:00 US Eastern time), tick data is only available for the last 8 days, and API requests will not return anything older during that time. Outside regular trading hours, tick data requests for up to 180 days will be processed.

So if you make the same request inside and outside of those times, and it's for data more than eight days old, that would explain getting different results. Beyond that, I'd need to see the entire request.

Sincerely,
Gary Stephen
DTN IQFeed Implementation Support Specialist

jayqwi
-Interested User-
Posts: 6
Joined: Jul 10, 2020


Posted: Dec 10, 2022 09:38 PM          Msg. 4 of 13
As taa_dtn noted, I think this is most probably a bug in wine. Would be good if there's some workaround.

stargrazer
-DTN Guru-
Posts: 300
Joined: Jun 13, 2005

Right Here & Now


Posted: Dec 10, 2022 09:45 PM          Msg. 5 of 13
I've gone through a number of years using wine. I somehow doubt it is a wine issue. My connections have been stable.

I use LXDE and x2go Wine v7.0

jayqwi
-Interested User-
Posts: 6
Joined: Jul 10, 2020


Posted: Dec 10, 2022 10:29 PM          Msg. 6 of 13
stargrazer: How many threads (or processes) do you use for HTT commands? I've noticed that it's mostly when I have multiple workers (I've tried both threads and processes; same problem) that each open a socket to IQFeed and run HTTs. I think it only very rarely (if at all) happens when I have only one worker.

I'm using Ubuntu 18.04.4 LTS with wine-7.0

stargrazer
-DTN Guru-
Posts: 300
Joined: Jun 13, 2005

Right Here & Now


Posted: Dec 11, 2022 12:05 AM          Msg. 7 of 13
Are you using the the v6.2 of the client?

I don't necessarily use HTT, but a number of the other history commands, and can do several 1000 symbols without error. I think 8 to 10 threads is the limit. And I've incorporated the time quota into the commands.

The following may provide some insight:
https://github.com/rburkholder/trade-frame/blob/master/lib/TFIQFeed/HistoryBulkQuery.h
https://github.com/rburkholder/trade-frame/blob/master/lib/TFIQFeed/HistoryQuery.h

The biggest recommendation, is if you reuse a connection, be sure if you've processed all messages to completion prior to sending a new command.

taa_dtn
-DTN Evangelist-
Posts: 146
Joined: May 7, 2004


Posted: Dec 11, 2022 01:09 AM          Msg. 8 of 13
I'm running client version 6.2.0.23 currently. I've been seeing this behavior for years, though, with many different versions of the client and a few different versions of the protocol and with two versions of my app. That's why I went to the trouble of implementing the workaround, and among the reasons why I suspect the problem isn't in the app or iqconnect.

In my case, each thread (of 8) issues a request and processes it to completion before issuing another request. Anything unexpected is logged, so I'm pretty sure there's nothing leftover that hasn't been processed. I simply get no response (and I've also tried a wide range of timeouts with no success).

jayqwi
-Interested User-
Posts: 6
Joined: Jul 10, 2020


Posted: Dec 11, 2022 10:29 AM          Msg. 9 of 13
Quote: I'm running client version 6.2.0.23 currently. I've been seeing this behavior for years, though, with many different versions of the client and a few different versions of the protocol and with two versions of my app. That's why I went to the trouble of implementing the workaround, and among the reasons why I suspect the problem isn't in the app or iqconnect.

In my case, each thread (of 8) issues a request and processes it to completion before issuing another request. Anything unexpected is logged, so I'm pretty sure there's nothing leftover that hasn't been processed. I simply get no response (and I've also tried a wide range of timeouts with no success).
--- Original message by taa_dtn on Dec 11, 2022 01:09 AM
I am exactly in the same situation. I also tried inserting delays between HTT calls to see if it helps, but it didn't. Even reopening the socket doesn't work for me sometimes, and as a last resort I also need to restart wine & IQFeed. All of this is automated, but it's quite annoying having to implement and maintain. Would be nice if there were a simpler workaround. I'm also pretty sure other people had the same problem and discussed it somewhere on these forums, but the search capability does not seem very easy to use.

stargrazer
-DTN Guru-
Posts: 300
Joined: Jun 13, 2005

Right Here & Now


Posted: Dec 11, 2022 10:35 AM          Msg. 10 of 13
Quote: stargrazer: How many threads (or processes) do you use for HTT commands?

Actually, it might be the threading thing. Not sure how you are doing it.

Use _only_ one thread per socket. You can have multiple requests per socket by using the tag feature. Only have about 8 - 10 requests submitted at any one time.

==> 1 socket - 1 thread - multiple tagged requests

In actual fact, I'd have to scrunch back through my code. I think I may have multiple sockets open, one thread per socket, with no more than 8 to 10 sockets, running one request in each socket at a time.

Edited by stargrazer on Dec 11, 2022 at 10:37 AM
Edited by stargrazer on Dec 11, 2022 at 10:37 AM
Edited by stargrazer on Dec 11, 2022 at 10:43 AM

jayqwi
-Interested User-
Posts: 6
Joined: Jul 10, 2020


Posted: Dec 11, 2022 10:56 AM          Msg. 11 of 13
Quote: Use _only_ one thread per socket.


Yes, I always use only one thread per socket. So if I have 8 threads, each thread opens its own unique socket. Out of frustration, I also tried using one process per socket (each process using only one thread), but same problem.

taa_dtn
-DTN Evangelist-
Posts: 146
Joined: May 7, 2004


Posted: Dec 11, 2022 01:24 PM          Msg. 12 of 13
Same here; each history-request thread has its own socket. I actually did this in reverse of the order jayqwi used; I started with each requester being a separate process, then switched to separate threads because load balancing is easier that way. I'm using tags, but only to make sure that no stale data arrives from previous requests; the intent is to run each request to completion before starting another.

Probably irrelevant, but while history-requests are being processed I do have at least two other independent processes with their own connections to the Level 1 port.

And I should emphasize that I haven't seen this misbehavior at all this month. Since my software hasn't changed (or even been recompiled), and iqconnect.exe hasn't been changed, I think that points to either Wine or the software running on the servers. I know there was a Wine update last month, so I suspect something got fixed in that release.

DTN_Gary_Stephen
-DTN Guru-
Posts: 290
Joined: Jul 3, 2019


Posted: Dec 12, 2022 08:26 AM          Msg. 13 of 13
If something were interfering with the HTT command (like a bug in Wine), it should be possible to confirm this via the iqconnect.txt log. Turn on "lookup requests", and the log will contain all historical requests that were sent to the IQFeed API. If something is changing the HTT command such that it fails, it will show up here.

Sincerely,
Gary Stephen
DTN IQFeed Implementation Support Specialist
 

 

Time: Tue January 31, 2023 11:20 PM CFBB v1.2.0 15 ms.
© AderSoftware 2002-2003