Skip to main content
Reply to update
Source Link

The function reqHistoricalData has an argument useRTH ("use regular trading hours"). Set useRTH = "0" to get data outside those hours.

This can only work for the futures, not for the index, which is only computed during normal trading hours.

library("IBrokers")
tws <- twsConnect()

contract <- twsContract(local = "ESH9",
                        sectype = "FUT",
                        exch = "GLOBEX",
                        currency = "USD",
                        include_expired = "1",
                        conId = "", symbol = "", primary = "", 
                        expiry = "", strike = "", right = "",
                        multiplier = "", combo_legs_desc = "",
                        comboleg = "", secIdType = "", secId = "")

reqHistoricalData(tws,
                  contract,
                  barSize = "15 mins",
                  duration = "1 M",
                  useRTH = "0")

The function reqHistoricalData has an argument useRTH ("use regular trading hours"). Set useRTH = "0" to get data outside those hours.

The function reqHistoricalData has an argument useRTH ("use regular trading hours"). Set useRTH = "0" to get data outside those hours.

This can only work for the futures, not for the index, which is only computed during normal trading hours.

library("IBrokers")
tws <- twsConnect()

contract <- twsContract(local = "ESH9",
                        sectype = "FUT",
                        exch = "GLOBEX",
                        currency = "USD",
                        include_expired = "1",
                        conId = "", symbol = "", primary = "", 
                        expiry = "", strike = "", right = "",
                        multiplier = "", combo_legs_desc = "",
                        comboleg = "", secIdType = "", secId = "")

reqHistoricalData(tws,
                  contract,
                  barSize = "15 mins",
                  duration = "1 M",
                  useRTH = "0")
Source Link

The function reqHistoricalData has an argument useRTH ("use regular trading hours"). Set useRTH = "0" to get data outside those hours.