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 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
"IQ feed is brilliant. The support is mind-bending. What service!" - Comment from Public Forum Post
"After all the anxiety I had with my previous data provider it is a relief not to have to worry about data speed and integrity." - Comment from Eamonn
"You have an excellent product !!!!!!" - Comment from Arely
"I've never had DTN go out on me since switching. ******* would go down a couple times every month when I was using them." - Comment from Bryce in AL.
"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
"Just a quick one to say I'm very impressed so far :) The documentation for developers is excellent and I've quickly managed to get an app written to do historical downloads. The system is very robust and pretty quick considering the extent of data that's available. The support guys have been very helpful too, in combination with the forums it's been plain sailing so far!" - Comment from Adam
"This beats the pants off CQG, I am definitely switching to the ProphetX 3.0!" - Comment from Stephen
"I started a trial a few weeks back before the market went wild. DTN.IQ didn’t miss anything and beat my other provider. I decided to stay with you because of the great service through all the volatility." - Comment from Mike
"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
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 May 18, 2024 12:07 AM CFBB v1.2.0 11 ms.
© AderSoftware 2002-2003