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,
): MarketDataResult<OptionsLookupResponse | OptionsLookupHumanResponse>
// Object form
lookup<P>(
params: P & { lookup: string },
): MarketDataResult<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-js";
const client = new MarketDataClient();
const result = await client.options.lookup("AAPL 7/28/2023 200 Call");
result.match(
(data) => console.log(data.optionSymbol), // "AAPL230728C00200000"
(error) => console.error(error.message),
);
import { MarketDataClient } from "marketdata-sdk-js";
const client = new MarketDataClient();
const result = await client.options.lookup("AAPL 7/28/2023 200 Call", {
human: true,
});
result.match(
(data) => console.log(data.Symbol),
(error) => console.error(error.message),
);
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.