---
title: Option Chain
sidebar_position: 4
---

import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";





Retrieve a a complete or filtered options chain for a given underlying symbol. Both real\-time and historical requests are possible.

## Making Requests

Utilize [OptionChainRequest](<#OptionChainRequest>) for querying the endpoint through one of the three available methods:

| Method     | Execution Level | Return Type                  | Description                                                                                                                      |
|------------|-----------------|------------------------------|----------------------------------------------------------------------------------------------------------------------------------|
| **Get**    | Direct          | `[]OptionQuote`              | Immediately fetches a slice of `[]OptionQuote`, allowing direct access to the options chain data.                                |
| **Packed** | Intermediate    | `*OptionQuotesResponse`      | Delivers a `*OptionQuotesResponse` object containing the data, which requires unpacking to access the `OptionQuote` data.        |
| **Raw**    | Low-level       | `*resty.Response`            | Offers the unprocessed `*resty.Response` for those seeking full control and access to the raw JSON or `*http.Response`.          |


<a name="OptionChainRequest"></a>
## OptionChainRequest

```go
type OptionChainRequest struct {
    // contains filtered or unexported fields
}
```

OptionChainRequest represents a request to the [/v1/options/chain/](<https://www.marketdata.app/docs/api/options/chain>) endpoint. It encapsulates parameters for symbol, date, and various option\-specific parameters to be used in the request. This struct provides methods to set these parameters, such as UnderlyingSymbol\(\), Date\(\), Expiration\(\), and Strike\(\), among others.

#### Generated By

- <a href="#OptionChain">`OptionChain() *OptionChainRequest`</a>

  OptionChain creates a new \*OptionChainRequest and returns a pointer to the request allowing for method chaining.


#### Setter Methods

These methods are used to set the parameters of the request. They allow for method chaining by returning a pointer to the \*OptionChainRequest instance they modify.

- <a href="#OptionChainRequest.UnderlyingSymbol">`UnderlyingSymbol(string) *OptionChainRequest`</a>

  Sets the underlying symbol parameter for the request.

- <a href="#OptionChainRequest.Date">`Date(interface{}) *OptionChainRequest`</a>

  Sets the date parameter for the request.

- <a href="#OptionChainRequest.Expiration">`Expiration(interface{}) *OptionChainRequest`</a>

  Sets the expiration parameter for the request.

- <a href="#OptionChainRequest.Strike">`Strike(float64) *OptionChainRequest`</a>

  Sets the strike price parameter for the request.

- <a href="#OptionChainRequest.Monthly">`Monthly(bool) *OptionChainRequest`</a>

  Inclues or excludes monthly option expirations from the result.

- <a href="#OptionChainRequest.Weekly">`Weekly(bool) *OptionChainRequest`</a>

  Inclues or excludes weekly option expirations from the result.

- <a href="#OptionChainRequest.Quarterly">`Quarterly(bool) *OptionChainRequest`</a>

  Inclues or excludes quarterly option expirations from the result.

- <a href="#OptionChainRequest.Nonstandard">`Nonstandard(bool) *OptionChainRequest`</a>

  Inclues or excludes non\-standard option expirations from the result.

- <a href="#OptionChainRequest.Month">`Month(int) *OptionChainRequest`</a>

  Requests results from the specific specific month.

- <a href="#OptionChainRequest.Year">`Year(int) *OptionChainRequest`</a>

  Sets the year parameter for the request.

- <a href="#OptionChainRequest.DTE">`DTE(int) *OptionChainRequest`</a>

  Sets the Days to Expiration parameter for the request.

- <a href="#OptionChainRequest.Delta">`Delta(float64) *OptionChainRequest`</a>

  Sets the Delta parameter for the request.

- <a href="#OptionChainRequest.Side">`Side(string) *OptionChainRequest`</a>

  Sets the side of the market \(call or put\) for the request.

- <a href="#OptionChainRequest.Range">`Range(string) *OptionChainRequest`</a>

  Sets the range parameter for the request.

- <a href="#OptionChainRequest.StrikeLimit">`StrikeLimit(int) *OptionChainRequest`</a>

  Sets the maximum number of strike prices to be included in the option chain.

- <a href="#OptionChainRequest.MinOpenInterest">`MinOpenInterest(int) *OptionChainRequest`</a>

  Sets the minimum open interest for options to be included in the option chain.

- <a href="#OptionChainRequest.MinVolume">`MinVolume(int) *OptionChainRequest`</a>

  Sets the minimum volume for options to be included in the option chain.

- <a href="#OptionChainRequest.MaxBidAskSpread">`MaxBidAskSpread(float64) *OptionChainRequest`</a>

  Sets the maximum bid\-ask spread for options to be included in the option chain.

- <a href="#OptionChainRequest.MaxBidAskSpreadPct">`MaxBidAskSpreadPct(float64) *OptionChainRequest`</a>

  Sets the maximum bid\-ask spread percentage for options to be included in the option chain.


#### Execution Methods

These methods are used to send the request in different formats or retrieve the data. They handle the actual communication with the API endpoint.

- <a href="#OptionChainRequest.Get">`Get() ([]OptionQuote, error)`</a>

  Sends the request, unpacks the response, and returns the data in a user\-friendly format.

- <a href="#OptionChainRequest.Packed">`Packed() (*OptionQuotesResponse, error)`</a>

  Packs the request parameters and sends the request, returning a \*OptionQuotesResponse response.

- <a href="#OptionChainRequest.Raw">`Raw() (*resty.Response, error)`</a>

  Sends the request as is and returns the raw HTTP response.




<Tabs>
<TabItem value="Example (Get)" label="Example (Get)">




```go
resp, err := OptionChain().UnderlyingSymbol("AAPL").Side("call").Date("2022-01-03").DTE(60).StrikeLimit(2).Range("itm").Get()
if err != nil {
	fmt.Println("Error fetching option chain:", err)
	return
}
for _, contract := range resp {
	fmt.Println(contract)
}
```

#### Output

```
OptionQuote{OptionSymbol: "AAPL220318C00175000", Underlying: "AAPL", Expiration: 2022-03-18 16:00:00 -04:00, Side: "call", Strike: 175, FirstTraded: 2021-07-13 09:30:00 -04:00, DTE: 74, Ask: 13.1, AskSize: 2, Bid: 12.95, BidSize: 3, Mid: 13.02, Last: 12.9, Volume: 1295, OpenInterest: 15232, UnderlyingPrice: 182.01, InTheMoney: true, Updated: "2022-01-03 16:00:00 -05:00", IV: nil, Delta: nil, Gamma: nil, Theta: nil, Vega: nil, IntrinsicValue: 7.01, ExtrinsicValue: 6.02}
OptionQuote{OptionSymbol: "AAPL220318C00180000", Underlying: "AAPL", Expiration: 2022-03-18 16:00:00 -04:00, Side: "call", Strike: 180, FirstTraded: 2021-07-13 09:30:00 -04:00, DTE: 74, Ask: 10.2, AskSize: 12, Bid: 10, BidSize: 38, Mid: 10.1, Last: 10.1, Volume: 4609, OpenInterest: 18299, UnderlyingPrice: 182.01, InTheMoney: true, Updated: "2022-01-03 16:00:00 -05:00", IV: nil, Delta: nil, Gamma: nil, Theta: nil, Vega: nil, IntrinsicValue: 2.01, ExtrinsicValue: 8.09}
```

</TabItem>

<TabItem value="Example (Packed)" label="Example (Packed)">




```go
resp, err := OptionChain().UnderlyingSymbol("AAPL").Side("call").Date("2022-01-03").
	Month(2).Year(2022).Range("itm").Strike(150).Weekly(false).Monthly(true).Quarterly(false).Nonstandard(false).Packed()
if err != nil {
	fmt.Println("Error fetching packed option chain:", err)
	return
}
fmt.Println(resp)
```

#### Output

```
OptionQuotesResponse{OptionSymbol: ["AAPL220121C00150000"], Underlying: ["AAPL"], Expiration: [1642798800], Side: ["call"], Strike: [150], FirstTraded: [1568640600], DTE: [18], Ask: [32.15], AskSize: [2], Bid: [31.8], BidSize: [359], Mid: [31.98], Last: [32], Volume: [3763], OpenInterest: [98804], UnderlyingPrice: [182.01], InTheMoney: [true], Updated: [1641243600], IV: [nil], Delta: [nil], Gamma: [nil], Theta: [nil], Vega: [nil], IntrinsicValue: [32.01], ExtrinsicValue: [0.03]}
```

</TabItem>
</Tabs>

<a name="OptionChain"></a>
### OptionChain

```go
func OptionChain() *OptionChainRequest
```

OptionChain creates a new OptionChainRequest and associates it with the default client. This function initializes the request with default parameters for symbol, date, and option\-specific parameters, and sets the request path based on the predefined endpoints for option chains.

#### Returns

- `*OptionChainRequest`

  A pointer to the newly created OptionChainRequest with default parameters and associated client.

## OptionChainRequest Setter Methods

<a name="OptionChainRequest.DTE"></a>
### DTE

```go
func (ocr *OptionChainRequest) DTE(dte int) *OptionChainRequest
```

DTE \(Days to Expiration\) sets the DTE parameter for the OptionChainRequest. This method specifies the number of days to expiration for the options in the option chain.

#### Parameters

- `int`

  Requests an expiration date from the option chain based on the number of days from the present date.


#### Returns

- `*OptionChainRequest`

  This method returns a pointer to the OptionChainRequest instance it was called on. This allows for method chaining. If the receiver \(\*OptionChainRequest\) is nil, it returns nil to prevent a panic.


<a name="OptionChainRequest.Date"></a>
### Date

```go
func (ocr *OptionChainRequest) Date(q interface{}) *OptionChainRequest
```

Date sets the date parameter for the OptionChainRequest. This method is used to specify the date for which the option chain is requested. It modifies the dateParams field of the OptionChainRequest instance to store the date value.

#### Parameters

- `interface{}`

  An interface\{\} that represents the starting date. It can be a string, a time.Time object, a Unix timestamp or any other type that the underlying dates package can process.


#### Returns

- `*OptionChainRequest`

  This method returns a pointer to the OptionChainRequest instance it was called on. This allows for method chaining. If the receiver \(\*OptionChainRequest\) is nil, it returns nil to prevent a panic.


<a name="OptionChainRequest.Delta"></a>
### Delta

```go
func (ocr *OptionChainRequest) Delta(delta float64) *OptionChainRequest
```

Delta sets the Delta parameter for the OptionChainRequest. This method is used to specify a particular Delta value for the options in the option chain. It modifies the optionParams field of the OptionChainRequest instance to store the Delta value.

#### Parameters

- `float64`

  The Delta value to be set.


#### Returns

- `*OptionChainRequest`

  This method returns a pointer to the OptionChainRequest instance it was called on. This allows for method chaining. If the receiver \(\*OptionChainRequest\) is nil, it returns nil to prevent a panic.


<a name="OptionChainRequest.Expiration"></a>
### Expiration

```go
func (ocr *OptionChainRequest) Expiration(q interface{}) *OptionChainRequest
```

Expiration sets the expiration parameter for the OptionChainRequest. This method is used to specify the expiration date for the options in the option chain. It modifies the optionParams field of the OptionChainRequest instance to store the expiration value.

#### Parameters

- `interface{}`

  An interface\{\} representing the expiration date to be set.


#### Returns

- `*OptionChainRequest`

  This method returns a pointer to the OptionChainRequest instance it was called on. This allows for method chaining. If the receiver \(\*OptionChainRequest\) is nil, it returns nil to prevent a panic.


<a name="OptionChainRequest.MaxAsk"></a>
### MaxAsk

```go
func (ocr *OptionChainRequest) MaxAsk(maxAsk float64) *OptionChainRequest
```

MaxAsk sets the MaxAsk parameter for the OptionChainRequest. This method is used to specify the maximum ask price for options to be included in the option chain. It modifies the optionParams field of the OptionChainRequest instance to store the maximum ask price value.

#### Parameters

- `float64`

  A float64 representing the maximum ask price to be included in the result.


#### Returns

- `*OptionChainRequest`

  This method returns a pointer to the OptionChainRequest instance it was called on. This allows for method chaining. If the receiver \(\*OptionChainRequest\) is nil, it returns nil to prevent a panic.


<a name="OptionChainRequest.MaxBid"></a>
### MaxBid

```go
func (ocr *OptionChainRequest) MaxBid(maxBid float64) *OptionChainRequest
```

MaxBid sets the MaxBid parameter for the OptionChainRequest. This method is used to specify the maximum bid price for options to be included in the option chain. It modifies the optionParams field of the OptionChainRequest instance to store the maximum bid price value.

#### Parameters

- `float64`

  A float64 representing the maximum bid price to be included in the result.


#### Returns

- `*OptionChainRequest`

  This method returns a pointer to the OptionChainRequest instance it was called on. This allows for method chaining. If the receiver \(\*OptionChainRequest\) is nil, it returns nil to prevent a panic.


<a name="OptionChainRequest.MaxBidAskSpread"></a>
### MaxBidAskSpread

```go
func (ocr *OptionChainRequest) MaxBidAskSpread(maxBidAskSpread float64) *OptionChainRequest
```

MaxBidAskSpread sets the MaxBidAskSpread parameter for the OptionChainRequest. This method is used to specify the maximum bid\-ask spread for options to be included in the option chain. It modifies the optionParams field of the OptionChainRequest instance to store the maximum bid\-ask spread value.

#### Parameters

- `float64`

  A float64 representing the maximum bid\-ask spread neeeded to be included in the result.


#### Returns

- `*OptionChainRequest`

  This method returns a pointer to the OptionChainRequest instance it was called on. This allows for method chaining. If the receiver \(\*OptionChainRequest\) is nil, it returns nil to prevent a panic.


<a name="OptionChainRequest.MaxBidAskSpreadPct"></a>
### MaxBidAskSpreadPct

```go
func (ocr *OptionChainRequest) MaxBidAskSpreadPct(maxBidAskSpreadPct float64) *OptionChainRequest
```

MaxBidAskSpreadPct sets the MaxBidAskSpreadPct parameter for the OptionChainRequest. This method is used to specify the maximum bid\-ask spread percentage for options to be included in the option chain. It modifies the optionParams field of the OptionChainRequest instance to store the maximum bid\-ask spread percentage value.

#### Parameters

- `float64`

  A float64 representing the maximum bid\-ask spread percentage to be included in the result.


#### Returns

- `*OptionChainRequest`

  This method returns a pointer to the OptionChainRequest instance it was called on. This allows for method chaining. If the receiver \(\*OptionChainRequest\) is nil, it returns nil to prevent a panic.


<a name="OptionChainRequest.MinAsk"></a>
### MinAsk

```go
func (ocr *OptionChainRequest) MinAsk(minAsk float64) *OptionChainRequest
```

MinAsk sets the MinAsk parameter for the OptionChainRequest. This method is used to specify the minimum ask price for options to be included in the option chain. It modifies the optionParams field of the OptionChainRequest instance to store the minimum ask price value.

#### Parameters

- `float64`

  A float64 representing the minimum ask price to be included in the result.


#### Returns

- `*OptionChainRequest`

  This method returns a pointer to the OptionChainRequest instance it was called on. This allows for method chaining. If the receiver \(\*OptionChainRequest\) is nil, it returns nil to prevent a panic.


<a name="OptionChainRequest.MinBid"></a>
### MinBid

```go
func (ocr *OptionChainRequest) MinBid(minBid float64) *OptionChainRequest
```

MinBid sets the MinBid parameter for the OptionChainRequest. This method is used to specify the minimum bid price for options to be included in the option chain. It modifies the optionParams field of the OptionChainRequest instance to store the minimum bid price value.

#### Parameters

- `float64`

  A float64 representing the minimum bid price to be included in the result.


#### Returns

- `*OptionChainRequest`

  This method returns a pointer to the OptionChainRequest instance it was called on. This allows for method chaining. If the receiver \(\*OptionChainRequest\) is nil, it returns nil to prevent a panic.


<a name="OptionChainRequest.MinOpenInterest"></a>
### MinOpenInterest

```go
func (ocr *OptionChainRequest) MinOpenInterest(minOpenInterest int) *OptionChainRequest
```

MinOpenInterest sets the MinOpenInterest parameter for the OptionChainRequest. This method is used to specify the minimum open interest for options to be included in the option chain. It modifies the optionParams field of the OptionChainRequest instance to store the minimum open interest value.

#### Parameters

- `int`

  An int representing the minimum open interest required to be included in the result.


#### Returns

- `*OptionChainRequest`

  This method returns a pointer to the OptionChainRequest instance it was called on. This allows for method chaining. If the receiver \(\*OptionChainRequest\) is nil, it returns nil to prevent a panic.


<a name="OptionChainRequest.MinVolume"></a>
### MinVolume

```go
func (ocr *OptionChainRequest) MinVolume(minVolume int) *OptionChainRequest
```

MinVolume sets the MinVolume parameter for the OptionChainRequest. This method is used to specify the minimum volume for options to be included in the option chain. It modifies the optionParams field of the OptionChainRequest instance to store the minimum volume value.

#### Parameters

- `int`

  An int representing the minimum volume needed to be included in the result.


#### Returns

- `*OptionChainRequest`

  This method returns a pointer to the OptionChainRequest instance it was called on. This allows for method chaining. If the receiver \(\*OptionChainRequest\) is nil, it returns nil to prevent a panic.


<a name="OptionChainRequest.Month"></a>
### Month

```go
func (ocr *OptionChainRequest) Month(month int) *OptionChainRequest
```

Month sets the month parameter for the OptionChainRequest. This method is used to specify the month for which the option chain is requested. It modifies the optionParams field of the OptionChainRequest instance to store the month value.

#### Parameters

- `int`

  The month to be set.


#### Returns

- `*OptionChainRequest`

  This method returns a pointer to the OptionChainRequest instance it was called on. This allows for method chaining. If the receiver \(\*OptionChainRequest\) is nil, it returns nil to prevent a panic.


<a name="OptionChainRequest.Monthly"></a>
### Monthly

```go
func (ocr *OptionChainRequest) Monthly(monthly bool) *OptionChainRequest
```

Monthly sets the monthly parameter for the OptionChainRequest. This method is used to specify whether to include monthly options in the option chain. It modifies the optionParams field of the OptionChainRequest instance to store the monthly value.

#### Parameters

- `bool`

  Whether to include monthly options.


#### Returns

- `*OptionChainRequest`

  This method returns a pointer to the OptionChainRequest instance it was called on. This allows for method chaining. If the receiver \(\*OptionChainRequest\) is nil, it returns nil to prevent a panic.


<a name="OptionChainRequest.Nonstandard"></a>
### Nonstandard

```go
func (ocr *OptionChainRequest) Nonstandard(nonstandard bool) *OptionChainRequest
```

Nonstandard sets the nonstandard parameter for the OptionChainRequest. This method is used to specify whether to include nonstandard options in the option chain. It modifies the optionParams field of the OptionChainRequest instance to store the nonstandard value.

#### Parameters

- `bool`

  Whether to include nonstandard options.


#### Returns

- `*OptionChainRequest`

  This method returns a pointer to the OptionChainRequest instance it was called on. This allows for method chaining. If the receiver \(\*OptionChainRequest\) is nil, it returns nil to prevent a panic.


<a name="OptionChainRequest.Quarterly"></a>
### Quarterly

```go
func (ocr *OptionChainRequest) Quarterly(quarterly bool) *OptionChainRequest
```

Quarterly sets the quarterly parameter for the OptionChainRequest. This method is used to specify whether to include quarterly options in the option chain. It modifies the optionParams field of the OptionChainRequest instance to store the quarterly value.

#### Parameters

- `bool`

  Whether to include quarterly options.


#### Returns

- `*OptionChainRequest`

  This method returns a pointer to the OptionChainRequest instance it was called on. This allows for method chaining. If the receiver \(\*OptionChainRequest\) is nil, it returns nil to prevent a panic.


<a name="OptionChainRequest.Range"></a>
### Range

```go
func (ocr *OptionChainRequest) Range(rangeParam string) *OptionChainRequest
```

Range sets the Range parameter for the OptionChainRequest. This method is used to specify the range of options to be included in the option chain based on their strike price. It modifies the optionParams field of the OptionChainRequest instance to store the range value.

#### Parameters

- `string`

  A string representing the range of options to be included. The expected values can vary, such as "ITM" \(In The Money\), "OTM" \(Out of The Money\), "ATM" \(At The Money\), etc.


#### Returns

- `*OptionChainRequest`

  This method returns a pointer to the OptionChainRequest instance it was called on. This allows for method chaining. If the receiver \(\*OptionChainRequest\) is nil, it returns nil to prevent a panic.


<a name="OptionChainRequest.Side"></a>
### Side

```go
func (ocr *OptionChainRequest) Side(side string) *OptionChainRequest
```

Side sets the Side parameter for the OptionChainRequest. This method is used to specify the side of the market for the options in the option chain \(e.g., call or put\). It modifies the optionParams field of the OptionChainRequest instance to store the side value.

#### Parameters

- `string`

  A string representing the side of the market chain to be set. Expected value is "call" or "put".


#### Returns

- `*OptionChainRequest`

  This method returns a pointer to the OptionChainRequest instance it was called on. This allows for method chaining. If the receiver \(\*OptionChainRequest\) is nil, it returns nil to prevent a panic.


<a name="OptionChainRequest.Strike"></a>
### Strike

```go
func (ocr *OptionChainRequest) Strike(strike float64) *OptionChainRequest
```

Strike sets the strike price parameter for the OptionChainRequest. This method is used to specify a particular strike price for the options in the option chain. It modifies the optionParams field of the OptionChainRequest instance to store the strike price value.

#### Parameters

- `float64`

  The strike price to be set.


#### Returns

- `*OptionChainRequest`

  This method returns a pointer to the OptionChainRequest instance it was called on. This allows for method chaining. If the receiver \(\*OptionChainRequest\) is nil, it returns nil to prevent a panic.


<a name="OptionChainRequest.StrikeLimit"></a>
### StrikeLimit

```go
func (ocr *OptionChainRequest) StrikeLimit(strikeLimit int) *OptionChainRequest
```

StrikeLimit sets the StrikeLimit parameter for the OptionChainRequest. This method is used to specify the maximum number of strike prices to be included in the option chain. It modifies the optionParams field of the OptionChainRequest instance to store the strike limit value.

#### Parameters

- `int`

  The maximum number of strikes to be included.


#### Returns

- `*OptionChainRequest`

  This method returns a pointer to the OptionChainRequest instance it was called on. This allows for method chaining. If the receiver \(\*OptionChainRequest\) is nil, it returns nil to prevent a panic.


<a name="OptionChainRequest.UnderlyingSymbol"></a>
### UnderlyingSymbol

```go
func (ocr *OptionChainRequest) UnderlyingSymbol(q string) *OptionChainRequest
```

UnderlyingSymbol sets the underlyingSymbol parameter for the OptionChainRequest. This method is used to specify the symbol of the underlying asset for which the option chain is requested. It modifies the symbolParams field of the OptionChainRequest instance to store the symbol value.

#### Parameters

- `string`

  The underlying symbol to be set.


#### Returns

- `*OptionChainRequest`

  This method returns a pointer to the OptionChainRequest instance it was called on. This allows for method chaining, where multiple setter methods can be called in a single statement. If the receiver \(\*OptionChainRequest\) is nil, it returns nil to prevent a panic.


<a name="OptionChainRequest.Weekly"></a>
### Weekly

```go
func (ocr *OptionChainRequest) Weekly(weekly bool) *OptionChainRequest
```

Weekly sets the weekly parameter for the OptionChainRequest. This method is used to specify whether to include weekly options in the option chain. It modifies the optionParams field of the OptionChainRequest instance to store the weekly value.

#### Parameters

- `bool`

  Whether to include weekly options.


#### Returns

- `*OptionChainRequest`

  This method returns a pointer to the OptionChainRequest instance it was called on. This allows for method chaining. If the receiver \(\*OptionChainRequest\) is nil, it returns nil to prevent a panic.


<a name="OptionChainRequest.Year"></a>
### Year

```go
func (ocr *OptionChainRequest) Year(year int) *OptionChainRequest
```

Year sets the year parameter for the OptionChainRequest. This method is used to specify the year for which the option chain is requested. It modifies the optionParams field of the OptionChainRequest instance to store the year value.

#### Parameters

- `int`

  The year to be set.


#### Returns

- `*OptionChainRequest`

  This method returns a pointer to the OptionChainRequest instance it was called on. This allows for method chaining. If the receiver \(\*OptionChainRequest\) is nil, it returns nil to prevent a panic.



## OptionChainRequest Execution Methods
<a name="OptionChainRequest.Get"></a>
### Get

```go
func (ocr *OptionChainRequest) Get() ([]models.OptionQuote, error)
```

Get sends the OptionChainRequest, unpacks the OptionChainResponse, and returns a slice of OptionQuote. It returns an error if the request or unpacking fails. This method is crucial for obtaining the actual option chain data from the option chain request. The method first checks if the OptionChainRequest receiver is nil, which would result in an error as the request cannot be sent. It then proceeds to send the request using the default client. Upon receiving the response, it unpacks the data into a slice of OptionQuote using the Unpack method from the response.

#### Returns

- `[]models.OptionQuote`

  A slice of OptionQuote containing the unpacked option chain data from the response.

- `error`

  An error object that indicates a failure in sending the request or unpacking the response.



<a name="OptionChainRequest.Packed"></a>
### Packed

```go
func (ocr *OptionChainRequest) Packed() (*models.OptionQuotesResponse, error)
```

Packed sends the OptionChainRequest and returns the OptionChainResponse. This method checks if the OptionChainRequest receiver is nil, returning an error if true. It proceeds to send the request using the default client and returns the OptionChainResponse along with any error encountered during the request.

#### Returns

- `*models.OptionQuotesResponse`

  A pointer to the OptionQuotesResponse obtained from the request.

- `error`

  An error object that indicates a failure in sending the request.


<a name="OptionChainRequest.Raw"></a>
### Raw

```go
func (ocr *OptionChainRequest) Raw() (*resty.Response, error)
```

Raw executes the OptionChainRequest and returns the raw \*resty.Response. This method uses the default client for this request. The \*resty.Response can be directly used to access the raw JSON or \*http.Response.

#### Returns

- `*resty.Response`

  The raw HTTP response from the executed OptionChainRequest.

- `error`

  An error object if the OptionChainRequest is nil or if an error occurs during the request execution.



<a name="OptionQuotesResponse"></a>
## OptionQuotesResponse

```go
type OptionQuotesResponse struct {
    OptionSymbol    []string   `json:"optionSymbol"`    // OptionSymbol holds the symbols of the options.
    Underlying      []string   `json:"underlying"`      // Underlying contains the symbols of the underlying assets.
    Expiration      []int64    `json:"expiration"`      // Expiration stores UNIX timestamps for when the options expire.
    Side            []string   `json:"side"`            // Side indicates whether the option is a call or a put.
    Strike          []float64  `json:"strike"`          // Strike represents the strike prices of the options.
    FirstTraded     []int64    `json:"firstTraded"`     // FirstTraded stores UNIX timestamps for when the options were first traded.
    DTE             []int      `json:"dte"`             // DTE (Days to Expiration) indicates the number of days until the options expire.
    Ask             []float64  `json:"ask"`             // Ask contains the ask prices of the options.
    AskSize         []int64    `json:"askSize"`         // AskSize holds the sizes of the ask orders.
    Bid             []float64  `json:"bid"`             // Bid contains the bid prices of the options.
    BidSize         []int64    `json:"bidSize"`         // BidSize holds the sizes of the bid orders.
    Mid             []float64  `json:"mid"`             // Mid represents the mid prices calculated between the bid and ask prices.
    Last            []float64  `json:"last"`            // Last contains the last traded prices of the options.
    Volume          []int64    `json:"volume"`          // Volume indicates the trading volumes of the options.
    OpenInterest    []int64    `json:"openInterest"`    // OpenInterest represents the total number of outstanding contracts.
    UnderlyingPrice []float64  `json:"underlyingPrice"` // UnderlyingPrice contains the prices of the underlying assets.
    InTheMoney      []bool     `json:"inTheMoney"`      // InTheMoney indicates whether the options are in the money.
    Updated         []int64    `json:"updated"`         // Updated stores UNIX timestamps for when the option data was last updated.
    IV              []*float64 `json:"iv,omitempty"`    // IV (Implied Volatility) represents the implied volatilities of the options.
    Delta           []*float64 `json:"delta,omitempty"` // Delta measures the rate of change of the option's price with respect to the underlying asset's price.
    Gamma           []*float64 `json:"gamm,omitempty"`  // Gamma measures the rate of change in delta over the underlying asset's price movement.
    Theta           []*float64 `json:"theta,omitempty"` // Theta represents the rate of decline in the option's value with time.
    Vega            []*float64 `json:"vega,omitempty"`  // Vega measures sensitivity to volatility.
    Rho             []*float64 `json:"rho,omitempty"`   // Rho measures sensitivity to the interest rate.
    IntrinsicValue  []float64  `json:"intrinsicValue"`  // IntrinsicValue represents the value of the option if it were exercised now.
    ExtrinsicValue  []float64  `json:"extrinsicValue"`  // ExtrinsicValue represents the value of the option above its intrinsic value.
}
```

OptionQuotesResponse represents the JSON structure of the response received for option quotes. It includes slices for various option attributes such as symbols, underlying assets, expiration times, and pricing information.



<a name="OptionQuotesResponse.IsValid"></a>
### IsValid

```go
func (oqr *OptionQuotesResponse) IsValid() bool
```

IsValid determines the validity of an OptionQuotesResponse by invoking the Validate method. This method is primarily used to ensure that the OptionQuotesResponse adheres to expected formats and contains all necessary data before proceeding with further processing or operations.

#### Returns

- `bool`

  Indicates whether the OptionQuotesResponse is valid.


#### Notes

- This method relies on the Validate method to check for inconsistencies or missing data in the OptionQuotesResponse.

<a name="OptionQuotesResponse.String"></a>
### String

```go
func (oqr *OptionQuotesResponse) String() string
```

String generates a formatted string representation of all OptionQuotes contained within the OptionQuotesResponse. This method is primarily used for producing a human\-readable summary of the OptionQuotes, which can be useful for logging, debugging, or displaying the data in a more accessible format.

#### Parameters

- `oqr *OptionQuotesResponse`

  A pointer to the OptionQuotesResponse instance.


#### Returns

- `string`

  A string that represents all OptionQuotes in a human\-readable format.


#### Notes

- This method simplifies the visualization of complex OptionQuotes data by converting it into a string format.

<a name="OptionQuotesResponse.Unpack"></a>
### Unpack

```go
func (oqr *OptionQuotesResponse) Unpack() ([]OptionQuote, error)
```

Unpack converts the OptionQuotesResponse into a slice of OptionQuote structs, allowing for the individual option quotes contained within the response to be accessed and manipulated more easily. This method is primarily used when there's a need to work with the data of each option quote separately after fetching a bulk response.

#### Parameters

- `*OptionQuotesResponse oqr`

  A pointer to the OptionQuotesResponse instance to be unpacked.


#### Returns

- `[]OptionQuote`

  A slice of OptionQuote structs that represent the unpacked data.

- `*error`

  An error if the time zone loading fails or if the validation fails.


#### Notes

- This method first validates the OptionQuotesResponse to ensure consistency before attempting to unpack it.

<a name="OptionQuotesResponse.Validate"></a>
### Validate

```go
func (oqr *OptionQuotesResponse) Validate() error
```

#### Returns

- `error`

  An error if there is an inconsistency in the lengths of slices or if there are no option symbols. Returns nil if all checks pass.


#### Notes

- This method is particularly important for preventing runtime errors that could occur when processing inconsistent data.








<a name="OptionQuote"></a>
## OptionQuote

```go
type OptionQuote struct {
    OptionSymbol    string    // OptionSymbol is the symbol of the option.
    Underlying      string    // Underlying is the symbol of the underlying asset.
    Expiration      time.Time // Expiration is the time when the option expires.
    Side            string    // Side indicates whether the option is a call or a put.
    Strike          float64   // Strike is the strike price of the option.
    FirstTraded     time.Time // FirstTraded is the time when the option was first traded.
    DTE             int       // DTE (Days to Expiration) is the number of days until the option expires.
    Ask             float64   // Ask is the ask price of the option.
    AskSize         int64     // AskSize is the size of the ask order.
    Bid             float64   // Bid is the bid price of the option.
    BidSize         int64     // BidSize is the size of the bid order.
    Mid             float64   // Mid is the mid price calculated between the bid and ask prices.
    Last            float64   // Last is the last traded price of the option.
    Volume          int64     // Volume is the trading volume of the option.
    OpenInterest    int64     // OpenInterest is the total number of outstanding contracts.
    UnderlyingPrice float64   // UnderlyingPrice is the price of the underlying asset.
    InTheMoney      bool      // InTheMoney indicates whether the option is in the money.
    Updated         time.Time // Updated is the time when the option data was last updated.
    IV              *float64  // IV (Implied Volatility) is the implied volatility of the option.
    Delta           *float64  // Delta measures the rate of change of the option's price with respect to the underlying asset's price.
    Gamma           *float64  // Gamma measures the rate of change in delta over the underlying asset's price movement.
    Theta           *float64  // Theta represents the rate of decline in the option's value with time.
    Vega            *float64  // Vega measures sensitivity to volatility.
    Rho             *float64  // Rho measures sensitivity to the interest rate.
    IntrinsicValue  float64   // IntrinsicValue is the value of the option if it were exercised now.
    ExtrinsicValue  float64   // ExtrinsicValue is the value of the option above its intrinsic value.
}
```

OptionQuote represents a single option quote with detailed information such as the symbol, underlying asset, expiration time, and pricing information.



<a name="OptionQuote.DisplayDelta"></a>
### DisplayDelta

```go
func (oq OptionQuote) DisplayDelta() string
```

DisplayDelta formats the Delta value of an OptionQuote into a string. Delta measures the rate of change of the option's price with respect to the underlying asset's price. This method is useful for displaying Delta in a human\-readable format, especially in user interfaces or logs.

#### Returns

- `string`

  The formatted Delta value as a string. If Delta is nil, returns "nil".


<a name="OptionQuote.DisplayGamma"></a>
### DisplayGamma

```go
func (oq OptionQuote) DisplayGamma() string
```

DisplayGamma formats the Gamma value of an OptionQuote into a string. Gamma measures the rate of change in Delta over the underlying asset's price movement. This method is useful for displaying Gamma in a human\-readable format, particularly in user interfaces or logs.

#### Returns

- `string`

  The formatted Gamma value as a string. If Gamma is nil, returns "nil".


<a name="OptionQuote.DisplayIV"></a>
### DisplayIV

```go
func (oq OptionQuote) DisplayIV() string
```

Formats the implied volatility \(IV\) of an option into a string. This method is primarily used for displaying the IV in a human\-readable format, which is useful for logging, debugging, or displaying the IV value in user interfaces.

#### Returns

- `string`

  The formatted IV value as a string. If the IV is nil, returns "nil".


#### Notes

- The IV is formatted to a floating\-point number as a string. If the IV is not set \(nil\), the method returns the string "nil".

<a name="OptionQuote.DisplayMid"></a>
### DisplayMid

```go
func (oq OptionQuote) DisplayMid() string
```

Formats the mid price of an option into a string. This method is primarily used for displaying the mid price in a human\-readable format, which is useful for logging, debugging, or displaying the mid price value in user interfaces.

#### Returns

- `string`

  The formatted mid price value as a string.


#### Notes

- The mid price is calculated as the average of the bid and ask prices. This method formats the mid price to a floating\-point number as a string.

<a name="OptionQuote.DisplayRho"></a>
### DisplayRho

```go
func (oq OptionQuote) DisplayRho() string
```

DisplayRho formats the Rho value of an OptionQuote into a string. Rho measures sensitivity to the interest rate. This method is useful for displaying Rho in a human\-readable format, especially in user interfaces or logs.

#### Returns

- `string`

  The formatted Rho value as a string. If Rho is nil, returns "nil".


<a name="OptionQuote.DisplayTheta"></a>
### DisplayTheta

```go
func (oq OptionQuote) DisplayTheta() string
```

DisplayTheta formats the Theta value of an OptionQuote into a string. Theta represents the rate of decline in the option's value with time. This method is useful for displaying Theta in a human\-readable format, especially in user interfaces or logs.

#### Returns

- `string`

  The formatted Theta value as a string. If Theta is nil, returns "nil".


<a name="OptionQuote.DisplayVega"></a>
### DisplayVega

```go
func (oq OptionQuote) DisplayVega() string
```

DisplayVega formats the Vega value of an OptionQuote into a string. Vega measures sensitivity to volatility. This method is useful for displaying Vega in a human\-readable format, particularly in user interfaces or logs.

#### Returns

- `string`

  The formatted Vega value as a string. If Vega is nil, returns "nil".


<a name="OptionQuote.String"></a>
### String

```go
func (oq OptionQuote) String() string
```

String provides a human\-readable representation of an OptionQuote, encapsulating its key details in a formatted string. This method is primarily used for logging, debugging, or displaying the OptionQuote in a format that is easy to read and understand. It includes information such as the option symbol, underlying asset, expiration date, and more, formatted into a single string.

#### Returns

- `string`

  A formatted string that encapsulates the OptionQuote details, making it easier to read and understand.


#### Notes

- This method is particularly useful for debugging purposes or when there's a need to log the OptionQuote details in a human\-readable format.


