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)




"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
"IQ feed is brilliant. The support is mind-bending. What service!" - Comment from Public Forum Post
"If you are serious about your trading I would not rely on IB data for serious daytrading. Took me a while to justify the cost of IQ Feed and in the end, it's just a 2 point stop on ES. Better safe than sorry" - Comment from Public Forum
"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
"You have an excellent feed. Very few spikes for Spot Forex." - Comment from Public Forum Post
"I will tell others who want to go into trading that DTN ProphetX is an invaluable tool, I don't think anyone can trade without it..." - Comment from Luther
"This beats the pants off CQG, I am definitely switching to the ProphetX 3.0!" - Comment from Stephen
"I have to tell you though that using the IQFeed API is about the easiest and cleanest I have seen for some time." - Comment from Jim
"Just a thank you for the very helpful and prompt assistance and services. You provided me with noticeably superior service in my setup compared to a couple of other options I had looked at." - Comment from John
"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: Tue May 7, 2024 3:02 AM CFBB v1.2.0 12 ms.
© AderSoftware 2002-2003