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 »A complete example to get historical data using TCP/IP
Author Topic: A complete example to get historical data using TCP/IP (3 messages, Page 1 of 1)

gautham
-Interested User-
Posts: 6
Joined: Sep 22, 2004


Posted: Nov 9, 2004 10:45 AM          Msg. 1 of 3
I am having problem downloading historical data using TCP/IP in Visual C++.
I do not see any example of this in the sample files I got from IQFEED.
I need a complete but simple example showing me how exactly to go about doing this
in a console application.

DTN_Natalie_H
-DTN Evangelist-
Posts: 175
Joined: May 10, 2004

DTN Market Access, LLC.


Posted: Nov 9, 2004 02:28 PM          Msg. 2 of 3
You're correct, we currently do not have a C++ example app for getting history data via sockets. For now you could look at the VB app, or maybe another developer has something they could give you. We are working to build a more comphrehensive suite of example apps. Thanks for your patience!

Natalie Hannan DTN Market Access, LLC.

gautham
-Interested User-
Posts: 6
Joined: Sep 22, 2004


Posted: Nov 9, 2004 04:12 PM          Msg. 3 of 3
I found out that it is pretty simple. I was not able to get historical data before because after using registerclientapp function I was using the statement
SOCKET iqSocket;
struct sockaddr_in addr;
addr.sin_family = AF_INET;
addr.sin_port = htons( 9100 );
addr.sin_addr.S_un.S_addr = inet_addr("127.0.0.1");
memset(&addr.sin_zero, 0, sizeof(addr.sin_zero));

connect( iqSocket(struct sockaddr*)&addr,sizeof(addr))
// connect to the server
send( iqSocket,"S,KEY\r\n", 7, 0); // Should NOT be using this statement.

and then doing
char iqCommand[ 15 ];
memset( iqCommand, 0, sizeof( iqCommand ) );
strcpy( iqCommand, "HD,IBM,5;" );

send( iqSocket, iqCommand, static_cast<int>( strlen( iqCommand ) ), 0 );
The statement
send( iqSocket,"S,KEY\r\n", 7, 0);
seems to have somehow not get the historical data. After removing this statement I do get historical data.
 

 

Time: Sun July 6, 2025 4:39 PM CFBB v1.2.0 13 ms.
© AderSoftware 2002-2003