# Lookup

Convert a human-readable option description (e.g. `"AAPL 7/28/2023 200 Call"`) into its standard OCC option symbol.

## Making Requests

Use the `lookup()` method on the `options` resource to resolve an OCC symbol from a natural-language description. The URL-encoded lookup string is handled for you by the SDK.

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

```typescript
// Positional form
lookup<P>(
  lookupStr: string,
  params?: P,
): MarketDataPromise<OptionsLookupResponse | OptionsLookupHumanResponse>

// Object form
lookup<P>(
  params: P & { lookup: string },
): MarketDataPromise<OptionsLookupResponse | OptionsLookupHumanResponse>
```

Resolves a human-readable option description to its OCC symbol.

#### Parameters

- `lookupStr` (string)

  A natural-language description of the option contract (e.g. `"AAPL 7/28/2023 200 Call"`, `"TSLA Jan 2025 300 Put"`).

- [`outputFormat`](https://www.marketdata.app/docs/sdk/js/settings#output-format) (optional): The format of the returned data. Alias: `format`.
- [`useHumanReadable`](https://www.marketdata.app/docs/sdk/js/settings#human-readable) (optional): Use human-readable field names. Alias: `human`.

#### Returns

- [`MarketDataPromise<OptionsLookupResponse | OptionsLookupHumanResponse>`](https://www.marketdata.app/docs/sdk/js/client#MarketDataPromise)

### Default

```typescript
import { MarketDataClient } from "@marketdata/sdk";

const client = new MarketDataClient();

try {
  const data = await client.options.lookup("AAPL 7/28/2023 200 Call");
  console.log(data.optionSymbol);  // "AAPL230728C00200000"
} catch (error) {
  console.error(error);
}
```

### Human Readable

```typescript
import { MarketDataClient } from "@marketdata/sdk";

const client = new MarketDataClient();

try {
  const data = await client.options.lookup("AAPL 7/28/2023 200 Call", {
    human: true,
  });
  console.log(data.Symbol);
} catch (error) {
  console.error(error);
}
```

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

```typescript
interface OptionsLookupResponse {
  s: string;
  optionSymbol: string;
  updated?: number;
}
```

#### Properties

- `s` (string): Status indicator.
- `optionSymbol` (string): The OCC-format option symbol.
- `updated` (number, optional): Unix timestamp when the lookup resolved.

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

```typescript
interface OptionsLookupHumanResponse {
  s?: string;
  Symbol: string;
}
```

`OptionsLookupHumanResponse` is returned when `human: true` is set.
