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 am keeping IQFeed, much better reliabilty than *******. I may refer a few other people in the office to switch as well." - Comment from Don
"I use IQ Feed, Great stuff as far as data analysis information, storage and retrieval is concerned." - Comment from Public Forum
"Very impressed with the quality of your feed - ******* is a real donkey in comparison." - Comment from A.C. via Email
"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
"Can I get another account from you? I am tired of ******* going down so often" - Comment from George
"As a past ******* customer(and not a happy one), IQ Feed by DTN is a much better and cheaper product with great customer support. I have had no problems at all since switching over." - Comment from Public Forum
"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.
"This is an excellent value, the system is generous (allowing for 500 stocks) and stable (and really is tick-by-tick), and the support is fantastic." - Comment from Shirin via Email
"I've been using IQFeed 4 in a multi-threaded situation for the last week or two on 2600 symbols or so with 100 simultaneous daily charts, and I have had 100% responsiveness." - Comment from Scott
"Everything is working great with the API. I love it." - Comment from Calvin
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 »Time Stamp Data Type Formatting
Author Topic: Time Stamp Data Type Formatting (4 messages, Page 1 of 1)

Seventy77seven
-Interested User-
Posts: 2
Joined: Apr 29, 2020

Named must your fear be before banish it you can.


Posted: Apr 29, 2020 11:11 AM          Msg. 1 of 4
Hi,

I am attempting to configure my API code to pull Futures Market data daily and process. I am using python to connect and insert data into a Postgres table. The problem I am having is that when the data (minute bars) is pulled using this code, the timestamp is formatted as a large number (maybe integer) that appears to be a count of microseconds. This is strange because when I hand pulled the same data from IQfeed and downloaded a csv file the timestamp was formatted correctly with yy/mm/dd/hh/min/sec. Do you have any clues for me to get this format passed correctly in to a Postgres table? Coding is not my greatest strength so any help would be appreciated.

Thanks Mike

Mike

DTN_Gary_Stephen
-DTN Guru-
Posts: 396
Joined: Jul 3, 2019


Posted: Apr 30, 2020 02:10 PM          Msg. 2 of 4
Mike,

Exactly what command are you sending to the API? No "minute bars" command should be giving you milliseconds, whether it's a history command like HIT, or a BW derivative data command. A tick request could, though, depending upon protocol. Are you specifying a protocol? If so, which one? Let me know the answers to these two questions., and I can give a more specific answer.

Sincerely,
Gary Stephen
DTN IQFeed Implementation Support Specialist

Seventy77seven
-Interested User-
Posts: 2
Joined: Apr 29, 2020

Named must your fear be before banish it you can.


Posted: May 5, 2020 10:50 AM          Msg. 3 of 4
Thanks for the reply. Reading the API documentation says that there are three requests, namely "t" for tick "s" for second and maybe "D?" This led me to believe that the appropriate minute bar request is a 60 second request. This is the code....

get_historical_bar_data(symbol=val[0],
bar_len=60,
bar_unit='s',
num_bars=100)

I am not sure how to answer your "protocol," question. I am working with python and postgres to pull and process the data.

Mike

DTN_Gary_Stephen
-DTN Guru-
Posts: 396
Joined: Jul 3, 2019


Posted: May 5, 2020 02:40 PM          Msg. 4 of 4
Mike,

First of all, let's talk about the protocol, because that's important to understand. When connecting to the API, you send an S,SET PROTOCOL command to indicate which version of the syntax you want to use. It's a backwards compatibility feature; whenever DTN upgrades the API, it does so in a new protocol number, so existing code may continue to specify the old protocol until they have fully upgraded to it. The most recent protocol is 6.1, so this is the version you should be requesting, by sending S,SET PROTOCOL 6.1 when you initially connect. See http://www.iqfeed.net/dev/api/docs/IQFeedProtocols.cfm for more details.

There are three interval history commands:

HIX - requests a number of intervals
HID - requests all intervals over a range of days
HIT - requests all intervals over a specified date-time range

Based on the presence of num_bars=100, I suspect it is an HIX request. What actually gets sent to the API is:

HIX,[Symbol],60,100

Which return data in the following format:

2020-05-05 15:11:00,300.9800,300.8000,300.8200,300.9100,27132732,35293,0,
2020-05-05 15:10:00,300.9200,300.7600,300.9050,300.8100,27089316,41483,0,
2020-05-05 15:09:00,300.9600,300.8800,300.9122,300.9047,27038363,37991,0,

Getting back to your original question: the date/time already appears to be in the date format Postgres takes. I'm not familiar with Postgres but you may need to convert it to timestamp form to store it:

https://www.postgresqltutorial.com/postgresql-to_timestamp/

Quote: SELECT TO_TIMESTAMP('2017-03-31 9:30:20','YYYY-MM-DD HH:MI:SS');


Sincerely,
Gary Stephen
DTN IQFeed Implementation Support Specialist
 

 

Time: Wed May 8, 2024 7:14 PM CFBB v1.2.0 9 ms.
© AderSoftware 2002-2003