FuncStock

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 piece of information for a given stock on a given date. The information can be the high, low, close, or open of the stock.

LPXLOPER12 WINAPI FuncStock(LPWSTR stval, LPWSTR sttkr, int date);
LPXLOPER WINAPI FuncStockOld(LPSTR stval, LPSTR ststk, int date);

Parameters

stval

The type of the value desired. One of "OPEN", "CLOSE", "LOW", "HIGH".

sttkr (FuncStock), ststk (FuncStockOld)

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.

date (int)

The date as an integer. (The internal off-line data runs from date zero to 64 inclusive).

Property Value/Return Value

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

Remarks

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

Both FuncStock and FuncStockOld are registered as volatile. In Excel 2007, FuncStock 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