Symbol Directory Requests

In this tutorial we'll cover the Symbol Directory API. The Symbol Directory is a sub-process of the ContentGateway which keeps track of all instruments and certain fields which can be searched upon. Currently these fields are FID_NAME and FID_LOCAL_CODE.

The API offers functions for searching instrument names and local codes to get matching symbols. There is also an option to filter the matching symbols on entity types.

Making a getSymbols request

Here is a runnable example:

// You may have to update the userId and password fields below.
const userId = "__ACTIV_FEED_USERNAME__";
const password = "__ACTIV_FEED_PASSWORD__";
const url = "ams://cg-ny4-replay.activfinancial.com/ContentGateway:Service";

(async function() {
    try {
        console.log("Connecting...");

        const client = await activCgApi.connect({
            url,
            userId,
            password
        });

        console.log("Connected. Initiating data request...");

        // Initiate a getSymbols request to the ContentGateway.
        const requestHandle = client.symbolDirectory.getSymbols({
            fieldId: activCgApi.FieldId.FID_NAME,
            search: "Microsoft",
            // Default is an exact match on the first word of the name. Setting "partial" means
            // "Microsoftware Intl" will be a match.
            matchType: activCgApi.SymbolDirectory.MatchType.partial,
            filterType: activCgApi.SymbolDirectory.FilterType.includeEntityTypes,
            entityTypes: [activCgApi.EntityType.company]
        });

        // Asynchronously iterate records.
        for await (const record of requestHandle) {
            console.log(record.symbolId);
        }
    } catch (e) {
        console.error(`Error: ${e}`);
    }
})();
Try it out in the playground

Parameters

The parameters to the request are described here.

Also in this Section