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 used to have *******, but they are way more money for the same thing. I have had no probs with data from DTN since switching over." - Comment from Public Forum Post
"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 like you guys better than *******...much more stable and a whole lot fewer issues." - Comment from Philip
"I just wanted to let u know that your data feed/service is by far the best!!! Your unfiltered tick data is excellent for reading order flow and none of your competitors delivers this quality of data!" - Comment from Peter via Email
"You are much better than lawyers or the phone company because you answer the phone when I call! I just love your customer service." - Comment from Isreal
"It’s so nice to be working with real professionals!" - Comment from Len
"If someone needs the best quality data and backfill beyond what their broker provides at a rate that is the best in the industry, I highly recommend IQFeed." - Comment from Josh via Public Forum
"IQ feed works very well, does not have all of the normal interruptions I have grown used to on *******" - Comment from Mark
"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
"Thank you so much - awesome feed, awesome service!" - Comment from Greg via Email
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 »C# sample program for Leve1Socket
Author Topic: C# sample program for Leve1Socket (6 messages, Page 1 of 1)

Lav2018
-Interested User-
Posts: 10
Joined: Mar 15, 2018


Posted: Apr 4, 2018 08:55 PM          Msg. 1 of 6
I've found all of the sample C# programs very helpful and the comments make for easy following. I have one question about the Level1Socket program.

In Level1SocketForm.cs, lines 201-202 are:

 
// move on to the next message. This isn't very efficient but it is simple (which is the focus of this example).
sData = sData.Substring(sLine.Length + 1);


Do you have any examples showing more efficient ways? If not, can you please point me towards a better solution. Thank you.

DTN_Tim Walter
-DTN Guru-
Posts: 1238
Joined: Apr 25, 2006


Posted: Apr 5, 2018 08:06 AM          Msg. 2 of 6
You would want to do something that doesn't involve creating additional strings whenever possible. Anything that does a string copy like this can be costly. I did some looking and substring and split both have this kind of behavior, so I would probably look into MemoryStreams or a StringReader as possible alternatives, but I have not done any testing of those options to confirm their performance.

https://msdn.microsoft.com/en-us/library/system.io.stringreader(v=vs.110).aspx
https://msdn.microsoft.com/en-us/library/system.io.memorystream(v=vs.110).aspx

Tim

Lav2018
-Interested User-
Posts: 10
Joined: Mar 15, 2018


Posted: Apr 5, 2018 02:51 PM          Msg. 3 of 6
Makes sense. Thanks.

mathpaquette
-Interested User-
Posts: 22
Joined: May 18, 2018


Posted: May 18, 2018 06:43 AM          Msg. 4 of 6
Hello Lav2018,

Please have a look to my open source C# IQFeed client.

https://github.com/mathpaquette/IQFeed.CSharpApiClient

Your feedbacks are welcome!
Mathieu

mathpaquette
-Interested User-
Posts: 22
Joined: May 18, 2018


Posted: May 18, 2018 07:14 AM          Msg. 5 of 6
Well, I'm still skeptical about the real performance benefit of not using .Split. I'll do some performance tests to conclude on this.

mathpaquette
-Interested User-
Posts: 22
Joined: May 18, 2018


Posted: May 22, 2018 08:06 PM          Msg. 6 of 6
 

 

Time: Fri April 26, 2024 11:22 AM CFBB v1.2.0 8 ms.
© AderSoftware 2002-2003