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)




"If you want customer service that answers the phone, your best bet is IQFeed. I cannot stop praising them or their technical support. They are always there for you, and they are quick. I have used ****** too but the best value is IQFeed." - Comment from Public Forum
"I was on the phone with a friend who uses CQG and right after the Fed announcement, CQG was as much as 30 seconds behind DTN.IQ. Some quotes were off by as much as 15-18 cents. Your feed never missed a beat." - Comment from Roger
"Thank God for your Data Feed as the only Zippers I see are on my pants (LOL), and no more 200 pip spikes to mess up charts." - Comment from Spiro via Email
"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
"You are much better than lawyers or the phone company because you answer the phone when I call! I just love your customer service." - Comment from Isreal
"I cannot believe what a difference it makes trading with ProphetX!" - Comment from Bruce in Los Angeles
"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
"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 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
"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
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: Sat May 4, 2024 10:49 PM CFBB v1.2.0 12 ms.
© AderSoftware 2002-2003