Yes, a time is required. What worked best for me is this:
- On the command line for my Historical Data Downloader, dates are specified as YYYYMMDD and interpreted in the instrument's time zone
- The tool uses reqContractDetails() to get the most current contract for the instrument and extracts the instrument's time zone from that contract
- It them advances end time to the next midnight (in the instruments timezone). For example, an end date of 20241112 becomes "20241113 00:00:00 US/Eastern" for stocks or NYC trades instruments, while it (automatically) becomes "20241113 00:00:00 US/Central" for any Chicago traded contract (and so on)
- IBKR often uses 23:59:59 the day of (e.g. one second before the next midnight) but actual midnight feels "cleaner", was less code, and has worked for me perfectly for years.
闯ü谤驳别苍
?
On Tue, Nov 12, 2024 at 03:37 PM, <supis31@...> wrote:
toggle quoted message
Show quoted text
I think I have to provide a time, otherwise I get an error:
Error 10314, reqId 13: End Date/Time: The date, time, or time-zone entered is invalid. The correct format is yyyymmdd hh:mm:ss xx/xxxx where yyyymmdd and xx/xxxx are optional. E.g.: 20031126 15:59:00 US/Eastern ?Note that there is a space between the date and time, and between the time and time-zone. ?If?
no date is specified, current date is assumed. If no time-zone is specified, local time-zone is assumed(deprecated). ?You can also provide yyyymmddd-hh:mm:ss time is in UTC. Note that there is a dash between the date and time in UTC notation., contract: Stock(symbol='SPY', exchange='SMART', primaryExchange='ARCA', currency='USD')