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)




"It’s so nice to be working with real professionals!" - Comment from Len
"Its working FABULOUSLY for me!! Holy cow...there has been so much I've been missing lately, and with this feed and Linnsoft software...I'm in the game now." - Comment from Chris R.
"I'm satisfied with IQFeed. It's the most reliable and fastest quote feed I have ever used. Although I'm a resident in China, it's still very fast!" - Comment from Xiaofei
"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
"You have an excellent feed. Very few spikes for Spot Forex." - Comment from Public Forum Post
"IQ feed works very well, does not have all of the normal interruptions I have grown used to on *******" - Comment from Mark
"The people at Nirvana have very nice things to say about your company and I can see why! Price and service is a potent combination." - Comment from Ed
"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
"Awesome response, as usual. It is a sincere and refreshing pleasure to do business with DTN, compared to your competition." - Comment from Ryan
"I was on the phone with a friend who uses CQG and right after the Fed announcement, CQG was as much as 30 seconds behind DTN.IQ. Some quotes were off by as much as 15-18 cents. Your feed never missed a beat." - Comment from Roger
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 »Simple C# Example, Anyone?
Author Topic: Simple C# Example, Anyone? (5 messages, Page 1 of 1)

squirlhntr
-Interested User-
Posts: 62
Joined: Feb 12, 2005


Posted: Mar 29, 2008 04:58 PM          Msg. 1 of 5
Does anyone have an extremely simple example for how to start up IQFeed via C# in Studio (.NET 3.0), preferably a console app?

The reason I ask is that, while I have used IQFeed extensively via Python, I am completely unfamiliar with C#, Visual Studio, or COM. I'm currently trying to learn all 3 today and banging my head against the whole situation as I am so unfamiliar with the 3 that I'm having trouble focusing on the exact path to debugging my issue.

Any help would be appreciated. Until then I'm going to rip apart the DTN example (which, to frustrate things more, is blowing up in 2008/Vista).

I feel like an idiot because my professional programming experience tells me I am missing something extremely basic.




FYI I have references to AxInterop.IQFEEDYLib, IQ_APILib, System.Windows.Forms, and IQFEEDYLib. Code is as follows, with the error occuring at
this.IQFeed = new AxIQFEEDYLib.AxIQFeedY();





using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace IQTest
{
class Program
{
private AxIQFEEDYLib.AxIQFeedY IQFeed;

[STAThread]
static void Main(string[] args)
{
Program i = new Program();
i.InitIQFeed();

}

private void InitIQFeed()
{
this.IQFeed = new AxIQFEEDYLib.AxIQFeedY();
string iqName = "IQ_TEST";
string iqVersion = "0.1";
string iqKey = "0.1";

this.IQFeed.RegisterClientApp(ref iqName, ref iqKey, ref iqVersion);
}
}
}

ropester
-Interested User-
Posts: 10
Joined: Feb 24, 2008


Posted: Mar 30, 2008 11:35 AM          Msg. 2 of 5
I have references to AxIQFEEDYLib IQ_APILib, IQFEEDYLib, DTNHISTORYLOOKUPLIb, DTNNEWSLOOKUPLib etc..

I pulled most of it from the C# example they provided, I'm not doing a console app but..

In my form class i have

static public AxIQFEEDYLib.AxIQFeedY IQFeed;

In InitializeComponent i have..

IQFeed = new AxIQFEEDYLib.AxIQFeedY();

((System.ComponentModel.ISupportInitialize)(IQFeed)).BeginInit();
IQFeed.Enabled = true;
IQFeed.Location = new System.Drawing.Point(486, 8);
IQFeed.Name = "IQFeed";
IQFeed.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("IQFeed.OcxState")));
IQFeed.Size = new System.Drawing.Size(100, 24);
IQFeed.TabIndex = 4;
IQFeed.Visible = false;
((System.ComponentModel.ISupportInitialize)(IQFeed)).EndInit();

All the other form setup is in the code. I've not tried decoupling the object from the form yet..

Hope that helps..

S

squirlhntr
-Interested User-
Posts: 62
Joined: Feb 12, 2005


Posted: Mar 30, 2008 04:36 PM          Msg. 3 of 5
I came up with a working version using DllImport; this is actually pretty close to how I used to do it in Python via ctypes. This console app is as simple as it gets (no callbacks, etc).

Since I am using DllImport I removed all the references I had made.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace IQTest
{
class Program
{
[DllImport("IQ32.dll")]
private static extern int RegisterClientApp(int hClient, string sProductName, string sProductKey, string sProductVersion);

[STAThread]
static void Main(string[] args)
{
Program i = new Program();
i.InitIQFeed();
}

private void InitIQFeed()
{
string iqName = "IQ_TEST";
string iqVersion = "0.1";
string iqKey = "0.1";

RegisterClientApp(10, iqName, iqVersion, iqKey);
}
}
}

squirlhntr
-Interested User-
Posts: 62
Joined: Feb 12, 2005


Posted: Mar 30, 2008 04:38 PM          Msg. 4 of 5
Of course now it looks like I have to start IQFeed via another program that is 32bit and connect via sockets from a 64bit app if I want 64 bit... grrrrrrr....

freemind
-Interested User-
Posts: 7
Joined: Jun 27, 2017


Posted: Jun 1, 2018 03:02 PM          Msg. 5 of 5
Hello squirlhntr,

you could check out my project.... https://github.com/mathpaquette/IQFeed.CSharpApiClient
I handle almost all features from the IQFeed Api in native c# code....

Thank you.
 

 

Time: Tue April 23, 2024 5:21 AM CFBB v1.2.0 8 ms.
© AderSoftware 2002-2003