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'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.
"For anyone considering using DTN.IQ for a data feed, my experience with the quality of data and the tech support has been very positive." - Comment from Public Forum
"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
"And by the way, have to say this. I love the IQFeed software. It's rock solid and it has a really nice API." - Comment from Thomas via RT Chat
"I've been using Neoticker RT with IQFeed for two months, and I'm very happy with both of the products (I've had IQFeed for two years with very few complaints). The service from both companies is exceptional." - Comment from Public Forum
"Interactive Brokers tick data was inconsistent, so I have switched to using DTN exclusively. It is great to no longer have to worry about my datafeed all day long." - Comment from Philippe
"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
"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
"This beats the pants off CQG, I am definitely switching to the ProphetX 3.0!" - Comment from Stephen
"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
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 »IQFeed Developer »IQFeed Developer Support »Problems retrieving History in C# .NET via COM
Author Topic: Problems retrieving History in C# .NET via COM (6 messages, Page 1 of 1)

nelsonandara
-Interested User-
Posts: 3
Joined: Aug 21, 2006


Posted: Aug 21, 2006 12:21 AM          Msg. 1 of 6
I created a program based on a posting from January 2005 from Dennis. THey program compiles and runs, everything works well when requesting real time Level 1 data. However, when I request Tick History using RequestTickHistory, the call does not cause a runtime error, but the event handlers associated with this call ( TickProgress or TickCompleted ) do not fire.

In this example I am using the IQFEED_DEMO application name. I have tried replacing with my own credentials and the symptoms are the same.

I have been able to see that the connection is registered by the IQConnect Manager. I am appending the frmMain.cs contents of my project. Any help on this issue will be greatly appreciated.

Regards,

Nelson Andara

// Sample application to request level1 and History via COM
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using DTNHISTORYLOOKUPLib;

namespace CSharpLevel1Com
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class frmMain : System.Windows.Forms.Form
{
string strSymbol = "";
private bool reporting_history = false;
private System.Windows.Forms.Label lblSymbol;
private System.Windows.Forms.TextBox txtSymbol;
private System.Windows.Forms.Button cmdGetData;
private System.Windows.Forms.ListBox lstData;
private AxIQFEEDYLib.AxIQFeedY axIQFeedY1;
private HistoryLookupClass m_HistoryLookupClass;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;

public frmMain()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//

this.m_HistoryLookupClass = new HistoryLookupClass();
this.m_HistoryLookupClass.MinuteCompleted += new _IHistoryLookupEvents_MinuteCompletedEventHandler(m_HistoryLookupClass_MinuteCompleted);
this.m_HistoryLookupClass.TickCompleted += new _IHistoryLookupEvents_TickCompletedEventHandler(m_HistoryLookupClass_TickCompleted);
this.m_HistoryLookupClass.TickProgress += new _IHistoryLookupEvents_TickProgressEventHandler(m_HistoryLookupClass_TickProgress);
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}

this.axIQFeedY1.RemoveClientApp();
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmMain));
this.lblSymbol = new System.Windows.Forms.Label();
this.txtSymbol = new System.Windows.Forms.TextBox();
this.cmdGetData = new System.Windows.Forms.Button();
this.lstData = new System.Windows.Forms.ListBox();
this.axIQFeedY1 = new AxIQFEEDYLib.AxIQFeedY();
((System.ComponentModel.ISupportInitialize)(this.axIQFeedY1)).BeginInit();
this.SuspendLayout();
//
// lblSymbol
//
this.lblSymbol.Location = new System.Drawing.Point(8, 8);
this.lblSymbol.Name = "lblSymbol";
this.lblSymbol.Size = new System.Drawing.Size(48, 16);
this.lblSymbol.TabIndex = 0;
this.lblSymbol.Text = "Symbol: ";
//
// txtSymbol
//
this.txtSymbol.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.txtSymbol.Location = new System.Drawing.Point(72, 8);
this.txtSymbol.Name = "txtSymbol";
this.txtSymbol.Size = new System.Drawing.Size(136, 20);
this.txtSymbol.TabIndex = 1;
this.txtSymbol.Text = "TXTSYMBOL";
//
// cmdGetData
//
this.cmdGetData.Location = new System.Drawing.Point(216, 8);
this.cmdGetData.Name = "cmdGetData";
this.cmdGetData.Size = new System.Drawing.Size(88, 24);
this.cmdGetData.TabIndex = 2;
this.cmdGetData.Text = "&Get Data";
this.cmdGetData.Click += new System.EventHandler(this.cmdGetData_Click);
//
// lstData
//
this.lstData.HorizontalScrollbar = true;
this.lstData.Location = new System.Drawing.Point(8, 40);
this.lstData.Name = "lstData";
this.lstData.Size = new System.Drawing.Size(656, 316);
this.lstData.TabIndex = 3;
//
// axIQFeedY1
//
this.axIQFeedY1.Enabled = true;
this.axIQFeedY1.Location = new System.Drawing.Point(408, 16);
this.axIQFeedY1.Name = "axIQFeedY1";
this.axIQFeedY1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axIQFeedY1.OcxState")));
this.axIQFeedY1.Size = new System.Drawing.Size(100, 50);
this.axIQFeedY1.TabIndex = 4;
this.axIQFeedY1.Visible = false;
this.axIQFeedY1.SystemMessage += new AxIQFEEDYLib._DIQFeedYEvents_SystemMessageEventHandler(this.IQFeed_SystemMessage);
this.axIQFeedY1.SummaryMessage += new AxIQFEEDYLib._DIQFeedYEvents_SummaryMessageEventHandler(this.IQFeed_SummaryMessage);
this.axIQFeedY1.FundamentalMessage += new AxIQFEEDYLib._DIQFeedYEvents_FundamentalMessageEventHandler(this.IQFeed_FundamentalMessage);
this.axIQFeedY1.TimeStampMessage += new AxIQFEEDYLib._DIQFeedYEvents_TimeStampMessageEventHandler(this.IQFeed_TimeStampMessage);
this.axIQFeedY1.QuoteMessage += new AxIQFEEDYLib._DIQFeedYEvents_QuoteMessageEventHandler(this.IQFeed_QuoteMessage);

