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 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
"Everything is working great ! Very impressive client. The news refreshes better and is more pertinent than the ******* feed I paid $ 100/month for. I Also like the charts a lot." - Comment from Leon
"Very impressed with the quality of your feed - ******* is a real donkey in comparison." - Comment from A.C. via Email
"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
"I am very happy I changed. I love the product, but more so I am thrilled with Tech Support. You are knowledgeable, polite, pleasant and professional." - Comment from Pat
"It’s so nice to be working with real professionals!" - Comment from Len
"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
"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 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
"I "bracket trade" all major news releases and I have not found one lag or glitch with DTN.IQ feed. I am very comfortable with their feed under all typical news conditions (Fed releases, employment numbers, etc)." - Comment from 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 »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: Fri April 26, 2024 11:45 PM CFBB v1.2.0 14 ms.
© AderSoftware 2002-2003