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)




"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
"If you are serious about your trading I would not rely on IB data for serious daytrading. Took me a while to justify the cost of IQ Feed and in the end, it's just a 2 point stop on ES. Better safe than sorry" - Comment from Public Forum
"My broker in Davenport suggested I give you a try as he uses your service and says its the best." - Comment from Bill via RT Chat
"I like you guys better than *******...much more stable and a whole lot fewer issues." - Comment from Philip
"Very impressed with the quality of your feed - ******* is a real donkey in comparison." - Comment from A.C. via Email
"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
"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
"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
"Everything is working amazing now. I'm already impressed with the true-tick feed of IQFeed and it's ability to support my 480 symbol layout." - Comment from Tyler via Email
"I'm very glad I switched to IQFeed. It's working perfectly with no lag, even during fast market conditions." - Comment from Andy via Email
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: 394
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: 394
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: Tue April 23, 2024 5:44 AM CFBB v1.2.0 8 ms.
© AderSoftware 2002-2003