---
title: Quotes
sidebar_position: 5
---

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





Retrieve an option quote for a given option symbol.

## Making Requests

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

| Method     | Execution       | Return Type                  | Description                                                                                                                |
|------------|-----------------|------------------------------|----------------------------------------------------------------------------------------------------------------------------|
| **Get**    | Direct          | `[]OptionQuote`              | Immediately fetches a slice of `[]OptionQuote`, allowing direct access to the quote 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="OptionQuoteRequest"></a>
## OptionQuoteRequest

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

OptionQuotesRequest represents a request to the [/v1/options/quotes/](<https://www.marketdata.app/docs/api/options/quotes>) endpoint for retrieving options quotes. It encapsulates parameters for symbol, expiration, and strike to be used in the request.

#### Generated By

- <a href="#OptionQuotes">`OptionQuotes() *OptionQuoteRequest`</a>

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


#### Setter Methods

- <a href="#OptionQuoteRequest.OptionSymbol">`OptionSymbol(string) *OptionQuoteRequest`</a>

  Sets the symbol parameter for the request.

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

  Sets the date parameter for the request, accepting flexible date input.

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

  Sets the start date of a date range for the request, accepting flexible date input.

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

  Sets the end date of a date range for the request, accepting flexible date input.


#### 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="#OptionQuoteRequest.Get">`Get() ([]OptionQuote, error)`</a>

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

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

  Returns a struct that contains equal\-length slices of primitives. This packed response mirrors Market Data's JSON response.

- <a href="#OptionQuoteRequest.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 := OptionQuote().OptionSymbol("AAPL271217C00250000").Date("2024-02-05").Get()
if err != nil {
	fmt.Print(err)
	return
}

for _, quote := range resp {
	fmt.Println(quote)
}
```

#### Output

```
OptionQuote{OptionSymbol: "AAPL271217C00250000", Underlying: "AAPL", Expiration: 2025-01-17 16:00:00 -05:00, Side: "call", Strike: 150, FirstTraded: 2022-09-12 09:30:00 -04:00, DTE: 347, Ask: 47.7, AskSize: 17, Bid: 47.2, BidSize: 36, Mid: 47.45, Last: 48.65, Volume: 202, OpenInterest: 10768, UnderlyingPrice: 187.68, InTheMoney: true, Updated: "2024-02-05 16:00:00 -05:00", IV: nil, Delta: nil, Gamma: nil, Theta: nil, Vega: nil, Rho: nil, IntrinsicValue: 37.68, ExtrinsicValue: 9.77}
```

</TabItem>

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




```go
resp, err := OptionQuote().OptionSymbol("AAPL250117P00150000").Date("2024-02-05").Packed()
if err != nil {
	fmt.Print(err)
	return
}

fmt.Println(resp)
```

#### Output

```
OptionQuotesResponse{OptionSymbol: ["AAPL250117P00150000"], Underlying: ["AAPL"], Expiration: [1737147600], Side: ["put"], Strike: [150], FirstTraded: [1662989400], DTE: [347], Ask: [3.65], AskSize: [292], Bid: [3.5], BidSize: [634], Mid: [3.58], Last: [3.55], Volume: [44], OpenInterest: [18027], UnderlyingPrice: [187.68], InTheMoney: [false], Updated: [1707166800], IV: [nil], Delta: [nil], Gamma: [nil], Theta: [nil], Vega: [nil], Rho: [nil], IntrinsicValue: [0], ExtrinsicValue: [3.58]}
```

</TabItem>

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




```go
resp, err := OptionQuote().OptionSymbol("AAPL250117P00150000").Date("2024-02-05").Raw()
if err != nil {
	fmt.Print(err)
	return
}

fmt.Println(resp)
```

#### Output

```
{"s":"ok","optionSymbol":["AAPL250117P00150000"],"underlying":["AAPL"],"expiration":[1737147600],"side":["put"],"strike":[150.0],"firstTraded":[1662989400],"dte":[347],"updated":[1707166800],"bid":[3.5],"bidSize":[634],"mid":[3.58],"ask":[3.65],"askSize":[292],"last":[3.55],"openInterest":[18027],"volume":[44],"inTheMoney":[false],"intrinsicValue":[0.0],"extrinsicValue":[3.58],"underlyingPrice":[187.68],"iv":[null],"delta":[null],"gamma":[null],"theta":[null],"vega":[null],"rho":[null]}
```

</TabItem>
</Tabs>

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

```go
func OptionQuote() *OptionQuoteRequest
```

OptionQuotes creates a new OptionQuotesRequest and uses the default client.

#### Returns

- `*OptionQuotesRequest`

  A pointer to the newly created OptionQuotesRequest with default parameters.

## OptionQuoteRequest Setter Methods

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

```go
func (oqr *OptionQuoteRequest) Date(q interface{}) *OptionQuoteRequest
```

Date sets the date parameter for the OptionQuotesRequest. This method is used to specify the date for which the option quote is requested. It allows for flexibility in the type of date input \(e.g., string, time.Time\) through the use of an interface\{\} parameter.

#### Parameters

- `interface{}`

  The date to be set. The actual type accepted can vary \(e.g., string, time.Time, int for Unix timestamp\).


#### Returns

- `*OptionQuotesRequest`

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


<a name="OptionQuoteRequest.From"></a>
### From

```go
func (oqr *OptionQuoteRequest) From(q interface{}) *OptionQuoteRequest
```

From sets the from parameter for the OptionQuotesRequest. This method is used to specify the start date of a date range for which the option quote is requested. Similar to the Date method, it accepts a flexible date input through an interface\{\} parameter.

#### Parameters

- `interface{}`

  The start date of the range to be set. The actual type accepted can vary.


#### Returns

- `*OptionQuotesRequest`

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


<a name="OptionQuoteRequest.OptionSymbol"></a>
### OptionSymbol

```go
func (oqr *OptionQuoteRequest) OptionSymbol(q string) *OptionQuoteRequest
```

OptionSymbol sets the symbol parameter for the OptionQuotesRequest. This method is used to specify the symbol of the option for which the quote is requested.

#### Parameters

- `string`

  A string representing the option symbol to be set.


#### Returns

- `*OptionQuotesRequest`

  This method returns a pointer to the OptionQuotesRequest instance it was called on, allowing for method chaining.


<a name="OptionQuoteRequest.To"></a>
### To

```go
func (oqr *OptionQuoteRequest) To(q interface{}) *OptionQuoteRequest
```

To sets the to parameter for the OptionQuotesRequest. This method is used to specify the end date of a date range for which the option quote is requested. It accepts a flexible date input through an interface\{\} parameter, similar to the From method.

#### Parameters

- `interface{}`

  The end date of the range to be set. The actual type accepted can vary, depending on implementation.


#### Returns

- `*OptionQuotesRequest`

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



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

```go
func (oqr *OptionQuoteRequest) Get() ([]models.OptionQuote, error)
```

Get sends the OptionQuoteRequest, unpacks the OptionQuotesResponse, and returns a slice of OptionQuote. It returns an error if the request or unpacking fails. This method uses the default client for the request.

#### Returns

- `[]models.OptionQuote`

  A slice of OptionQuote containing the unpacked options quotes data from the response.

- `error`

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



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

```go
func (oqr *OptionQuoteRequest) Packed() (*models.OptionQuotesResponse, error)
```

Packed sends the OptionQuoteRequest and returns the OptionQuotesResponse. This method uses the default client for 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="OptionQuoteRequest.Raw"></a>
### Raw

```go
func (oqr *OptionQuoteRequest) Raw() (*resty.Response, error)
```

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

#### Returns

- `*resty.Response`

  The raw HTTP response from the executed request.

- `error`

  An error object if the OptionQuoteRequest 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.


