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 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
"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
"Version 4.0.0.2 has been working well for me and I appreciate that it is now a much tighter client to work with. I feel I can go to press with my own application and rely on a stable platform" - Comment from David in IA.
"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
"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
"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
"I noticed that ******* quotes locked up shortly after the interest rate announcement yesterday while yours stayed stable." - Comment from Ron in Utah
"You have an excellent feed. Very few spikes for Spot Forex." - Comment from Public Forum Post
"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
"As a past ******* customer(and not a happy one), IQ Feed by DTN is a much better and cheaper product with great customer support. I have had no problems at all since switching over." - 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 »How do I put the QuoteMessage on another thread...
Author Topic: How do I put the QuoteMessage on another thread... (9 messages, Page 1 of 1)

d_allen
-Interested User-
Posts: 29
Joined: Nov 5, 2008


Posted: Jan 26, 2011 05:56 PM          Msg. 1 of 9
I'm a novice C# developer and I'm using the activeX control which fires the axIQFeedY_QuoteMessage event. I have a couple of method calls which parses the feed then inserts the results into a database but this seems to overwhelm the windows form and consumes too much of my system resources so I wanted to put the axIQFeedY_QutoeMessage event on another thread. I tried to create a thread pass the event to an anonymous delegate:

ThreadStart myThreadStart = delegate() {axIQFeedY_QuoteMessage(object o, AxIQFEEDLib._DIQFeedYEvents_QuoteMessageEvent e);}

Thread myThread = new Thread(myThreadStart);
myThread.Start();

I don't know where or what object to pass to the axIQFeedY_QuoteMessage or how to instantiate the axIQFeedY_QuoteMessage. Can someone please explain/show me what I'm doing wrong and the correct way to go about this.

Thanks!
-Allen
Edited by d_allen on Jan 26, 2011 at 05:57 PM

Helg37
-Interested User-
Posts: 6
Joined: Jan 4, 2011


Posted: Jan 27, 2011 11:31 AM          Msg. 2 of 9
Hello !
I use queue of "supplier-consumer" ConcurrentQueue.
In queue data is added, and another thread takes them and work.

d_allen
-Interested User-
Posts: 29
Joined: Nov 5, 2008


Posted: Jan 27, 2011 07:13 PM          Msg. 3 of 9
thanks Helg37,

can you PLEASE show me an example of exactly what you're talking about?

-Allen
Edited by d_allen on Jan 27, 2011 at 07:14 PM

Helg37
-Interested User-
Posts: 6
Joined: Jan 4, 2011


Posted: Jan 28, 2011 01:15 AM          Msg. 4 of 9
This is an example of logic that I use for processing Data Feed

using System.Threading;
using System.Collections.Concurrent;

public ConcurrentQueue<Prints> prints;
private EventWaitHandle wh_prints;
Thread worker_print;
static object locker = new object();

prints = new ConcurrentQueue<Prints>();
wh_prints = new AutoResetEvent(false);

worker_print = new Thread(WorkPrint);
worker_print.Start();

Prints pq = null;
GetPrint(pq);
worker_print.Join();
wh_prints.Close();
worker_print.Abort();

public void GetPrint(Prints pq)
{
lock (locker)
{
prints.Enqueue(pq);
wh_prints.Set();
}
}

void WorkPrint()
{
while (true)
{
Prints pq = null;
if (!prints.IsEmpty)
{
if (prints.TryDequeue(out pq))
{
if (pq == null)
{
return;
}
}
else
continue;
}

if (pq != null)
{
lock (locker)
{
………………
}
}
else
wh_prints.WaitOne();
}
}

d_allen
-Interested User-
Posts: 29
Joined: Nov 5, 2008


Posted: Jan 28, 2011 12:51 PM          Msg. 5 of 9
Thanks Helg37! I just just wanted to say thank you for responding to my "thread" no pun intended lol! And I'm most definitely grateful for the code!!! If I have any question or need any clarification I'll ask.

take care and have a good wkEnd Helg37.

-Allen

d_allen
-Interested User-
Posts: 29
Joined: Nov 5, 2008


Posted: Jan 28, 2011 03:41 PM          Msg. 6 of 9
hey helg37, what is the "Prints" data type that's used in the generic container (concurrentQueue)? is that the quote argument dataType from iqFEED? also are GetPrint() and WorkerPrint() in the iqFEED quote event? and where is the worker_print thread started? i assuming it not started in the iqFEED quote event?

also I don't understand why youre locking the conconcurrentQueue object? doesn't the EventWaitHandle object synchronize your thread?
Edited by d_allen on Jan 28, 2011 at 03:46 PM
Edited by d_allen on Jan 28, 2011 at 03:47 PM

Helg37
-Interested User-
Posts: 6
Joined: Jan 4, 2011


Posted: Jan 29, 2011 12:45 AM          Msg. 7 of 9
Hello !
Do not quite understand your question, but issues of implementation of Data Feed processing in my humble opinion is a question a specific developer.
I showed an example, one way of handling a strong Data Feed. Details are already on the accurate implementation of the code by yourself. I do not claim purity of the sample code, but this scheme really works for me. But the code sample may be not optimal.

d_allen
-Interested User-
Posts: 29
Joined: Nov 5, 2008


Posted: Jan 30, 2011 04:41 PM          Msg. 8 of 9

Edited by d_allen on Jan 30, 2011 at 04:44 PM

d_allen
-Interested User-
Posts: 29
Joined: Nov 5, 2008


Posted: Jan 30, 2011 04:41 PM          Msg. 9 of 9
hey Helg37 sorry if I came off like I was trying to critique your code, lol! I just don't understand what's going on and what I'm suppose to be doing :) I need to understand what's going on and "WHY". That way I'll know how to modify it to fit my own needs and also I'll be more knowledgeable about what's going on and what I'm doing. That's why I had so many questions.

I'm thankful that you replied and provided me with a solution, I'm just not clear on what's going on and how I'm suppose to use the example that you provided.

So please don't take my questions the wrong way, I'm just trying to learn and not just have you guys hold my hand and give me the answers...it's VERY important for me to understand what I'm doing.

:)

allen
Edited by d_allen on Jan 30, 2011 at 04:47 PM
Edited by d_allen on Jan 30, 2011 at 04:49 PM
Edited by d_allen on Jan 30, 2011 at 04:49 PM
 

 

Time: Sat April 27, 2024 4:37 PM CFBB v1.2.0 10 ms.
© AderSoftware 2002-2003