After hours data - Interactive Brokers

After hours data - Interactive Brokers

Manage alerts

Loading saved threads...

Viðar Ingason · External communityPost link
External question — Quantitative Finance Stack Exchange Author: Viðar Ingason Original post: https://quant.stackexchange.com/questions/44011 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. I just started using Interactive Brokers because of their API. I'm using the IBrokers package in R. I've managed to get data for S&P 500 and other indices but now I want data for S&P 500 after hours. Investing.com shows data for S&P 500 after hours (S&P 500 futures). How can I get this data by using Interactive brokers API? Update I just tried this without success. I only get data for regular trading hours. spx = reqHistoricalData(tws2, twsIndex(symbol = "SPX", exch = "CBOE"), barSize = "15 mins", duration = "1 M", useRTH = "0") Am I doing something wrong?
Quote
Report
Enrico Schumann · External communityPost link
External answer — Quantitative Finance Stack Exchange Author: Enrico Schumann Original post: https://quant.stackexchange.com/a/44016 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. 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")
Quote
Report

Post Reply

Quoted from Forex.com.bd-Editorial External answer — Quantitative Finance Stack Exchange Author: Enrico Schumann Source score (net votes, not local likes): 4 Original post: https://quant.stackexchange.com/a/44016 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. 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")

Cancel quote

Checking account access…
After hours data - Interactive Brokers | Forex.com.bd