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)




"Very impressed with the quality of your feed - ******* is a real donkey in comparison." - Comment from A.C. via Email
"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 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
"I would just like to say that IQFeed version 4 is running very well and I am very happy with its performance. I would also like to extend a big thanks for the fast and efficient help that I always receive. My questions and concerns are always addressed promptly. Way to go!" - Comment from Josh in CO.
"There is no doubt that IQFeed is the best data provider. I am very satisfied with your services. And IQFeed is the only one that I would recommend to my friends. Now, most of them are using your product in China." - Comment from Zhezhe
"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
"Everything is working amazing now. I'm already impressed with the true-tick feed of IQFeed and it's ability to support my 480 symbol layout." - Comment from Tyler via Email
"I am enjoying the feed very much - so superior to the broker provided feed I was previously using." - Comment from George
"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
"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
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: Mon May 6, 2024 10:22 PM CFBB v1.2.0 14 ms.
© AderSoftware 2002-2003