GetStockMetric

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Worksheet user-defined function (UDF) that returns a metric for a given stock, computed between two dates. The metric can be based on the high, low, close, or open of the stock.

LPXLOPER12 GetStockMetric(LPWSTR ststk, LPWSTR stmet, DWORD dwstart, DWORD dwend);
LPXLOPER GetStockMetricOld(LPSTR ststk, LPSTR stmet, DWORD dwstart, DWORD dwend);

Parameters

sttkr

The ticker symbol of the stock as a string. (The internal offline tickers are "Stock1" and "Stock2"). Note that FuncStockOld converts the supplied byte-string to a Unicode string before calling FunckStockInternal, and this conversion truncates the supplied ticker symbol at nine characters in length.

stmet

The metric to be computed as a string. One of "RSI", "MACD", "ADX".

dwstart (DWORD)

dwend (DWORD)

The start and end dates as integers. (The internal off-line data runs from date zero to 64 inclusive).

Property Value/Return Value

Returns the numeric data requested (xltypeNum) or #NULL! if an error occurred.

Remarks

The XLL registers GetStockMetric if loaded by Excel 2007, and GetStockMetricOld if loaded in an earlier version. Both functions are exported to the worksheet as GetStockMetric. Both functions call GetStockMetricInternal, which then calls the Stock Service proxy layer, which accesses either the Web service or the internal data depending on the configuration.

The call will fail if the Web service does not respond, or if passed an invalid input, or if the range of dates is too small to compute the required metric.

Both GetStockMetric and GetStockMetricOld are registered as volatile. In Microsoft Office Excel 2007, GetStockMetric is also registered as thread safe.

Example

See \SAMPLES\STOCK\STOCK.CPP for the code for these functions.

See Also

Concepts

Functions in the Stock Web Service DLL