//
// frmMain
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(672, 364);
this.Controls.Add(this.axIQFeedY1);
this.Controls.Add(this.lstData);
this.Controls.Add(this.cmdGetData);
this.Controls.Add(this.txtSymbol);
this.Controls.Add(this.lblSymbol);
this.MaximizeBox = false;
this.Name = "frmMain";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "frmMain";
this.Load += new System.EventHandler(this.frmMain_Load);
((System.ComponentModel.ISupportInitialize)(this.axIQFeedY1)).EndInit();
this.ResumeLayout(false);

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new frmMain());
}

//Form load handler, register client app here
private void frmMain_Load(object sender, System.EventArgs e)
{
this.Text = "CSharp Level1 COM";
this.txtSymbol.Text = "";
this.txtSymbol.Enabled = false;

string strName = "IQFEED_DEMO";
string strVersion = "1.0";
string strKey = "1.0";

this.axIQFeedY1.RegisterClientApp( ref strName, ref strVersion, ref strKey );
}

//Watch symbol when the get data button is clicked
private void cmdGetData_Click(object sender, System.EventArgs e)
{
string strSymbol = txtSymbol.Text.Trim();
if( strSymbol != "" )
{
axIQFeedY1.WatchSymbol( ref strSymbol );
}
}

//Received fundamental message, add to list box
private void IQFeed_FundamentalMessage(object sender, AxIQFEEDYLib._DIQFeedYEvents_FundamentalMessageEvent e)
{
string strData = e.strFundamentalData;
lstData.Items.Insert(0,strData);
}

//Received summary message, add to list box
private void IQFeed_SummaryMessage(object sender, AxIQFEEDYLib._DIQFeedYEvents_SummaryMessageEvent e)
{
string strData = e.strSummaryData;
lstData.Items.Insert(0,strData);
}

//Received quote message, add to list box
private void IQFeed_QuoteMessage(object sender, AxIQFEEDYLib._DIQFeedYEvents_QuoteMessageEvent e)
{
string strData = e.strQuoteData;
lstData.Items.Insert(0,strData);
}

// First Time you receive the System message indicates you are connected.
private void IQFeed_SystemMessage(object sender,AxIQFEEDYLib._DIQFeedYEvents_SystemMessageEvent e)
{
string strData = e.strSystemData ;
txtSymbol.Enabled = true;
lstData.Items.Insert(0,strData);
}

