# fetch_sec_def_opt_params { #shinybroker.fetch_sec_def_opt_params }

`fetch_sec_def_opt_params(underlyingConId, underlyingSymbol, underlyingSecType, host='127.0.0.1', port=7497, client_id=9999, futFopExchange='', timeout=3)`

Creates a temporary IBKR client socket at the specified `host`, `port`, and
`client_id`, then makes a query for the security-defined option parameters
for the security defined by `underlyingConId`, `underlyingSymbol`,
`underlyingSecType`, and `futFopExchange`.

`fetch_sec_def_opt_params` will collect all
`SECURITY_DEFINITION_OPTION_PARAMETER` messages it receives and return
them in a dataframe when it receives a
`SECURITY_DEFINITION_OPTION_PARAMETER_END` message.

If `timeout` number of seconds elapse before receiving
`SECURITY_DEFINITION_OPTION_PARAMETER_END`, then `fetch_sec_def_opt_params`
returns `None`.

Upon completion, `fetch_sec_def_opt_params` closes the socket it opened.

## Parameters

| Name                | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                | Default       |
|---------------------|--------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
| `underlyingConId`   | int    | `conId` of the underlying security                                                                                                                                                                                                                                                                                                                                                                                                                         | _required_    |
| `underlyingSymbol`  | str    | Symbol of the underlying security for which you want option parameters.                                                                                                                                                                                                                                                                                                                                                                                    | _required_    |
| `underlyingSecType` | str    | Type of the underlying security; e.g., "`STK`"                                                                                                                                                                                                                                                                                                                                                                                                             | _required_    |
| `host`              |        | Address of a running IBKR client (such as TWS or IBG) that has been configured to accept API connections                                                                                                                                                                                                                                                                                                                                                   | `'127.0.0.1'` |
| `port`              |        | Port of a running IBKR client                                                                                                                                                                                                                                                                                                                                                                                                                              | `7497`        |
| `client_id`         |        | Client ID you want to use for the request. If you are connecting to a system that is used by multiple users, then you may wish to set aside an  ID for this purpose; if you're the only one using the account then  you probably don't have to worry about it -- just use the default.                                                                                                                                                                     | `9999`        |
| `futFopExchange`    |        | Only set this parameter if the underlying is a futures contract; in other words, don't change it from the default `""` if your underlying is  a stock. If your underlying **is** a futures contract, then use  `futFopExchange` to specify the exchange for which you want option  parameters. You may still pass in `""` if you want the results to  include **all** of the exchanges available at IBKR that trade  options on your specified underlying. | `''`          |

## Examples

```
{{< include ../examples/fetch_sec_def_opt_params.py >}}
```