Transformation of real time data into times series and filtered real time data within a spreadsheet application5926822Abstract A spreadsheet application includes functions and data structures for transforming real time data items individually received over time from a real time data source into time series data globally available within the spreadsheet environment. The spreadsheet application includes a tape function operating in conjunction with a plurality of tape data structures, to store real time data items received over individually over time from a real time data source into one of the tape data structures, thereby persistently storing a set of previously received real time data items in a manner that is accessible to other functions of the spreadsheet. A plurality of filter functions and filter data structures enable computation of various statistical measures on real time data items by storing in globally accessible filter data structures information derived from a sequence of real time data items, such as a previously computed filter output, latency information describing the time intervals between real time data items, and other data, to allow the computation of a current filter output without storing all previously received real time data items. The filter and tape functions allow for various uses of real time data items without the need to provide complex macro programming. Claims I claim: Description BACKGROUND
______________________________________
define MAXSIZE (100);
/*size of a tape*/
define MAXNUM (256);
/*number of tapes*/
typedef struct {
time.sub.-- t t;
/*system time*/
double s1; /*first RTDI*/
double s2; /*second RTDI*/
double s3; /*third RTDI*/
} TAPE.sub.-- ELEMENT;
/*a tape tuple*/
typedef struct {
int size; /*size (N) of tape*/
int front; /*index for first element*/
int back; /*index for last element*/
TAPE.sub.-- ELEMENT element ›MAXSIZE!;
/*array of tuples S(j)*/
} TAPE; /*tape data structure*/
TAPE thetapes ›MAXNUM!;
/declare a set of tapes*/
______________________________________
In a preferred circular-queue type of data structure, the front index defines the location of current RTDI, and the back index defines the location of the least recent, or oldest RTDI. The above data structure definition is but one example of a tape data structure 107, and those of skill in the art will be able to readily define other tape data structures 107 in accordance with the principles of the present invention. As noted above, there may be a useful number of distinct tape data structures 107 provided in the memory partition of the spreadsheet application 105. This allows the user to use multiple different tape data structures 107 to track and manipulate various RTDIs from one or more real time data sources 115. Accordingly, each tape data structure 107 preferably has a tape number which uniquely identifies it, so that the user can properly reference a particular tape data structure 107 in order to store an RTDI thereto. The tape number is resolved by the tape function 111 to a memory location where the tape function 111 stores the RTDIs received from the real time data source 115. For example, using the above data structure definition, this is done by using the tape number as an index into the TAPE array. The tape data structure 107 is used in conjunction with a tape function 111. The tape function 111 is executed by the spreadsheet application 105 in the same manner as conventional functions, that is, when recalculation of a cell containing the tape function 111 is required. The tape function 111 preferably has the following interface: tape(tape.sub.-- num, RT.sub.-- ITEM, <optional parameters>) tape.sub.-- num is the unique reference number for the particular tape data structure 107 being used to store the RTDI. The parameter tape.sub.-- num implements direct user referencing. Under direct user referencing, the user is given the obligation to directly reference the tape data structure to be used with the tape.sub.-- num parameter, which selection provides a unique reference to a given tape amongst many possible tapes. It is preferable that each tape function 111 used in the open set of spreadsheet files reference a different tape number, even if the function use the same real time data source 115 for the RTDI, or are used in different spreadsheets. This prevents the RTDIs used in one tape function from corrupting the RTDIs used in another tape function call. RT.sub.-- ITEM references a cell that contains the RTDI from the real time data source 115. As can be seen from the above syntax of the tape function 111, it is very easy to use the tape data structure 107 and function 111 in a spreadsheet, and requires no complex programming by the user as with conventional macros. The remaining optional parameters may modify the manner in which the function 111 calculates or returns results. For example, they may instruct that the time values not be returned, or that only various RTDIs in a multi-tape be returned, display the tape in reverse order, or other modifications or controls. The underlying tape data structure 107 used in any tape function 111 need not be completely displayed in the spreadsheet itself. However, such as display of the RTDIs in the tape data structure is useful, for example, for defining a range of data to be used for other functions, and for graphing the RTDIs over time. Thus, a range of cells may be defined in the spreadsheet as the output of a tape function 111 and particular tape data structure 107. When executed in a range of cells, the tape function 111 displays in each of the cells the RTDI value stored in one of the entries in the tape data structure 107 referenced in the tape function call. For example, if a range of ten cells is defined by a range formula: ={TAPE(1,PRICES)} where PRICES references a real time data source 115 of stock market prices for a particular security, and "1" references a first tape data structure 107 stored in memory 103 (e.g. TAPE›1! using the above tape structure definition), then the ten cells will respectively display the first ten entries in the tape data structure 107, and will show the changing values of the security price each time a new price is received from the real time data source 115. When the tape function 111 displays this data in this range of ten cells, it has the appearance of a "ticker tape" that automatically "scrolls" across the spreadsheet range as the RTDIs are received from the real time data source 115, visually appearing like a ticker tape seen in a stock broker's office. Referring now to FIG. 3 there is shown a flowchart of the operation of the tape function 111 within the spreadsheet application 105. For the purposes of explaining FIG. 3, it is assumed that the user has created a spreadsheet in which a tape function 111 is used in at least one cell definition. Generally, spreadsheets are event driven, and execute recalculation of cells in response to changes in cell contents. Thus, the spreadsheet application 105 waits 301 for a spreadsheet event, which in turn triggers 302 recalculation of a spreadsheet cell. Most spreadsheets will construct a tree of cell dependencies by which the spreadsheet application 105 determines whether a cell recalculation 302 is required, as not all cell include formulas dependent on the cells that have changed. Where a formula is to be recalculated 303, the spreadsheet application 105 determines 304 whether a tape function 111 is included in the formula to be recalculated. If not, then the spreadsheet application 105 performs any other function recalculation 305 that is necessary, and displays 306 the results of the recalculated cells, including updating any graphs or plots based on recalculated cells. In the situation of interest, the spreadsheet event that triggers 302 recalculation is the receipt of a new RTDI from the real time data source 115. This RTDI may be disposed into a variety of uses, including here, storage in a tape data structure 107 via a tape function 111. Accordingly, when a cell is checked at 304, then if there is a tape function 111 that references the real time data source 115, this function will need to be recalculated. The tape function 111 is called and executed. The tape function 111 determines which of the tape data structures 107 to operate through the tape number parameter specified in the interface of the tape function 111. The tape function 111 moves 308 all RTDIs in the tape data structure 107 by moving each RTDI in S.sub.j to S.sub.j+1 for all 1.ltoreq.j.ltoreq.N-1. If there is an RTDI in S.sub.N, then this RTDI is overwritten. The tape function 111 further moves 309 each time values T.sub.j into T.sub.j+1 for all 1.ltoreq.j.ltoreq.N-1, overwriting the last time value at T.sub.N. The tape function 111 stores 310 the currently received RTDI into S.sub.1, and stores the current time value into T.sub.1. As noted, each set S.sub.j may include any number of separate RTDIs associated with the particular time value T.sub.j, and so the tape function 111 appropriately handles each of the underlying S.sub.jk RTDIs in S.sub.j. Thus, the tape data structure 107 stores only the most recently received N RTDIs and their associated time values. Once the tape data structure 107 is updated, the tape function 111 returns 312 the tape data structure 107 as an array of cell values to the spreadsheet application 105 for further handling, and if appropriate, display. This may include performing any other functions or graphs on the tape data structure where the results are referenced in some other function or graph definition. For example, if the tape data structure 107 is referenced in a graph definition for a graph of changing RTDI values over time, then the spreadsheet application 105 updates the graph with the current values in the tape data structure 107. Where the RTDIs are being received from the real time data source 115 in a relatively frequent manner (e.g. every few seconds) the spreadsheet application 105 will continually replot the graph, showing the real time changes in the underlying data. FIGS. 5a and 5b illustrate a simple example of the tape data structure 107 and tape function 111. In FIG. 5a there is shown a tape data structure 107 defined to hold a maximum of five tuples of RTDIs and time values, each tuple being stored in a pair of storage locations S.sub.j =(S.sub.j,1, S.sub.j,2) in the memory 103 for the spreadsheet application 105. In this example it is assumed that the tape data structure 107 has already received five such tuples of RTDIs, at times 1, 4, 7, 11, and 15 (for T.sub.1 to T.sub.5) respectively, as shown by the values in the storage locations S.sub.1,1, to S.sub.5,2 of the tape data structure 107. At time 18, a new tuple of RTDIs (0.102196, 9) arrives from the real time data source 115. The tape function 111, when executed by the spreadsheet application 105, moves each of the tuples in storage locations (S.sub.j,1, S.sub.j,2) of RTDI data to the next storage locations (S.sub.j,+1,1 S.sub.j,+1,2) of the tape data structure 107. The time value of (1) in T.sub.5 and the RTDIs in S.sub.5 are overwritten with the values from T.sub.4 and S.sub.4 respectively. The time value of (18) is stored to T.sub.1 and the new RTDIs are stored in S.sub.1, overwriting the previous values. Again, this data and behavior are entirely invisible to the user, occurring internally within a globally defined data structure. The user may decide to make this process visible by defining a range of spreadsheet cells to display the tape data structure 107, but this is not required; this ability to separate the actual underlying data structure from its cell instantiation enables the tape data structure 107 to be flexibly and easily implemented by the user in a variety of different usages, without imposing any complex programming requirements on the user. The tape data structure 107 and tape function 111 thereby provide an easy to use mechanism for transforming real time data into time series data by implementing a time series approach to the data management, whereby historical values of a real time variable are stored in a global tape data structure accessible within the spreadsheet application through the tape function. As discussed above, the time series approach is only one means for handling real time data as time series data. A second approach is the incremental approach, whereby summary information derived from the series of RTDIs is stored and repeatedly updated as new RTDIs are received. The present invention provides an implementation of this approach in the filter data structure 109 and the filter function 113. The filter data structure 109 provides for global storage of summary information derived from a sequence of received RTDIs including a currently received RTDI, and other auxiliary data, such as latency information describing the time elapsed between the current RTDI and the last received RTDI. From this global information the filter function 113 computes a current output of the filter, and updates the various data items stored in the filter data structure 109. Thus, the filter data structure 109 is similar in nature to the tape data structure 107, but instead of storing a large number of RTDI values and times, it condenses the data down to a smaller amount which is sufficient for a specific computational purpose. As with the tape data structure 107, the spreadsheet application 105 preferably reserves memory for a useful number of filter data structures 109, such as 256 of these, each one referenced by direct user referencing with a unique filter number. These individual filter data structures 109 enable the user to define multiple different types of filters within a spreadsheet. The interface of the filter function 113 is generally the same as the tape function 111, and has the form: filter.sub.-- name(filter.sub.-- num, RT.sub.-- ITEM, <other possible optional parameters>) where filter-name specifies the name a particular filter function 113, filter.sub.-- num specifies a filter number identifying a unique filter data structure 109 within the memory partition of the spreadsheet application 105 for storing the data for the filter function 113, and RT.sub.-- ITEM specifies the real time data source 115 providing the RTDIs for the function. In the preferred embodiment, there are a variety of different filter functions 113, each having a unique identifying name. A set of filter functions 113 usefully adapted to financial analysis, including their parameters and usage is listed in the List of Supported Functions, below. Exemplary include filter functions 113 are listed in Table
TABLE 1
______________________________________
Example Filter Functions
______________________________________
adaptive Returns prediction-error-minimizing forecase of next RTDI.
Kalman
ARCH/GARCH
Returns the (generalized) autoregressive conditional
heteroscedaskicity forecast of the next RTDI.
average Returns the arithmetic mean of a sequence of a RTDIs
average.sub.-- t
Returns the time-weighted arithmetic mean of
a sequence of RTDIs.
count Counts the number of values in a sequence of RTDIs.
difference
Returns the difference between a current RTDI
and a prior RTDI.
maximum Returns the maximum RTDI in a sequence of RTDIs.
minimum Returns the minimum RTDI in a sequence of RTDIs.
drift Returns the drift of the values in a sequence of RTDIs.
std. deviation
Returns the standard deviation of a sequence
of RTDIs.
volatility
Returns the volatility of a sequence of RTDIs.
sign Returns the sign of the difference between a current
RTDI and a previous RTDI.
smooth Returns the exponentially weighted moving average
of a sequence of RTDIs.
sample std.
Returns the sample standard deviation of a sequence of
deviation.
RTDIs.
sample std.
Returns the time weighted sample standard deviation
deviation.sub.-- t
of a sequence of RTDIs.
sum Return the sum of a sequence of RTDIs
trim Returns the trimmed value of an RTDI using absolute,
percentage, or other limits.
______________________________________
This list is not exhaustive, and many other types of filter functions 113 will be apparent to those of skill in the art. In this context, and more generally, the tape function 111 and tape data structure 107 may be understood as a special case of the more general concept of a filter function 113 and filter data structure 109, whereby the tape function 111 tape() returns an array of RTDI values and corresponding update times. For each of these and other operations on series of real time data there is a determinate "filter" equivalent formula which computes the current value of the function using the current value of an RTDI, a previously computed filter output value, and for a time dependent function, a latency between the currently received RTDI, and a previously received RTDI. For example, the time series formula for a time-weighted average function, is: ##EQU3## where S.sub.0, S.sub.1, . . . S.sub.N are the RTDIs received from a real time data source 115 at respective time values T.sub.0, T.sub.1, . . . T.sub.N. This equation can be reduced to its filter equivalent form: ##EQU4## which is used by the filter function 113 average.sub.-- t(). Here it is clear that only five items of data need to be stored in the filter data structure 109 for this filter function 113: 1) the previously computed filter output A.sub.N-1 ; 2) the time T.sub.N-1 of the last received RTDI in S.sub.N-1 ; 3) the last received RTDI in S.sub.N-1 ; 4) the time T.sub.0 of the first RTDI in S.sub.0 ; and 5) the current RTDI in S.sub.N which will be used on the next iteration. This stored data is then used in conjunction with the time T.sub.N of this RTDI to compute the current filter output. As each new RTDI is received, the new filter function 113 computes the new output value, and stores it and the appropriate data items into the filter data structure 109. A C-style pseudo code declaration for filter data structure 109 for an implementation of this filter function 113 for time weighted average may then be:
______________________________________
typedef struct {
time.sub.-- t old.sub.-- time;
/*last received time T(N-1)*/
time.sub.-- t start.sub.-- time;
/*start time T(0)*/
double old.sub.-- rtdi; /*last rec'd RTDI in S(N-1)*/
double new.sub.-- rtdi; /*current RTDI in S(N)*/
double A; /*last computed output*/
} FILTER.sub.-- AVER.sub.-- T;
______________________________________
Once the new output of the filter function 113 is computed, it is stored to the output variable A, and the time of current RTDI is stored to old.sub.-- time. In the preferred embodiment, the spreadsheet application 105 supports a large number of the different filter functions 113, such as those listed above. Each filter function 113 will have its own particular filter equivalent form and data required for computation, as exemplarily described in the List of Supported Functions. Generally the data required by a filter function 113 is the currently received RTDI and the last output of the filter function 113. Auxiliary data varies according to the filter function 113 and may include: an initial RTDI value, and initial time value, a value type, a minimum delay or latency value, a decay factor, a difference limit, an upper or lower limit value, and a limit type (absolute or percentage). Other auxiliary data will be apparent to those of skill in the art as called for by the filter equivalent formulations underlying the filter functions 113. Preferably then given the various types of data used in the plurality of filter functions 113, the actual filter data structure 109 is defined as the UNION of all such filter data types. Most individual of the data types for individual filter functions 113 may be implemented with less than a dozen variables. Continuing the above example, the time weighted average filter function 113 would have the following interface: AVERAGE.sub.-- T(filter.sub.-- num, RT.sub.-- ITEM,initial.sub.-- value, initial.sub.-- time) Here, the underlying filter data structure 109 is uniquely referenced by filter.sub.-- num, which contains the data types defined in the above data structure definition. Each time the spreadsheet application 105 receives an RTDI, there is triggered the recomputation of the filter output and subsequent updating specific filter data. Referring now to FIG. 4 there is shown a flowchart of the general operation of a filter function 113 within the spreadsheet application 105. For the purposes of explaining FIG. 4, it is assumed that the user has created a spreadsheet in which a filter function 113 is used in a cell definition, such as a cell defining an average filter, to average a sequence of RTDIs. As described above with respect to the tape function 111, the spreadsheet application 105 waits 401 for a spreadsheet event, which in turn triggers 402 recalculation of a spreadsheet cell. Most spreadsheets will construct a tree of cell dependencies by which the spreadsheet application 105 determines whether cell recalculation 402 is required, as not all cells include formulas dependent on the cells that have changed. Where such a formula is to be recalculated 403, the spreadsheet application 105 determines 404 whether a filter function 113 is included in the formula to be recalculated. If not, then the spreadsheet application 105 performs any other function recalculation 405 that is necessary, and displays 406 the results of the recalculated cells, including updating any graphs or plots based on recalculated cells. In the situation of interest, the spreadsheet event that triggered 402 recalculation is the receipt of a new RTDI from the real time data source 115. This RTDI may be disposed into a variety of uses, including here, storage in a filter data structure 109 via a filter function 113. Accordingly, when a cell is checked at 404, then if there is a filter function 113 that references the real time data source 115, this filter function 113 will need to be recalculated. The filter function 113 is called and executed. The filter function 113 determines which of the filter data structures 109 to operate on through the filter number parameter specified in its interface. The filter function 113 computes 407 a new filter output based on the currently received RTDI, the previous filter output, and any other auxiliary data specific to the filter function 113, such as the time value for the current or previous RTDI, the time of the first RTDI, and so forth. The particular algorithmic implementation of a given filter function 113 can be determined by those of skill in the art from its filter equivalent formulation, as exemplified above with respect to time weighted average function, and thus is not detailed here. The filter function 113 updates 408 the filter data structure 109 with the current value of the RTDI, the current filter output, and any necessary auxiliary data. The filter function 113 returns 409 the current value of the filter output to the spreadsheet cell, and the spreadsheet application 105 performs 405 any other function recalculation and displays 406 the updated cells. Again, the spreadsheet application 105 may update a graph or other computation based on the filter output, and display this result, thereby providing a continually updated graph or computation based on the filtered output of the real time data source 115. In summary then, the tape and filter data structure and functions provide for the transformation of real time data items from a sequence of real time data items individually received over time within the spreadsheet itself, to globally available time series data, particularly through the storage of real time data items as time series data in the tape data structure via the tape function, and as summary, incremental data through the filter data structure and filter functions. List of Supported Functions Description of FEA Real-Time Filterpak FEA Real-Time Filterpak is a set of spreadsheet add-in functions, templates, and utilities that display real-time time data in "ticker tape" fashion and calculate real-time statistics. With FEA Real-Time Filterpak you can use real-time spreadsheet data links to monitor and control financial applications. As an example, suppose you have real-time data items representing the prices of various securities arriving into spreadsheet cells. You may be interested in calculating some standardized transformations of the data, for example, the volatility or drift of a sequence of prices. Alternatively, you may wish to know something as simple as which direction prices have moved since the prior price, or something as complex as your own proprietary definition of "price pressure," a calculated combination of price movements, trade volume, and time delays (or latencies). All FEA Real-Time Filterpak results are displayed in a spreadsheet as either single-cell entries or as arrays. These results can be used like any other spreadsheet data. FEA Real-Time Filterpak includes templates, a dynamic link library (XLL), utilities, and on-line documentation. Functions are provided that accept a real-time input and display a "ticker tape" array of the input with corresponding update times. Other functions calculate real-time statistics such as volatility, drift, standard deviation, moving average, difference, minimum, and maximum. To learn more about using FEA Real-Time Filterpak, see the Tutorial. Filters A filter is a calculation whose input is a time sequence of real-time data, and whose output is another such sequence. Since filters are intended to operate in real time, their current output value is the result of calculations which are applied to the current input value and possibly to prior input values. In other words, filters may be aware of what input data they have seen in the past (even though such past data may not be displayed anywhere in the spreadsheet). They are also aware of the latency, or elapsed time period, since they saw this past data. By using the past input data and latencies they have encountered, filters may modify the way in which they transform current input. Implementation of Filters in FEA Real-Time Filterpak The FEA Real-Time Filterpak filters are implemented as spreadsheet add-in functions. The function arguments are generally a filter number, a reference to a real-time data item, and possibly other parameters. For example, the RTPRICEVOL function calculates the price volatility of a stream of a single real-time data item coming to it as one of the function arguments. The other function arguments represent parameters which may direct the function regarding alternative methods of proceeding with the calculation. The real-time data item maybe a reference to any cell in the spreadsheet. Consequently, filters maybe cascaded, so that the filter output to a cell in the spreadsheet becomes the real-time data item for another filter. Filter Numbers Normally, all the data in a spreadsheet appears within the spreadsheet cells. By contrast, filters store their data "behind the spreadsheet" in special global data structures. These data structures are organized and referenced directly by you via the filter numbers. Filter-related global data is kept organized by you through providing appropriate filter numbers. That is, the global data belonging to a filter is associated only with that filter number. Therefore, except in special circumstances, multiple filter functions within a single spreadsheet should generally not reference the same filter number, as the results may become unpredictable. This is because each function invocation will attempt to save its own global data into the filter, giving rise to usage conflicts. Organizing Filter Numbers The first argument of all the FEA Real-Time Filterpak functions except RTTAPE is filter.sub.-- num. This argument is a number specifying the filter number and is an (arbitrary) integer between 0 and 255, inclusive. It uniquely identifies a global memory location where the function stores global data and should be different for each FEA Real-Time Filterpak function usage, even if the functions are contained in the same cell, refer to the same rt.sub.-- data.sub.-- item, or are on different open spreadsheet files. This means you can have a maximum of 256 filter usages present in all open spreadsheet files, including spreadsheet files in different spreadsheet application sessions. Organize your spreadsheet so that each filter function call references only a single filter number. It is suggested that you employ filters in numerical order, i.e., 0 first, 1 next, and so on. To clear the global data associated with all the filter numbers, exit all sessions of Microsoft Excel. Tip: Good programming practice usually means that all filter numbers be constants. (If the filter number is changed, new global data is referenced, so previous results are no longer updated.) Sophisticated users who deal with multiple open spreadsheet files may find that the best form of filter number reference is base+constant, where base is a single-cell reference, so that the cell contents may be changed to quickly remove multiple-sheet filter number conflicts. Tapes Tapes are special forms of filters, namely filters which do not perform any special data reduction, but merely retain a large number of past values and latencies in their original form. In order that these past values and latencies can be made available for spreadsheet calculations, tapes also differ by returning an array range of values instead of single cells. Standard tapes internally contain 256 pairs of real-time data values, or ticks, and corresponding updates times (so latencies are actually the differences of successive update times). Where tape values are displayed in spreadsheet ranges, you may display any number of the 256 pairs in the cells of the chosen range. As new real-time data values arrive, the tape range will appear to scroll, giving the appearance of a common "ticker tape" such as seen in your stockbroker's office, hence the name "tape." Tapes are used by RTTAPE. Tapes are useful for real-time dynamic charts and performing custom (i.e., user-defined) filter transformation. For example, you could easily implement a thirty-tick "moving average" calculation. Dynamic Data Exchange (DDE) Dynamic data exchange (DDE) is a mechanism supported by the Microsoft Windows operating system that allows two applications to "talk" to each other by continuously and automatically exchanging data. DDE is supported by most Windows real-time data and productivity applications. DDE Conversations Two applications exchange information by engaging in a DDE conversation. The application that initiates the conversation is called the destination application, or just the destination; the application responding to the destination is the source application, or just the source. An application can engage in several conversations at the same time, acting as the destination in some and source in others. There is nothing special about an application that makes it a destination or source; these are simply roles an application can adopt. When a destination application begins a DDE application, it must specify the following: The name of the source application with which it will talk. The subject of the conversation, called the topic. When a source application receives a request for a conversation it recognizes, it responds, and a conversation is started. Once established, a conversation cannot change applications or topics. The combination of application and topic uniquely identifies the conversation, and it remains constant for the duration of the conversation. If either the destination or source changes the application or topic, the conversation is ended. During the conversation, the destination and source may exchange information concerning one or more items. Items are references to the data that are meaningful to both applications. Either the destination or the source can change the item without affecting the state of the conversation. Application Name Every application that can be a DDE source has a unique application name. Usually this is the executable filename without an extension. When performing DDE, the application name is not case-sensitive. Topic The topic defines the subject of the DDE conversation and is usually some unit of data that is meaningful to the source application. As with the application name, the topic for a DDE conversation is not case-sensitive. Many applications that perform DDE support a topic called "System." You can use this topic to request information from the application (for example, the other topics it supports). Check the documentation for the application to see if it supports this topic. Item The item identifies the piece of data actually being passed during the DDE conversation. As with the application name and topic, the item for a DDE conversation is not case-sensitive. Further Reading For technical information on DDE see the Programmer's Guides for Microsoft Visual Basic, Microsoft Visual C++, or any of the Microsoft operating systems. DDE Links in Microsoft Excel In the context of FEA Real-Time Filterpak, the DDE source application is a real-time data application, such as those on the Reuter Terminal or Telerate Workstation, and the destination application is Microsoft Excel. Types of DDE Links A DDE conversation is often called a link because the two applications in the conversation are linked by the data they are exchanging. This link between applications is a "channel" through which data flows. In Microsoft Excel there are two kinds of links, distinguished by how the source updates the destination when data in the source changes: Automatic link--The real-time data source supplies data to Microsoft Excel every time the data changes. Manual link--The real-time data source supplies data only when Microsoft Excel requests it. Generally, all Microsoft Excel DDE links to real-time data source applications should be automatic links. Remote Reference Formulas You create DDE links between the real-time source application and Microsoft Excel by entering a remote reference formula into an Excel worksheet cell. A remote reference formula takes the form: =APPLICATION.sub.-- NAME I TOPIC.sub.-- NAME | ITEM APPLICATION.sub.-- NAME is the application name. TOPIC.sub.-- NAME is the topic. ITEM is the item. If ITEM contains blanks, commas, or other delimiters, then surround the entire item with single quotes. The source application name is separated from the topic by a vertical bar or "pipe" character "I" (character code 124). The topic is separated from the item by an exclamation point character "|". Do not insert spaces adjacent to the separator characters. See the source application's documentation for these values. Here are sample values for some source applications: Reuter Terminal Application: REUTER Topic: IDN Example Excel Formula: =REUTERIIDN|`DEM=,BID` Telerate Workstation Application: TWINDDE Topic: ITEMS or QUOTES (depending on the type of instrument requested) Example Excel Formula: =TWINDDEIITEMS|`DEM LAST` FEA TICKER Application: TICKER Topic: TICK Example Excel Formula: =TICKERITICK|PRICE Most real-time applications come with utilities that make it easy to create DDE links in Microsoft Excel. Contact your real-time data vendor for maximum number of DDE links permitted in a spreadsheet. Controlling Calculation in Microsoft Excel Calculation is the process of computing formulas and then displaying the results as values in the cells that contain the formulas. FEA Real-Time Filterpak functions are intended to be used in Automatic calculation mode. To set calculation to Automatic, choose Options (Tools menu), click the Calculation tab, under Calculation select Automatic. Microsoft Excel only calculates in "Ready" mode. The left side of the status bar displays the current mode. (The status bar is located at the bottom of the Microsoft Excel window; if it is not displayed, choose Options (Tools menu), click the View Tab, under Show select Status Bar.) Microsoft Excel will not calculate while 1) in "Enter" mode, that is, you have started typing in a cell, 2) in "Edit" mode, that is, you have pressed F2 or clicked in the formula bar, or 3) a modal dialog box is displayed, that is, you have chosen a menu command followed by an ellipsis ". . . ". Since Microsoft Excel cannot receive real-time data during these situations, you will lose real-time data updates that occur during these situations. Controlling DDE Link Behavior in Microsoft Excel Typically there are multiple DDE links between the source and Microsoft Excel. You can control each link in your workbook individually. Choose Links (Edit menu) to display the Links dialog box, which lists every link that exists on the currently active sheet in the workbook. All links from real-time source applications should be set to automatic updating (the default). Microsoft Excel updates automatic links when you open the workbook and when the source application changes while the workbook is open. (Manual links update only when you choose Links (Edit menu) and click Update Now.) To make Microsoft Excel update links automatically, choose Options (Tools menu), click the Calculation Tab, and then select the Update Remote References check box. If this check box is cleared, Microsoft Excel will not update your real-time references, it will only display the last values received by the source application. This option affects only the active workbook. Clearing this check box overrides automatic updating set for individual links in the Links dialog box. To see a message each time before linked items are updated automatically, choose Options (Tools menu), click the Edit tab, and then select the Ask To Update Automatic Links check box. When the spreadsheet you're opening contains automatic links Microsoft Excel displays the message "This document contains links. Re-establish links?" Click Yes to update the linked data with the most current data. (Clicking No keeps the current linked data.) If you open a spreadsheet containing linked items and the source application is not running then Microsoft Excel displays the message "Remote data not accessible. Start application ›app.sub.-- name!?" where ›app.sub.-- name! is the name of the source application. Click Yes to start the source application. If Microsoft Excel cannot find ›app.sub.-- name! it will display an error message and you will have to start it manually. To save copies of values contained in linked cells in the spreadsheet, choose Options (Tools menu), click the Calculation tab, and then select the Save External Link Values check box. Depending on the number of links, this may increase the disk space and time needed to open the spreadsheet. Further Reading For detailed information about using DDE in Microsoft Excel, see the following books: Microsoft ExcelNisual Basic for Windows 95 Programmer's Guide (Microsoft Press, 1995), ISBN 1-55615-819-X Developing Microsoft Excel Solutions, 2nd ed., by Eric Wells (Microsoft Press, 1995), ISBN 1-55615-893-9 Troublesome Data The values of real-time data items must be numeric for all FEA Real-Time Filterpak functions except RTCOUNT. Some functions, such as RTPRICEVOL, have the further restriction that all the values must be greater than zero. Occasionally, a non-numeric value (e.g., 123A5) or invalid value (e.g., a negative price) may be sent by your real-time data source application. FEA Real-Time Filterpak functions ignore illegal values--the functions do not update the global memory location containing latency and other data. In other words, FEA Real-Time Filterpak functions treat unacceptable real-time data values as if they had never occurred. Another type of error is an order-of-magnitude error. Your real-time data source application may send a value that is vastly different from the previous value (with respect to its volatility). For example, a low-volatility stock ticks up from 1 to 11.25. While infrequent, such movements are possible and are interpreted by FEA Real-Time Filterpak functions as valid real-time data values and calculations proceed normally. However, some functions, such as RTPRICEVOL, have parameters which can be used to "clip" the amount of output change which will be permitted. These order-of-magnitude errors can usually be attributed to a keypunch error by the real-time data contributor. For example, in the example above, the real price of the stock was probably meant to be 1.125, not 11.25. There are several ways you can detect these errors. For example, you can use RTCOUNT to count the number of non-numeric real-time data values or values greater than or equal to zero. You can search for statistical outliers by charting the values returned by RTTAPE, or use RTMIN and RTMAX to find the smallest and largest values, respectively, of a real-time data stream. Or, you can use RTTRIM to exclude outlying data from your analysis. Tutorial This section gives a brief tutorial on FEA Real-Time Filterpak. After installation, to start using FEA Real-Time Filterpak, perform the following steps: 1. Start the TICKER program. 2. Open the FEA Real-Time Filterpak template rtfilt.xls. 3. Load the FEA Real-Time Filterpak add-in rtfilt›32!.xll. 4. Observe the real-time calculations. 1. Start the TICKER program TICKER is a Microsoft Windows program that generates a series of simulated real-time prices based on user-specified parameters. The prices are log normally distributed and the arrival times of those prices are exponentially distributed. Start TICKER by double-clicking the TICKER icon in the FEA Real-Time Filterpak program group that was created when you installed FEA Real-Time Filterpak. The Input Parameters determine how prices are generated, you can experiment with them later but don't change them now. Click Start--the PRICE item changes from red to green to indicate that prices are being generated. 2. Open the FEA Real-Time Filterpak template rtfilt.xls FEA Real-Time Filterpak includes a sample spreadsheet names rtfilt.xls. It contains all the FEA Real-Time Filterpak function calls and provides a logical layout. To open the sample template, double-click the FEA Real-Time Filterpak icon in the FEA Real-Time Filterpak program group. Alternatively, start Microsoft Excel and choose Open (File menu). The sample spreadsheet is located in the directory in which you installed FEA Real-Time Filterpak. When you open the sample template, Microsoft Excel may prompt you "This document contains links. Re-establish links?" Click Yes and the cells containing real-time DDE links to TICKER will start updating with the most current data. 3. Load the FEA Real-Time Filterpak add-in rtfilt›32!.xll Add-ins are files that can be installed to add commands and functions to your spreadsheet. The FEA Real-Time Filterpak add-in is in the directory you where installed FEA Real-Time Filterpak. If you are using Microsoft Excel 5.0 (16-bit), the add-in is rtfilt.xll. If you are using Microsoft Excel 7.0 or higher (32-bit), the add-in is rtfilt32.xll. You can find out which version of Microsoft Excel you are using by choosing About (Help menu). To load the FEA Real-Time Filterpak add-in into Microsoft Excel, choose Add-ins (Tools menu), then in the Add-ins Available box, select the check box next to the FEA Real-Time Filterpak add-in. If the FEA Real-Time Filterpak add-in is not listed, click Browse to locate it. 4. Observe the real-time calculations If everything is operating correctly, you should see data and charts changing as TICKER sends real-time data into the spreadsheet cells. About Spreadsheet Functions Spreadsheet functions perform value-returning operations in spreadsheets automatically and return their results in a single cell or a rectangular array of cells. The functions included with FEA Real-Time Filterpak require you to install the add-in before you can use the add-in functions; see your spreadsheet's User's Guide or on-line help for information on installing or removing an add-in. Conventions In the syntax line, required arguments are bold and optional arguments are in plain text (not bold). Argument names usually use underline characters between words; for example filter.sub.-- num is an argument name. Functions are shown without the equal sign (=). Remember to type an equal sign at the beginning of every formula, but not before functions in nested formulas. Syntax of Functions When you type a function and enter it into a cell, you must use proper function syntax, that is, the sequence of characters used to enter a valid function. Every function description includes a syntax line, for example: FUNCTIONNAME(arg1, arg2, arg3) In the syntax line, the required arguments are bold; optional arguments are not bold. If you do not provide required arguments to a function, you will not be able to enter the function in a cell. In the preceding example, the arguments arg1 and arg2 are bold and therefore required. Arg3 is not bold and therefore is optional, so either of the following is allowed (assume arg1 is a string argument and arg2 and arg3 are numeric arguments): FUNCTIONNAME("some text", 10, 3.14159) FUNCTIONNAME("some text", 10) However, FUNCTIONNAME("some text"), FUNCTIONNAME(,10), and FUNCTIONNAME() are not allowed because both arg1 and arg2 are required arguments. Arguments Arguments to a function can be any of the following: Numbers Examples of numbers are 0, 622.1962, 0.005, and -40.002. Numbers without trailing decimals are called integers. Examples of integers are 0, 622, and -40. Text Examples of text are "a", "Chris", "123", or "". Text, or string, values used in formulas must be enclosed in double quotation marks. A text constant that contains no characters is written as "" and is called empty text or a zero-length string. Logical values The logical values are TRUE and FALSE. Logical arguments can also be statements that evaluate to TRUE or FALSE. References Examples of references are $A$1, A1, $A1, A$1, or $A$1:$F$33 References can refer to single cells or ranges. When you use a reference as an argument that is supposed to be a number, text, or logical value, the contents of the cells specified by the reference are used as the argument. Arrays Arrays can be used as arguments (e.g., {1,2,3}), and formulas can be entered as array formulas. See Array Formulas below for more information. Using the Function Wizard In Microsoft Excel, the Function Wizard is an interactive set of dialog boxes that guide you through the steps of choosing the function and arguments to use in your formula. To start the Function Wizard, choose Function (Insert menu). The first Function Wizard dialog box contains a list of function categories, such as Financial and Logical, and a list of functions, such as COUNT and SUM. The functions are in the category FEA Functions. (This dialog is skipped in the active cell already contains a function.) In the second dialog box, you describe the function argument values. Array Formulas Some functions are entered as array formula. Array formulas produce more than one result and so their output occupies several spreadsheet cells. Therefore, array formulas return an array range, which is a rectangular range of cells that share a common formula. Because an array range shares one formula, you must edit an array range differently from ordinary cells. When you edit an array range, you edit the entire range at once as if it were a single cell. You cannot perform any operation that modifies only a portion of the array range, such as: Change the contents of cells that are a part of an array. Clear, move, or delete cells that are part of an array. Insert cells into an array range. If you attempt any of these operations, your spreadsheet displays a message that tells you the operation cannot be done for an array. You can, however, format individual cells in an array range and copy and paste all or part of an array range to another part of the spreadsheet. Editing Array Formulas in Microsoft Excel This following instructions describe how to enter, edit, clear, and select array formulas and ranges in Microsoft Excel. To enter an array formula 1. Select the cell or range of cells in which you want to enter the formula. 2. Enter the formula. Microsoft Excel adds braces when you enter the formula as an array; do not type braces around the formula. If you do, Microsoft Excel interprets the entry as text. 3. Press CTRL+SHIFT+ENTER. You must hold down both the CTRL and SHIFT keys when you press ENTER. If you hold down only the SHIFT key, the formula is entered as an ordinary formula in the active cell. If you hold down only the CTRL key, the formula is entered as an ordinary formula in all the selected cells. To edit an array formula 1. Select any cell in the array range. 2. Activate the formula bar. The array formula braces disappear when the formula bar is active. 3. Edit the formula. 4. Press CTRL+SHIFT+ENTER. To clear an array range 1. Select the array range. 2. Press DEL (or choose Clear (Edit menu), and then choose Contents). To select an array range 1. Select any cell in the array range. 2. Press CTRL+/.
______________________________________
FEA Real-Time Filterpak Functions
______________________________________
RTAVERAGE Returns the arithmetic mean of a real-time variable.
RTAVERAGET
Returns the time-weighted arithmetic mean of a
real-time variable.
RTCOUNT Counts the number of values of a real-time variable.
RTDIFF Returns the difference between the current value of
a real-time variable and its prior value.
RTMAX Returns the maximum of a real-time variable.
RTMIN Returns the minimum of a real-time variable.
RTPRICEDRIFT
Returns the price drift of a real-time variable.
RTPRICESTDEV
Returns the price standard deviation of a
real-time variable.
RTPRICEVOL
Returns the price volatility of a real-time variable.
RTSIGN Returns the sign (-1, 0, 1) of the difference between
the current value of a real-time variable
and its prior value.
RTSMOOTH Returns the exponentially-weighted moving average
of a real-time variable.
RTSTDEV Returns the sample standard deviation of a
real-time variable.
RTSTDEVT Returns the time-weighted standard deviation of a
real-time variable.
RTSUM Returns the sum of the values of a real-time variable.
RTTAPE Returns an array of real-time variable values and
corresponding update times.
RTTRIM Returns the trimmed values of a real-time variable.
RTVERSION Returns the version of the current FEA Real-Time
Filterpak add-in, as text.
______________________________________
RTAVERAGE Returns the arithmetic mean of a real-time variable. Syntax RTAVERAGE(filter.sub.-- num, rt.sub.-- data.sub.-- item) filter.sub.-- num is a number specifying the filter number and is an integer between 0 and 255, inclusive. The filter number uniquely identifies a global memory location where the function stores cumulative results and must be different for each FEA Real-Time Filterpak function usage, even if the functions are contained in the same cell, refer to the same rt.sub.-- data.sub.-- item, or are in different open spreadsheet files. filter.sub.-- num should be a constant. If the filter number is changed, new global data is referenced. rt.sub.-- data.sub.-- item is a reference to a cell containing a numeric real-time data item. Remarks Latency is not used in calculations. filter.sub.-- num is truncated to an integer. The equation for the arithmetic mean is: ##EQU5## EXAMPLES If cell A1 contains a real-time data item with the values:
______________________________________
Value Arrival time (sec.)
______________________________________
10 0
9 1
11 4
12 8
11 9
RTAVERAGE(0, A1) equals 10.6
______________________________________
RTAVERAGET Returns the time-weighted arithmetic mean of a real-time variable. Syntax RTAVERAGET(filter.sub.-- num, rt.sub.-- data.sub.-- item, initial.sub.-- value, initial.sub.-- time) filter.sub.-- num is a number specifying the filter number and is an integer between 0 and 255, inclusive. The filter number uniquely identifies a global memory location where the function stores cumulative results and must be different for each FEA Real-Time Filterpak function usage, even if the functions are contained in the same cell, refer to the same rt.sub.-- data.sub.-- item, or are in different open spreadsheet files. filter.sub.-- num should be a constant. If the filter number is changed, new global data is referenced. rt.sub.-- data.sub.-- item is a reference to a cell containing a numeric real-time data item. initial.sub.-- value is a number specifying the prior value of the time-weighted average, i.e., before the first invocation of the function. If initial.sub.-- value is omitted then no prior value is used. initial.sub.-- time is a number specifying the time period in seconds over which initial.sub.-- value was evaluated. This becomes the weight in the subsequent time-weighted average. If initial.sub.-- time is omitted or 0 (zero) then no initial value is used. Remarks Latency is used in calculations. filter.sub.-- num is truncated to an integer. Specify initial.sub.-- value and initial.sub.-- time to include a previously observed average or influential observation in the results. RTAVERAGET creates a time-weighted average of the rt.sub.-- data.sub.-- item values. This average spans the time period from the first rt.sub.-- data.sub.-- item update to the most current update. The equation for the time-weighted arithmetic mean is: ##EQU6## where x(i) is the value of rt.sub.-- data.sub.-- item at time t(i), and .DELTA.t(i) is the time elapsed between updates i and i -1. EXAMPLES If cell A1 contains a real-time data item with the values:
______________________________________
Value Arrival time (sec.)
______________________________________
10 0
9 1
11 4
12 8
11 9
RTAVERAGET(0, A1) equals 10.33
______________________________________
RTCOUNT Counts the number of values of a real-time variable. Syntax RTCOUNT(filter.sub.-- num, rt.sub.-- data.sub.-- item, value.sub.-- type) filter.sub.-- num is a number specifying the filter number and is an integer between 0 and 255, inclusive. The filter number uniquely identifies a global memory location where the function stores cumulative results and must be different for each FEA Real-Time Filterpak function usage, even if the functions are contained in the same cell, refer to the same rt.sub.-- data.sub.-- item, or are in different open spreadsheet files. filter.sub.-- num should be a constant. If the filter number is changed, new global data is referenced. rt.sub.-- data.sub.-- item is a reference to a cell containing a text or numeric real-time data item. value.sub.-- type is a number specifying the type of values to count.
______________________________________
value.sub.-- type
Count these values
______________________________________
0 or omitted
All values (text and numeric).
1 All numeric values.
2 All numeric values >= 0.
3 All numeric values > 0.
4 Text values, i.e., values that could not be converted
into numbers.
______________________________________
Remarks Latency is not used in calculations. filter.sub.-- num and value.sub.-- type are truncated to integers. Set value.sub.-- type to 4 to determine if your real-time feed has updated with non-numeric values. All non-numeric values are ignored by FEA Real-Time Filterpak functions that require numeric input. To count the number of Microsoft Excel error values (#N/A, #VALUE|, #DIV/0|, etc.) returned by a real-time variable use the ISERROR worksheet function to convert the error value into a text value (say, "error"), then use RTCOUNT with value.sub.-- type equal to 4. EXAMPLES If cell A1 contains a real-time data item with the values:
______________________________________
Value Arrival time (sec.)
______________________________________
1 0
2 1
0 3
A 4
-1 6
0 8
1 12
RTCOUNT(0, A1, 0) equals 7
RTCOUNT(1, A1, 1) equals 6
RTCOUNT(2, A1, 2) equals 5
RTCOUNT(3, A1, 3) equals 3
RTCOUNT(4, A1, 4) equals 1
______________________________________
RTDIFF Returns the difference between the current value of a real-time variable and its prior value. Syntax RTDIFF(filter.sub.-- num, rt.sub.-- data.sub.-- item, delay) filter.sub.-- num is a number specifying the filter number and is an integer between 0 and 255, inclusive. The filter number uniquely identifies a global memory location where the function stores cumulative results and must be different for each FEA Real-Time Filterpak function usage, even if the functions are contained in the same cell, refer to the same rt.sub.-- data.sub.-- item, or are in different open spreadsheet files. filter.sub.-- num should be a constant. If the filter number is changed, new global data is referenced. rt.sub.-- data.sub.-- item is a reference to a cell containing a numeric real-time data item. delay is the minimum required latency in seconds since the prior arrival of rt.sub.-- data.sub.-- item. If delay is zero or less, then no minimum latency is required. If delay is positive, then at least an integral number of seconds not less than delay must have passed for the new difference to be returned, otherwise the prior value will be returned. If delay is omitted then zero is used. Remarks Latency is used in calculations if delay is positive. filter.sub.-- num is truncated to an integer. delay is rounded up to the nearest integer. A negative result means rt.sub.-- data.sub.-- item has declined since its previous value, a positive result means it has increased, and a zero result means there has been no change. When rt.sub.-- data.sub.-- item is updated with a new value, RTDIFF returns the difference between that new value and its prior value. However, if fewer than delay seconds have passed since the last rt.sub.-- data.sub.-- item update, no action occurs; in fact any number of such new updates may occur within the minimum delay period and all will be ignored, so RTDIFF will not change. The first update which occurs after the minimum delay period has passed will be differenced with the value which was seen at least delay seconds ago, and this difference is returned by the function. If no minimum delay time is desired, delay should be set to zero. In this case, RTDIFF will return differences of all successive rt.sub.-- data.sub.-- item values. You can nest RTDIFF to find second, third, and higher-order differences. Be sure to use a separate filter number for each. For example, RTDIFF(1, RTDIFF(0, A1)) returns the second-order differences of a real-time data item in cell A1. EXAMPLES If cell A1 contains a real-time data item with the values:
______________________________________
Value Arrival time (sec.)
______________________________________
10 0
9 1
11 4
12 8
11 9
RTDIFF(0, A1, 0) equals -1 (=11-12)
RTDIFF(1, A1, 3) equals 0 (=11-11)
RTDIFF(2, A1, 6) equals 2 (=11-9)
______________________________________
RTMAX Returns the maximum value of a real-time variable. Syntax RTMAX(filter.sub.-- num, rt.sub.-- data.sub.-- item) filter.sub.-- num is a number specifying the filter number and is an integer between 0 and 255, inclusive. The filter number uniquely identifies a global memory location where the function stores cumulative results and must be different for each FEA Real-Time Filterpak function usage, even if the functions are contained in the same cell, refer to the same rt.sub.-- data.sub.-- item, or are in different open spreadsheet files. filter.sub.-- num should be a constant. If the filter number is changed, new global data is referenced. rt.sub.-- data.sub.-- item is a reference to a cell containing a numeric real-time data item. Remarks Latency is not used in calculations. filter.sub.-- num is truncated to an integer. EXAMPLES If cell A1 contains a real-time data item with the values:
______________________________________
Value Arrival time (sec.)
______________________________________
10 0
9 1
11 4
12 8
11 9
RTMAX(0, A1) equals 12
______________________________________
RTMIN Returns the minimum value of a real-time variable. Syntax RTMIN(filter.sub.-- num, rt.sub.-- data.sub.-- item) filter.sub.-- num is a number specifying the filter number and is an integer between 0 and 255, inclusive. The filter number uniquely identifies a global memory location where the function stores cumulative results and must be different for each FEA Real-Time Filterpak function usage, even if the functions are contained in the same cell, refer to the same rt.sub.-- data.sub.-- item, or are in different open spreadsheet files. filter.sub.-- num should be a constant. If the filter number is changed, new global data is referenced. rt.sub.-- data.sub.-- item is a reference to a cell containing a numeric real-time data item. Remarks Latency is not used in calculations. filter.sub.-- num is truncated to an integer. EXAMPLES If cell A1 contains a real-time data item with the values:
______________________________________
Value Arrival time (sec.)
______________________________________
10 0
9 1
11 4
12 8
11 9
RTMIN(0, A1) equals 9
______________________________________
RTPRICEDRIFT Returns the price drift of a real-time variable. Syntax RTPRICEDRIFT(filter.sub.-- num, rt.sub.-- data.sub.-- item, initial.sub.-- value, decay.sub.-- factor, delay, limit) filter.sub.-- num is a number specifying the filter number and is an integer between 0 and 255, inclusive. The filter number uniquely identifies a global memory location where the function stores cumulative results and must be different for each FEA Real-Time Filterpak function usage, even if the functions are contained in the same cell, refer to the same rt.sub.-- data.sub.-- item, or are in different open spreadsheet files. filter.sub.-- num should be a constant. If the filter number is changed, new global data is referenced. rt.sub.-- data.sub.-- item is a reference to a cell containing a positive real-time data item. initial.sub.-- value is a number specifying the initial value of the price drift y(0). It is used before the first invocation of the function occurs. decay.sub.-- factor is a number specifying the decay factor and is a number between greater than or equal to zero and strictly less than one. Higher values give more weight to prior observations. The decay factor is commonly called lambda (.sup..lambda.). delay is the minimum required latency in seconds since the prior arrival of rt.sub.-- data.sub.-- item. If delay is zero or less, then no minimum latency is required. If delay is positive, then at least an integral number of seconds not less than delay must have passed for the new difference to be returned, otherwise the prior value will be returned. If delay is omitted then zero is used. limit is a number specifying the maximum absolute movement (up or down) that the new price drift can move from its previous value. If a new value of rt.sub.-- data.sub.-- item causes the new calculated price drift to move either below the prior value-limit or above the prior value+limit then the limiting value of the price drift (that is, either prior value-limit or prior value+limit) is returned, otherwise the new price drift is returned as calculated. If limit is omitted then no limits are used. Remarks Latency is used in calculations if delay is positive. filter.sub.-- num is truncated to an integer. delay is rounded up to the nearest integer. If decay.sub.-- factor<0 or decay.sub.-- factor>=1, RTPRICEDRIFT returns an error value. The price drift y(n) is calculated iteratively by: ##EQU7## where .sup..lambda. is decay.sub.-- factor, initial.sub.-- value is the initial value y(0), and log denotes the natural logarithm. Higher values of decay.sub.-- factor give more weight to prior observations. More precisely, set K=-1/log(decay.sub.-- factor). K is the approximate number of price observations, or ticks, in the past beyond which the weights start to become negligible. For instance, decay.sub.-- factor=0.90 gives K=9 (approximately), means that the weights given to the observations K, 2K, 3K, . . . , mK ticks in the past, are factors of e=2.7183 . . . , e 2, e 3, . . . , e m, respectively, smaller than that assigned to the most recent observation. The information can be converted into time units by multiplying K by the average time interval between ticks if delay=0, or by delay if delay is greater than this interval. The price drift can be interpreted as the annualized, instantaneous, average rate-of-return of a security. EXAMPLES If cell A1 contains a real-time data item with the values:
______________________________________
Value Arrival time (sec.)
______________________________________
10 0
9.98 1
9.99 4
10.1 8
10.08 9
RTPRICEDRIFT(0, A1, 0, 0.999, 0) equals -12.43
RTPRICEDRIFT(1, A1, 0, 0.999, 2) equals 33.98
______________________________________
RTPRICESTDEV Returns the price standard deviation of a real-time variable. Syntax RTPRICESTDEV(filter.sub.-- num, rt.sub.-- data.sub.-- item) filter.sub.-- num is a number specifying the filter number and is an integer between 0 and 255, inclusive. The filter number uniquely identifies a global memory location where the function stores cumulative results and must be different for each FEA Real-Time Filterpak function usage, even if the functions are contained in the same cell, refer to the same rt.sub.-- data.sub.-- item, or are in different open spreadsheet files. filter.sub.-- num should be a constant. If the filter number is changed, new global data is referenced. rt.sub.-- data.sub.-- item is a reference to a cell containing a positive real-time data item. Remarks Latency is not used in calculations. filter.sub.-- num is truncated to an integer. The equation for the price standard deviation is: ##EQU8## where log denotes the natural logarithm. The price standard deviation is commonly called historical volatility. EXAMPLES If cell A1 contains a real-time data item with the values:
______________________________________
Value Arrival time (sec.)
______________________________________
10 0
9.98 1
9.99 4
10.1 8
10.08 9
RTPRICESTDEV(0, A1) equals 0.0026
______________________________________
RTPRICEVOL Returns the volatility of a real-time variable. Syntax RTPRICEVOL(filter.sub.-- num, rt.sub.-- data.sub.-- item, initial.sub.-- value, decay.sub.-- factor, delay, limit) filter.sub.-- num is a number specifying the filter number and is an integer between 0 and 255, inclusive. The filter number uniquely identifies a global memory location where the function stores cumulative results and must be different for each FEA Real-Time Filterpak function usage, even if the functions are contained in the same cell, refer to the same rt.sub.-- data.sub.-- item, or are in different open spreadsheet files. filter.sub.-- num should be a constant. If the filter number is changed, new global data is referenced. rt.sub.-- data.sub.-- item is a reference to a cell containing a positive real-time data item. initial.sub.-- value is a number specifying the initial value of the price volatility y(0). It is used before the first invocation of the function occurs. decay.sub.-- factor is a number specifying the decay factor and is a number between greater than or equal to zero and strictly less than one. Higher values give more weight to prior observations. The decay factor is commonly called lambda (.sup..lambda.). delay is the minimum required latency in seconds since the prior arrival of rt.sub.-- data.sub.-- item. If delay is zero or less, then no minimum latency is required. If delay is positive, then at least an integral number of seconds not less than delay must have passed for the new difference to be returned, otherwise the prior value will be returned. If delay is omitted then zero is used. limit is a number specifying the maximum absolute movement (up or down) that the new price volatility can move from its previous value. If a new value of rt.sub.-- data.sub.-- item causes the new calculated price volatility to move either below the prior value-limit or above the prior value+limit then the limiting value of the price volatility (that is, either prior value-limit or prior value+limit) is returned, otherwise the new price volatility is returned as calculated. If limit is omitted then no limits are used. Remarks Latency is used in calculations if delay is positive. filter.sub.-- num is truncated to an integer. delay is rounded up to the nearest integer. If decay.sub.-- factor<0 or decay.sub.-- factor>=1, RTPRICEVOL returns an error value. The price volatility y(n) is calculated iteratively by: ##EQU9## where .sup..lambda. is decay.sub.-- factor, initial.sub.-- value is the initial value y(0), and log denotes the natural logarithm. Higher values of decay.sub.-- factor give more weight to prior observations. More precisely, set K=-1/log(decay.sub.-- factor). K is the approximate number of price observations, or ticks, in the past beyond which the weights start to become negligible. For instance, decay.sub.-- factor=0.90 gives K=9 (approximately), means that the weights given to the observations K, 2K, 3K, . . . , mK ticks in the past, are factors of e=2.7183 . . . , e 2, e 3, . . . , e M, respectively, smaller than that assigned to the most recent observation. The information can be converted into time units by multiplying K by the average time interval between ticks if delay=0, or by delay if delay is greater than this interval. RTPRICEVOL assumes that the drift is zero. (This is a good approximation in real-time environments.) If the drift is non-zero, RTPRICEVOL estimates instead the root-mean-square (RMS) of price returns; in this case when the drift is known, the price volatility can instead be estimated by the formula: ##EQU10## Setting a low limit will depress the average value of RTPRICEVOL. Try some examples using the TICKER and chart the results to learn more. EXAMPLES If cell A1 contains a real-time data item with the values:
______________________________________
Value Arrival time (sec.)
______________________________________
10 0
9.98 1
9.99 4
10.1 8
10.08 9
RTPRICEVOL(0, A1, 0.2, 0.999) equals 0.5162
______________________________________
RTSIGN Returns the sign (-1,0,1) of the difference between the current value of a real-time variable and its prior value. Syntax RTSIGN(filter.sub.-- num, rt.sub.-- data.sub.-- item, delay) filter.sub.-- num is a number specifying the filter number and is an integer between 0 and 255, inclusive. The filter number uniquely identifies a global memory location where the function stores cumulative results and must be different for each FEA Real-Time Filterpak function usage, even if the functions are contained in the same cell, refer to the same rt.sub.-- data.sub.-- item, or are in different open spreadsheet files. filter.sub.-- num should be a constant. If the filter number is changed, new global data is referenced. rt.sub.-- data.sub.-- item is a reference to a cell containing a numeric real-time data item. delay is the minimum required latency in seconds since the prior arrival of rt.sub.-- data.sub.-- item. If delay is zero or less, then no minimum latency is required. If delay is positive, then at least an integral number of seconds not less than delay must have passed for the new difference to be returned, otherwise the prior value will be returned. If delay is omitted then zero is used. Remarks Latency is used in calculations if delay is positive. filter.sub.-- num is truncated to an integer. delay is rounded up to the nearest integer. A result of -1 means rt.sub.-- data.sub.-- item has declined since its previous value, a result of 1 means it has increased, a result of 0 (zero) means there has been no change. When rt.sub.-- data.sub.-- item is updated with a new value, RTSIGN returns the sign of the difference between that new value and its prior value. However, if fewer than delay seconds have passed since the last rt.sub.-- data.sub.-- item update, no action occurs; in fact any number of such new updates may occur within the minimum delay period and all will be ignored, so RTSIGN will not change. The first update which occurs after the minimum delay period has passed will be differenced with the value which was seen at least delay seconds ago, and the sign of this difference is returned by the function. If no minimum delay time is desired, delay should be set to zero. In this case, RTSIGN will return the signs of the differences of all successive rt.sub.-- data.sub.-- item values. You can cascade RTSIGN to find second, third, and higher-order differences. Be sure to use a separate filter number for each. This function behaves the same as RTDIFF but returns the sign of the difference of real-time updates instead of the sign and magnitude of the difference. EXAMPLES If cell A1 contains a real-time data item with the values:
______________________________________
Value Arrival time (sec.)
______________________________________
10 0
9 1
11 4
12 8
11 9
RTSIGN(0, A1, 0) equals -1 (sign of 11-12)
RTSIGN(1, A1, 3) equals 0 (sign of 11-11)
RTSIGN(2, A1, 6) equals 1 (sign of 11-9)
______________________________________
RTSMOOTH Returns the exponentially-weighted moving average of a real-time variable. Syntax RTSMOOTH(filter.sub.-- num, rt.sub.-- data.sub.-- item, decay.sub.-- factor, initial.sub.-- value) filter.sub.-- num is a number specifying the filter number and is an integer between 0 and 255, inclusive. The filter number uniquely identifies a global memory location where the function stores cumulative results and must be different for each FEA Real-Time Filterpak function usage, even if the functions are contained in the same cell, refer to the same rt.sub.-- data.sub.-- item, or are in different open spreadsheet files. filter.sub.-- num should be a constant. If the filter number is changed, new global data is referenced. rt.sub.-- data.sub.-- item is a reference to a cell containing a numeric real-time data item. decay.sub.-- factor is a number specifying the decay factor and is a number between greater than or equal to zero and strictly less than one. Higher values give more weight to prior observations. The decay factor is commonly called lambda (.sup..lambda.). initial.sub.-- value is a number specifying the initial value of the exponentially-weighted moving average y(0). It is used before the first invocation of the function occurs. If initial.sub.-- value is omitted then the first value of rt.sub.-- data.sub.-- item is used. Remarks Latency is not used in calculations. filter.sub.-- num is truncated to an integer. If decay.sub.-- factor<0 or decay.sub.-- factor>=1, RTSMOOTH returns an error value. In a simple moving average the weight applied to each point is equal to 1/N where N is the sample size. In exponential smoothing relatively more weight is applied to recent observations. The weight applied to each point is determined by decay.sub.-- factor. The exponentially-weighted moving average y(n) is calculated iteratively by: y.sub.n =.lambda.y.sub.n-1 +(1-.lambda.)x.sub.n where .sup..lambda. is decay.sub.-- factor and initial.sub.-- value is the initial value y(0). Higher values of decay.sub.-- factor give more weight to prior observations. More precisely, set K=-1/log(decay.sub.-- factor). K is the approximate number of price observations, or ticks, in the past beyond which the weights start to become negligible. For instance, decay.sub.-- factor=0.90 gives K=9 (approximately), means that the weights given to the observations K, 2K, 3K, . . . , mK ticks in the past, are factors of e=2.7183 . . . , e 2, e 3, . . . , e m, respectively, smaller than that assigned to the most recent observation. The information can be converted into time units by multiplying K by the average time interval between ticks if delay=0, or by delay if delay is greater than this interval. EXAMPLES If cell A1 contains a real-time data item with the values:
______________________________________
Value Arrival time (sec.)
______________________________________
10 0
9 1
11 4
12 8
11 9
RTSMOOTH(0, A1, 0.94, 10) equals 10.176
______________________________________
RTSTDEV Returns the sample standard deviation of a real-time variable. Syntax RTSTDEV(filter.sub.-- num, rt.sub.-- data.sub.-- item) filter.sub.-- num is a number specifying the filter number and is an integer between 0 and 255, inclusive. The filter number uniquely identifies a global memory location where the function stores cumulative results and must be different for each FEA Real-Time Filterpak function usage, even if the functions are contained in the same cell, refer to the same rt.sub.-- data.sub.-- item, or are in different open spreadsheet files. filter.sub.-- num should be a constant. If the filter number is changed, new global data is referenced. rt.sub.-- data.sub.-- item is a reference to a cell containing a numeric real-time data item. Remarks Latency is not used in calculations. filter.sub.-- num is truncated to an integer. The equation for the sample standard deviation is: ##EQU11## If rt.sub.-- data.sub.-- item is log-normally distributed (e.g., the price of a certain securities), then s approaches infinity as n becomes large; use RTPRICEVOL instead. EXAMPLES If cell A1 contains a real-time data item with the values:
______________________________________
Value Arrival time (sec.)
______________________________________
10 0
9 1
11 4
12 8
11 9
RTSTDEV(0, A1) equals 1.140175
______________________________________
RTSTDEVT Returns the time-weighted standard deviation of a real-time variable. Syntax RTSTDEVT(filter.sub.-- num, rt.sub.-- data.sub.-- item, initial.sub.-- value, initial.sub.-- time) filter.sub.-- num is a number specifying the filter number and is an integer between 0 and 255, inclusive. The filter number uniquely identifies a global memory location where the function stores cumulative results and must be different for each FEA Real-Time Filterpak function usage, even if the functions are contained in the same cell, refer to the same rt.sub.-- data.sub.-- item, or are in different open spreadsheet files. filter.sub.-- num should be a constant. If the filter number is changed, new global data is referenced. rt.sub.-- data.sub.-- item is a reference to a cell containing a numeric real-time data item. initial.sub.-- value is a number specifying the prior value of the time-weighted sample standard deviation, i.e., before the first invocation of the function. If initial.sub.-- value is omitted then no prior value is used. initial.sub.-- time is a number specifying the time period in seconds over which initial.sub.-- value was evaluated. This becomes the weight in the subsequent time-weighted average. If initial.sub.-- time is omitted or 0 (zero) then no initial value is used. Remarks Latency is used in calculations. filter.sub.-- num is truncated to an integer. Specify initial.sub.-- value and initial.sub.-- time to include a previously observed sample standard deviation or influential observation in the results. The equation for the time-weighted standard deviation is: ##EQU12## where X(tw) is the time-weighted arithmetic mean calculated using the equation shown in RTAVERAGET. RTSTDEVT returns the population standard deviation, to convert to the sample standard deviation multiply by the square root of n/(n-1), where n is the number of observations. Note that this correction factor rapidly approaches one as n increases, so the difference between the population and sample standard deviation is usually trivial. EXAMPLES If cell A1 contains a real-time data item with the values:
______________________________________
Value Arrival time (sec.)
______________________________________
10 0
9 1
11 4
12 8
11 9
RTSTDEVT(0, A1) equals 1.0541
______________________________________
RTSUM Returns the sum of values of a real-time variable. Syntax RTSUM(filter.sub.-- num, rt.sub.-- data.sub.-- item) filter.sub.-- num is a number specifying the filter number and is an integer between 0 and 255, inclusive. The filter number uniquely identifies a global memory location where the function stores cumulative results and must be different for each FEA Real-Time Filterpak function usage, even if the functions are contained in the same cell, refer to the same rt.sub.-- data.sub.-- item, or are in different open spreadsheet files. filter.sub.-- num should be a constant. If the filter number is changed, new global data is referenced. rt.sub.-- data.sub.-- item is a reference to a cell containing a numeric real-time data item. Remarks Latency is not used in calculations. filter.sub.-- num is truncated to an integer. EXAMPLES If cell A1 contains a real-time data item with the values:
______________________________________
Value Arrival time (sec.)
______________________________________
10 0
9 1
11 4
12 8
11 9
RTSUM(0, A1) equals 53
______________________________________
RTTAPE Returns an array of real-time variable values and corresponding update times. Syntax RTTAPE(tape.sub.-- num, rt.sub.-- data.sub.-- item) tape.sub.-- num is a number specifying the tape number and is an integer between 0 and 15, inclusive. The tape number uniquely identifies a global memory location where the function stores cumulative results and must be different for each RTTAPE function usage, even if the functions refer to the same rt.sub.-- data.sub.-- item or are in different open spreadsheet files. tape.sub.-- num should be a constant. If you change this value after the function has been invoked then all previous results are lost and new results are generated. The value of tape.sub.-- num is independent of the value of filter.sub.-- num in the FEA Real-Time Filterpak filter functions; for example, if you specify a tape.sub.-- num value of 0 in an RTTAPE function call then you can still specify a filter.sub.-- num value of 0 in a filter function since they represent different memory locations. rt.sub.-- data.sub.-- item is a reference to a cell containing a numeric real-time data item. Remarks Formulas that return arrays must be entered as array formulas. For information about arrays, see About Spreadsheet Functions or your spreadsheet's User's Guide or on-line help. You may enter RTTAPE as a vertical or horizontal array. A vertical array has up to 256 rows and either one or two columns. A horizontal array has up to 256 columns and either one or two rows. In a vertical array, the most recent rt.sub.-- data.sub.-- item value is printed in the top-most row. As new rt.sub.-- data.sub.-- item values occur, the previous values are scrolled downward to the last row and, finally, "off the edge" of the array. In a horizontal array, the most recent value is printed in the left-most column and scrolls rightward. In a n-by-1 vertical array, the column contains scrolling rt.sub.-- data.sub.-- item values. In a n-by-2 vertical array the left column contains update times in the spreadsheet's date/time serial number format and the right column contains scrolling rt.sub.-- data.sub.-- item values. In a 1-by-n horizontal array, the row contains scrolling rt.sub.-- data.sub.-- item values. In a 2-by-n horizontal array, the top row contains update times in the spreadsheet's date/time serial number format and the bottom row contains scrolling rt.sub.-- data.sub.-- item values. Any 2-by-2 or smaller array is treated as a vertical array. Microsoft Excel for Windows represents dates as serial numbers where 1 corresponds to Jan. 1, 1900. Numbers to the right of the decimal point represent the time as a decimal fraction ranging from 0 to 0.99999999, representing the times from 0:00:00 (12:00:00 AM) to 23:59:59 (11:59:59 PM). You can find the current data/time with the Microsoft Excel's NOW function. To display date/time serial numbers as date/time values, select the cells you want to format, choose Cells (Format menu), select the Number tab, select the Time category, and then select the desired format type. EXAMPLES If cell A1 contains a real-time data item with the values:
______________________________________
Value Arrival time
______________________________________
10 10:45:00
9 10:45:01
11 10:45:04
12 10:45:08
11 10:45:09
______________________________________
When entered as an array formula in cells A3:B7, RTTAPE(0,A1) returns:
______________________________________
A B
______________________________________
1 11
3 10:45:00 10
4 10:45:01 9
5 10:45:04 11
6 10:45:08 12
7 10:45:09 11
______________________________________
Note: Cells A3:A7 are formatted "h:mm:ss" (use the Format-Cells-Number command). The actual values in these cells are Microsoft Excel data/time serial numbers (described above). RTTRIM Returns the trimmed values of a real-time variable. The trimmed values are the interior of a data set calculated by excluding data points below some lower limit and above some upper limit. Use this function when you wish to exclude outlying data from your analysis. Syntax RTTRIM(filter.sub.-- num, rt.sub.-- data.sub.-- item, lower.sub.-- limit, upper.sub.-- limit, limit.sub.-- type) filter.sub.-- num is a number specifying the filter number and is an integer between 0 and 255, inclusive. The filter number uniquely identifies a global memory location where the function stores cumulative results and must be different for each FEA Real-Time Filterpak function usage, even if the functions are contained in the same cell, refer to the same rt.sub.-- data.sub.-- item, or are in different open spreadsheet files. filter.sub.-- num should be a constant. If the filter number is changed, new global data is referenced. rt.sub.-- data.sub.-- item is a reference to a cell containing a numeric real-time data item. lower.sub.-- limit is a number specifying the lower limit for trimming rt.sub.-- data.sub.-- item values. Use limit.sub.-- type to specify absolute limits, percentage movements, or absolute movements. If limit.sub.-- type is 1 then enter a percentage as a decimal number, e.g., for 5%, enter 0.05. If this argument is omitted then no lower limit is used. upper.sub.-- limit is a number specifying the upper limit for trimming rt.sub.-- data.sub.-- item values. Use limit.sub.-- type to specify absolute limits, percentage movements, or absolute movements. If limit.sub.-- type is 1 then enter a percentage as a decimal number, e.g., for 5%, enter 0.05. limit.sub.-- type is a number specifying if lower.sub.-- limit and upper.sub.-- limit represent absolute limits or percentage movements.
______________________________________
limit.sub.-- type
Trimmed rt.sub.-- data.sub.-- item values
______________________________________
0 or omitted
Absolute limits: Trims current rt.sub.-- data.sub.-- item values
that do not fall between lower.sub.-- limit and upper.sub.--
limit,
inclusive.
1 Percentage movements: Trims current rt.sub.-- data.sub.-- item
values
that do not fall between previous rt.sub.-- data.sub.-- item *
(1 - lower.sub.-- limit) and previous rt.sub.-- data.sub.-- item
*
(1 + upper.sub.-- limit), inclusive.
2 Absolute movements: Trims current rt.sub.-- data.sub.-- item
values that do not fall between previous rt.sub.-- data.sub.--
item-
lower.sub.-- limit and previous rt.sub.-- data.sub.-- item +
upper.sub.-- l | ||||||
