Hello Askrali, I have answers for your questions:
Quote: what time stamp should be used?
Most recent time or time stamp in T messages?
The "T" messages are provided by the IQFeed server. The timestamps messages within each tick are provided by the change, and they reflect the time the tick actually happened. For example:
T,20210825 10:49:43
Q,MSFT,301.7400,10,10:49:42.839858,19,5676548,301.7400,300,301.7600,200,304.3000,304.5900,301.1200,302.6200,ba,87,
Q,MSFT,301.7400,10,10:49:42.839858,19,5676548,301.7400,300,301.7600,100,304.3000,304.5900,301.1200,302.6200,ba,87,
These ticks occurred at 10:49:42.839858, but were not sent out as API messages until after the local server time was 10:49:43. Ticks take some time to travel through the internet, and the synchronization may not be exact.
You probably want to use the timestamps in the tick messages, because these reflect the actual time the tick occurred.
Quote: To form 5 min candles from update message
By the way, yhe IQFeed API has a command that will build 5-minute intervals for you. You can connect to port 9400 and send a command like:
BW,TSLA,300,20210825 090000
300 is the number of seconds in the bar, so 5 minutes. This will give you historical bars as far back as you specify, and will built live ones for you. The response will be like:
BH,TSLA,2021-08-25 09:05:00,706.9800,707.2000,706.9800,707.2000,75526,1792,0,
BH,TSLA,2021-08-25 09:10:00,707.0100,707.5000,707.0100,707.0500,78801,1480,0,
BH,TSLA,2021-08-25 09:15:00,707.1500,707.5100,707.1500,707.2500,83120,2551,0,
...etc...
BC,TSLA,2021-08-25 11:25:00,709.8100,710.3944,709.2500,709.9600,5425296,41704,,
BC,TSLA,2021-08-25 11:30:00,709.9900,710.7500,709.7500,710.5000,5487078,38044,,
"BH" means the message was built from historical data, while "BC" means the message was built from live data. "BU" means a past bar has been updated.
Quote: To create the timeframes, would it be good to use local time in EST time-zone?
All IQFeed timestamps for all exchanges use the US Eastern time zone. This includes exchanges that are not based in that time zone.
Quote: But there are fields “Last” and “Most Recent Trade” for price.
Which one can be used as a close price?
The difference between the "Last" and "Most Recent Trade" fields is this: "Last" includes only "last-eligible" trades. This means trades for more than 100 units. Such trades are allowed to set a high, low, open, or close.
"Most Recent" includes non-eligible trades. They may be for less than 100 units. Such trades cannot set an official high, low, open, or close. If the current High is $8.00 and I buy 99 units for $8.01, the High does not change to $8.01.
You can whichever of the two you want, just understand the difference. If your close price you calculate must match the offical close price, then use Last. If you want to calculate your own close price, and you want it to include all trades, use Most Recent. By the way, these are two different fields in Level 1 and you can watch both of them.
Sincerely,
Gary Stephen
DTN IQFeed Implementation Support SpecialistEdited by DTN_Gary_Stephen on Aug 25, 2021 at 04:43 PM