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 used to have *******, but they are way more money for the same thing. I have had no probs with data from DTN since switching over." - Comment from Public Forum Post
"I just wanted to let you know how fast and easy I found it to integrate IQFeed into our existing Java code using your JNI client. In my experience, such things almost never go so smoothly - great job!" - Comment from Nate
"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
"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.
"You are either overstaffed or people just don't have problems with your feed because customer support always answers the phone quickly." - Comment from Jay via Email
"I just wanted to tell you what a fine job you have been doing. While *******, from what I hear, has been down and out, off and on, IQ feed has held like a champ this week." - Comment from Shirin
"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
"Everything is working great with the API. I love it." - Comment from Calvin
"Thank you so much - awesome feed, awesome service!" - Comment from Greg via Email
"I am enjoying the feed very much - so superior to the broker provided feed I was previously using." - Comment from George
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: Thu May 2, 2024 4:22 PM CFBB v1.2.0 13 ms.
© AderSoftware 2002-2003