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.
lookup
// 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(optional): The format of the returned data. Alias:format. -
useHumanReadable(optional): Use human-readable field names. Alias:human.
Returns
- Default
- Human Readable
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);
}
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);
}
OptionsLookupResponse
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.
OptionsLookupHumanResponse
interface OptionsLookupHumanResponse {
s?: string;
Symbol: string;
}
OptionsLookupHumanResponse is returned when human: true is set.