Closed rlmomin closed 1 year ago
Hello,
You should try to call reqContractDetails
first, then call reqMktData
with the resulting contract.
Let us know if it works
update:
It should work. You can use the tools provided with @stoqey/ib
for testing:
$ node dist/tools/market-data-single.js -exchange=SMART -sectype=OPT -symbol=NVDA -strike=440 -right=C -expiry=20230714 -currency=USD
[
[
"BID",
20
],
[
"ASK",
20.4
],
[
"ASK_SIZE",
2
],
[
"CLOSE",
20
],
[
"VOLUME",
0
],
[
"HALTED",
0
],
[
"OPTION_UNDERLYING",
-0.0018178963390447223
],
[
"OPTION_PV_DIVIDEND",
19.83422084923495
],
[
"MODEL_OPTION_IV",
0
],
[
"MODEL_OPTION_DELTA",
0.47002934324188445
],
[
"MODEL_OPTION_PRICE",
0.9990212950442374
],
[
"MODEL_OPTION_GAMMA",
0
],
[
"MODEL_OPTION_VEGA",
0.0004969152024156143
],
[
"MODEL_OPTION_THETA",
0.00043033430717898113
]
]
I can see the following differences:
use of lastTradeDateOrContractMonth
not expiry
multiplier
is not provided
I have a market data subscription for equities and options. If I submit a reqMktData for an options contract, I keep getting an error message
"Error validating request.-'b1' : cause - When the local symbol field is empty, please fill the following fields (right, strike, expiry) - code: 321 - reqId: 1".
Sending a market data request for stocks works fine but its only with options where I get an error: Below is my request:
let contract = new Option('NVDA', '20230713', 440, OptionType.Call);
Once I received the 'connected' event, I send the following:
ib.reqMarketDataType(4);
ib.reqMktData(1, contract, "", false, false, [])
Prior to sending the mktdata request, I console logged the contract detail to confirm I have the fields filled out
Option {
symbol: 'NVDA',
expiry: '20230713',
strike: 440,
right: 'C',
exchange: 'SMART',
currency: 'USD',
secType: 'OPT',
multiplier: 100
}`Any help or guidance would be appreciated.