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 noticed that ******* quotes locked up shortly after the interest rate announcement yesterday while yours stayed stable." - Comment from Ron in Utah
"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 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
"Thanks for all of your help. Great customer service deserves to be recognized which one the reasons I've been a customer of DTN for over 10 years!" - Comment from Stuart
"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'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'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 "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
"DTN has never given me problems. It is incredibly stable. In fact I've occasionally lost the data feed from Interactive Brokers, but still been able to trade because I'm getting good data from DTN." - Comment from Leighton
"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
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: Wed April 24, 2024 10:39 PM CFBB v1.2.0 8 ms.
© AderSoftware 2002-2003