Metadata Requests

Using the ActivContentGateway API, you can access metadata about the feed itself. These metadata methods are available on the metaData property of the IClient instance.

getContentGatewayInfo

getContentGatewayInfo can be used to return IContentGatewayInfo which contains detailed information about the ContentGateway the API is currently connected to, including hostname, OS it is running on, uptime, etc:

// getContentGatewayInfo() returns an async-iterable by which we can receive status updates
// for the ContentGateway. We're only interested in the initial response here though, so we break out.
for await (const contentGatewayInfo of client.metaData.getContentGatewayInfo()) {
    console.log(`ContentGateway is: ${contentGatewayInfo.systemInfo.hostname}`);
    break;
}

getSubscriptionInfo

getSubscriptionInfo can be used to get ISubscriptionInfo about what content the connected user is currently subscribed to. Here's an example:

// Get realtime subscriptions.
const subscriptionInfo = await client.metaData.getSubscriptionInfo(activCgApi.PermissionLevel.realtime);

for (const symbol in subscriptionInfo.symbolSubscriptions) {
    console.log(`${symbol} has been subscribed to ${subscriptionInfo.symbolSubscriptions[symbol]} times`);
}

// subscriptionInfo.newsSubscriptions shows similar for subscribed news queries.

getPermissionInfo

getPermissionInfo can be used to get IPermissionInfo about what content the connected user is permissioned for. Here's an example:

// Get permissioning information for the user.
const permissionInfo = await client.metaData.getPermissionInfo();

console.log(`Symbol subscription quota is ${permissionInfo.symbolSubscriptionQuota}`);

for (const permissionLevel in permissionInfo.permissionLevels) {
    console.log(`${permissionLevel} permissions:`);

    const permissionLevelInfo = permissionInfo.permissionLevels[permissionLevel];

    for (const permissionIdInfo of permissionLevelInfo) {
        console.log(permissionIdInfo);
    }
}

getTableInfoList, getTableSpecification

getTableInfoList can be used to get ITableInfoList, which is a summary of all the tables that are available on the ContentGateway the API is connected to. Here's an example:

// Get available realtime tables.
const tableInfoList = await client.metaData.getTableInfoList(activCgApi.PermissionLevel.realtime);

for (const tableInfo of tableInfoList) {
    console.log(tableInfo);
}

Details of the fields available in a particular table (ITableSpecification) can be obtained using the getTableSpecification method:

// Get specification of realtime US listing table.
const tableSpecification = await client.metaData.getTableSpecification(
    activCgApi.PermissionLevel.realtime,
    activCgApi.TableNumber.usListing
);

console.log(tableSpecification);

getRelationshipInfo

It's possible to query all the available navigation relationships using getRelationshipInfo:

// Get all available relationships.
const relationshipInfoList = await client.metaData.getRelationshipInfoList();

for (const relationshipInfo of relationshipInfoList) {
    console.log(relationshipInfo);
}

Or relationships available for a particular source table:

// Get relationships for a single source table.
const relationshipInfoList = await client.metaData.getRelationshipInfoList(activCgApi.TableNumber.usListing);

for (const relationshipInfo of relationshipInfoList) {
    console.log(relationshipInfo);
}

These calls return an array of IRelationshipInfo.

getUniversalFieldHelperList, getUniversalFieldHelper

A list of all the field ids currently available on the feed, along with a description of the field and its field type is available using getUniversalFieldHelperList:

// Get all fields.
const fieldHelperList = await client.metaData.getUniversalFieldHelperList();

for (const fieldHelper of fieldHelperList) {
    console.log(fieldHelper);
}

This returns an array of IUniversalFieldHelper.

To query this information for a known field id, use getUniversalFieldHelper. Note that this call can return cached information, or require an initial upstream call to populate the cache. As such, the return type is Promise<UniversalFieldHelper> | UniversalFieldHelper:

// Get information for a single field.
let fieldHelper = client.metaData.getUniversalFieldHelper(activCgApi.FieldId.FID_BID);
if (fieldHelper instanceof Promise) {
    fieldHelper = await fieldHelper;
}

console.log(fieldHelper);

getExchangeInfo

Information about an exchange, such as its timezone and non-trading days, can be retrieved using the getExchangeInfo call:

// Get exchange information.
const exchangeInfo = await client.metaData.getExchangeInfo("MSFT.Q");

console.log(exchangeInfo);

See IExchangeInfo.

Also in this Section