¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

error requesting option data


 

Can someone tell me why my request is getting an error? I'm trying to get historical data for a certain option contract. My request for contract details retrieves the data but my request for historical data doesn't...

Code:

contract = Contract()
contract.symbol = "goog"
contract.secType = "OPT"
contract.exchange = "SMART"
contract.currency = "USD"
contract.lastTradeDateOrContractMonth = "20201030"
contract.strike = 1180
contract.right = "C"
contract.multiplier = "100"

# goog
# intc
# intu
# isrg

app.reqContractDetails(1, contract)
# app.reqSecDefOptParams(1, "IBM", "", "STK", 8314)
app.reqHistoricalData(2, contract, "", "1 D", "1 min", "TRADES", 1, 1, False, [])

error: 
C:\Users\marka\AppData\Local\Continuum\anaconda3\python.exe "C:/Users/marka/PycharmProjects/TWS API/Keeping it simple(2).py"
1
Error: ?-1 ? 2106 ? HMDS data farm connection is OK:ushmds
contractDetails: ?1 ? 208813720 GOOG 444740018 C 20201030 1180.0
Error: ?2 ? 162 ? Historical Market Data Service error message:HMDS query returned no data: GOOG ?201030C01180000@SMART Trades


 

Did you tried these code with different req_id?


On Tue, Oct 27, 2020, 07:47 Mark Guglielmi <Markag1983@...> wrote:
Can someone tell me why my request is getting an error? I'm trying to get historical data for a certain option contract. My request for contract details retrieves the data but my request for historical data doesn't...

Code:

contract = Contract()
contract.symbol = "goog"
contract.secType = "OPT"
contract.exchange = "SMART"
contract.currency = "USD"
contract.lastTradeDateOrContractMonth = "20201030"
contract.strike = 1180
contract.right = "C"
contract.multiplier = "100"

# goog
# intc
# intu
# isrg

app.reqContractDetails(1, contract)
# app.reqSecDefOptParams(1, "IBM", "", "STK", 8314)
app.reqHistoricalData(2, contract, "", "1 D", "1 min", "TRADES", 1, 1, False, [])

error: 
C:\Users\marka\AppData\Local\Continuum\anaconda3\python.exe "C:/Users/marka/PycharmProjects/TWS API/Keeping it simple(2).py"
1
Error: ?-1 ? 2106 ? HMDS data farm connection is OK:ushmds
contractDetails: ?1 ? 208813720 GOOG 444740018 C 20201030 1180.0
Error: ?2 ? 162 ? Historical Market Data Service error message:HMDS query returned no data: GOOG ?201030C01180000@SMART Trades


 

¿ªÔÆÌåÓý

Yea. The mobile app doesn¡¯t have history available either. Maybe there isn¡¯t enough data for that particular contract. I was able to pull others...


On Oct 28, 2020, at 1:06 AM, AnerG corp <ahunatajanov@...> wrote:

?
Did you tried these code with different req_id?

On Tue, Oct 27, 2020, 07:47 Mark Guglielmi <Markag1983@...> wrote:
Can someone tell me why my request is getting an error? I'm trying to get historical data for a certain option contract. My request for contract details retrieves the data but my request for historical data doesn't...

Code:

contract = Contract()
contract.symbol = "goog"
contract.secType = "OPT"
contract.exchange = "SMART"
contract.currency = "USD"
contract.lastTradeDateOrContractMonth = "20201030"
contract.strike = 1180
contract.right = "C"
contract.multiplier = "100"

# goog
# intc
# intu
# isrg

app.reqContractDetails(1, contract)
# app.reqSecDefOptParams(1, "IBM", "", "STK", 8314)
app.reqHistoricalData(2, contract, "", "1 D", "1 min", "TRADES", 1, 1, False, [])

error: 
C:\Users\marka\AppData\Local\Continuum\anaconda3\python.exe "C:/Users/marka/PycharmProjects/TWS API/Keeping it simple(2).py"
1
Error: ?-1 ? 2106 ? HMDS data farm connection is OK:ushmds
contractDetails: ?1 ? 208813720 GOOG 444740018 C 20201030 1180.0
Error: ?2 ? 162 ? Historical Market Data Service error message:HMDS query returned no data: GOOG ?201030C01180000@SMART Trades