//Received Time Stamp message, add to list box, request history
private void IQFeed_TimeStampMessage( object sender, AxIQFEEDYLib._DIQFeedYEvents_TimeStampMessageEvent e)
{
string strData = e.strTimeStampData;
lstData.Items.Add(strData);
strSymbol = txtSymbol.Text.Trim();
if ( strSymbol != "" )
{
this.m_HistoryLookupClass.RequestTickHistory(strSymbol,1);
}
Console.Write(" TImeStampMessage Received\n");
}
private void m_HistoryLookupClass_TickProgress( int iTicksReceived)
{
Console.Write( "{0} ticks received ",iTicksReceived);
}
private void m_HistoryLookupClass_TickCompleted( int iTicksReceived,
object Time,
object Ask,
object Bid,
object Volume,
object TradePrice,
object TradeSize)
{
if(!reporting_history)
{
reporting_history = true;
DateTime[] m_TimeArray = (DateTime[]) Time;
double[] m_AskArray = (double[]) Ask;
double[] m_BidArray = (double[]) Bid;
int[] m_VolumeArray = (int[]) Volume;
double[] m_TradePriceArray = (double[]) TradePrice;
int[] m_TradeSizeArray = (int[]) TradeSize;

for (long i = iTicksReceived; i>0; i--)
{
Console.Write("Time: {0}, ", m_TimeArray.GetValue(i));
Console.Write("Ask: {0,8:F}, ",m_AskArray.GetValue(i));
Console.Write("Bid: {0,8:F}, ",m_BidArray.GetValue(i));
Console.Write("Volume:{0,6}, ", m_VolumeArray.GetValue(i));
Console.Write("Trade Price: {0,8:F}, ",m_TradePriceArray.GetValue(i));
Console.Write("Trade Size: {0,6}, ",m_TradeSizeArray.GetValue(i));
}
}
Console.Write("TickCompleted executed\n");
}

private void m_HistoryLookupClass_MinuteCompleted( int lMinutesLoaded,
object Time,
object Open,
object Close,
object High,
object Low,
object Volume,
object IntVolume)
{
if (!reporting_history)
{
reporting_history = true;

DateTime[] m_TimeArray = (DateTime[]) Time;
double[] m_OpenArray = (double[]) Open;
double[] m_CloseArray = (double[]) Close;
double[] m_HighArray = (double[]) High;
double[] m_LowArray = (double[]) Low;
int[] m_VolumeArray = (int[]) Volume;
int[] m_IntVolumeArray = (int[]) IntVolume;

for(long i = lMinutesLoaded; i> 0; i--)
{
Console.Write("Time: {0}, ", m_TimeArray.GetValue(i));
Console.Write("Open: {0,8:F}, ",m_OpenArray.GetValue(i));
Console.Write("Close: {0,8:F}, ",m_CloseArray.GetValue(i));
Console.Write("High: {0,8:F}, ",m_HighArray.GetValue(i));
Console.Write("Low: {0,8:F}, ",m_LowArray.GetValue(i));
Console.Write("Volume:{0,6}, ", m_VolumeArray.GetValue(i));
Console.Write("IntVolume:{0,6}, ",m_IntVolumeArray.GetValue(i));
}
}
}
}
}

Nelson Andara
nelsonandara@comcast.net

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


Posted: Aug 21, 2006 09:51 AM          Msg. 2 of 6
Hello Nelson,

Briefly scanning through this I do not see what is causing the issue. I have sent you a PM with the developer support email address, please email me a copy of your project so that we can start from the same code base (including project settings) while working on this issue.

nelsonandara
-Interested User-
Posts: 3
Joined: Aug 21, 2006


Posted: Aug 21, 2006 10:59 AM          Msg. 3 of 6
Hi Steve, thanks for your quick response. I noticed that the application started receiving History data as soon as the market opened. Are there scheduled times when port 9100 is down?

I will move forward with my implementation in terms of better multithreading and front end.

I look forward to more information on the availability of port 9100 for historic data feeds.

Regards,

Nelson

Nelson Andara
nelsonandara@comcast.net

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


Posted: Aug 21, 2006 11:12 AM          Msg. 4 of 6
Historical data isnt restricted to market hours.

I suspect that the issue is more along the lines of what you were requesting. History requests work on calander days (not market days). What this means is if you requested 1 day of Tick data anytime between 12:00am (midnight) on friday night through market open today, you would not have gotten any results.

So in order to recieve friday's tick data today, you would need to request 4 days of tick history.

the same concepts apply to all other history requests

jfcantin
-Interested User-
Posts: 20
Joined: May 18, 2004


Posted: Aug 21, 2006 03:19 PM          Msg. 5 of 6
Receiving History error messages doesn't seem to work. If you register with the AbortedLoad event like this :
m_HistoryLookup.AbortedLoad += new _IHistoryLookupEvents_AbortedLoadEventHandler(OnAbortedLoad)

You get an exception. If you don't register it then you can't tell if you gave a wrong symbol.

Anybody got a workaround?

best,

Jean-Francois

nelsonandara
-Interested User-
Posts: 3
Joined: Aug 21, 2006


Posted: Aug 22, 2006 04:29 PM          Msg. 6 of 6
Hi Jean Francois,

I noticed that when receiving History messages, if you have anymore than one event registered at a time, you get an exception that apparently comes from COM, not the C# code. I would also like to have the abillity to register more than one event ( at least TickProgress and TickCompleted ) at the same time.

If anyone knows about a way to accomplish this in .NET, please share.

Nelson Andara
nelsonandara@comcast.net
 

 

Time: Mon May 16, 2022 12:31 AM CFBB v1.2.0 16 ms.
© AderSoftware 2002-2003