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)




"Everything is working great with the API. I love it." - Comment from Calvin
"This is an excellent value, the system is generous (allowing for 500 stocks) and stable (and really is tick-by-tick), and the support is fantastic." - Comment from Shirin 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 am very happy I changed. I love the product, but more so I am thrilled with Tech Support. You are knowledgeable, polite, pleasant and professional." - Comment from Pat
"Thank God for your Data Feed as the only Zippers I see are on my pants (LOL), and no more 200 pip spikes to mess up charts." - Comment from Spiro via Email
"IQ feed works very well, does not have all of the normal interruptions I have grown used to on *******" - Comment from Mark
"I am enjoying the feed very much - so superior to the broker provided feed I was previously using." - Comment from George
"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
"The service is great, I see a noticeable improvement in my volume profiles over [broker]'s data feed" - Comment from Larry
"With HUGE volume on AAPL and RIMM for 2 days, everyone in a trading room was whining about freezes, crashes and lag with *******, RealTick, TS and Cyber. InvestorRT with IQFeed was rock solid. I mean SOLID!" - Comment from Public IRC Chat
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 »HTT Data Receive Speed
Author Topic: HTT Data Receive Speed (6 messages, Page 1 of 1)

DavidG
-Interested User-
Posts: 8
Joined: Sep 29, 2009


Posted: Mar 10, 2010 11:12 PM          Msg. 1 of 6
I think this may be more of a socket programming issue than an IQFeed issue, but I don't seem to be receiving tick data via HTT data at reasonable speeds.

Programming is in VS2008-VB.NET using the native socket support. In short, I use the VS2008 TCPClient class to connect to IQFeed, and assign it to a NetworkStream via .GetStream(). Two threads connect to IQFeed simultaneously, but one thread is always idle when the other is receiving data.

Upon sending the HTT request, I basically just poll the NetworkStream until .DataAvailable = true, and then grab the data using .Read when available and process it - all in a dedicated thread. The thread is idle about 97% of the time (i.e. .DataAvailable = true about 3% of the time) so it is not a processor speed issue. This is running on a new quad-core processor machine.

Also, I have an "okay" DSL connection that typically clocks just slightly under 3 Mbps receive speed.

By this method, right now I`m getting about 500-600 ticks per second. I don`t know how many bits are transmitted to get one tick, but I would think it has to be less that 300, even considering any other fruit salad that gets sent along. So, that works out to less than 0.2 Mbps.

Any suggestions as to how I might go about speeding this up? I'm wondering if I should use .BeginRead (which I believe is asynchronous) instead of .Read.

Thanks,
David.

redblue
-Interested User-
Posts: 51
Joined: Oct 29, 2009


Posted: Mar 11, 2010 03:58 AM          Msg. 2 of 6
Hi,

I don't use VS2008-VB.NET, but it's always a bad idea to poll for a socket. As you are already using threads, block on the socket instead. If you can't block (because you need to process other events) use select with a timeout. I suspect what is happening is that your poll is either too long or that you aren't reading all the data on the socket when .DataAvailable=true. You should be getting significantly faster than 500 ticks a second.

Regards,

red.

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


Posted: Mar 11, 2010 11:16 AM          Msg. 3 of 6
As redblue said, you should certainly be getting much faster than 500 ticks per second.

But I am hesitant to say that the socket polling is the sole responsibility of the decreased performance that you are seeing. For example, I modified the vb example app (which also uses socket polling) to output statistics for datapoints per second for each request and was able to get significantly higher results.

I am wondering if you get similar results using the example app as you do using your own app? Let me know if you want me to email the changes I made to the vb example app to track this down.

DavidG
-Interested User-
Posts: 8
Joined: Sep 29, 2009


Posted: Mar 11, 2010 03:48 PM          Msg. 4 of 6
Hi Steve,
Please send me your VB example and I'll give that a try.
Many thanks,
David.

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


Posted: Mar 11, 2010 04:31 PM          Msg. 5 of 6
Sent

DavidG
-Interested User-
Posts: 8
Joined: Sep 29, 2009


Posted: Mar 15, 2010 11:20 AM          Msg. 6 of 6
FYI: I didn't get the example working as the conversion wizard flubbed it up, and I didn't feel like manually fixing it. I did, however, try the blocking socket read method, and that - together with fixing a couple other bugs - got me up to just under 100,000 ticks/s (which I can live with).
Thanks for the help.
 

 

Time: Sat May 4, 2024 3:00 AM CFBB v1.2.0 10 ms.
© AderSoftware 2002-2003