What is FTShell3 FTShell version 7.0last updated 01/19/2016 |
|||||||||||||||||||||
Note: This page best read with Microsoft Internet Explorer. Other browsers have problems with the indents and tabs. FTShell3.DLL is a program file that is part of FastTrack's offerings. It is an ActiveX program that provides computer program a way to read to the FastTrack database, financial functions, and families interface. Your Windows computer MUST have a working, up-to-date copy of FT4Web and it's databases. It is NOT sufficient to copy databases from another computer. FTShell3 replaces and combines the interfaces previously offered by FastTrack.DLL, FTDllShell.DLL, FTindica.DLL, and FTFamRed.DLL. Thus, FTSHell3 provides dividend-adjusted prices, AccuTrack, moving averages, Ulcer Index, and other statistical functions, as well as access to FastTrack families (lists of growth funds, technology stocks, Vanguard funds, etc.) to your computer programs. FTSHell3 the latest version. It supersedes and replaces earlier FTShells. However, it is not binary compatible with earlier versions, therefore, all versions are still supplied for backward compatibility. New development should be based on FTSHell3. Changes from Prior FTShell2
FTShell requires programming skills. However, even if you are not a programmer, do not delete the files: FTShell.dll, FTShell2.dll FTSHell3 because they are used by various FastTrack and 3rd Party programs. The programs depend on the FTShell s being maintained by FastTrack. There are also older interfaces (fasttrack.dll, ftshell.dll, FTFamred.dll) continue to be available with limited support. We no longer suggest that programmers use these directly. Much thought has been put into the FTSHell3 "third-generation" interface to make the programmer's task easier. Specific enhancements include:
Steps in using FTShell on your 32-bit Windows computer.
Steps in using FTShell on your 64-bit Windows computer.
Reference for FTShell3.DLL ActiveX Interface:All arguments are passed as ActiveX variants. In .Net development environments use the type Object to receive and pass arguments. VB 5 and 6 aren't picky about variable types and will, generally, automatically convert (coerce) variable types. However, C++ and C# are less tolerant. Data arrays are all 0 based. That is, they all must have a zeroth element. However, the 0th element is just a duplicate of element the 1st. A typical VB statement allocating space for an array of prices would use,
Dates and Date Functions
Dividend-Adjusted Data FTShell3 (and all prior api's) provides dividend-adjusted data. This topic is amply covered in FastTrack help documentation. FT4Web displays both adjusted and unadjusted prices, a feature not available through FTShell3.
Historical data is adjusted so that the return across a dividend will be correct. Prices more recent than a the last dividend will match what is printed in The WSJ . . . but will change when a dividend is paid. Pick up the data directly from the FT database through FTSHell3 whenever your application requires data. FTShell3 is fast and small . . . far faster and smaller than SQL and other database formats. More detailed Help Links within the help point to the help and charts of the FastTrack for the Web product. FT4WEB uses the same data and methods as does FTShell, and may be valuable to you in understanding some of the more technical functions. Error Handling Most functions return a Variant ( same as a .Net Object ). If the return is a negative Long Integer (32-bit signed), then it is an error code. You must test the type of returned Variant to determine that the call was successful. Because the FTShell functions return variants, you should always have a variant on the left side of your equations. General errors which may be returned by any Function call. These include
Specific Errors which are returned by Functions Some functions have errors that are unique to that function. -100: "DateAdd error#" & Str$(Err) & ": " & Err.Description |
|||||||||||||||||||||
Call Type Name and parameters | |||||||||||||||||||||
Function | Date2Julian(ByVal
vDay as
variant )
as Variant
Returns: A Julian Date For most users these are the major date types which can be passed. Click for more detail : Error returns: All string and numeric values are handled according to vDay rules. |
||||||||||||||||||||
Function |
Date2Str(vDay as variant,
optional vFMT as variant) as Variant
Returns: Returns a String Date inside a Variant.
Error returns:
|
||||||||||||||||||||
Function |
Date2MarketDay (vDay as Variant) as Variant
Returns: Converts any date format to a FastTrack Market Day. Examples: For the period 09/01/1988 - 08/31/1989 comprises 364 calendar days, or 252 FastTrack Market days numbered 1 - 252 . . . only US NYSE market days are counted. Data originating in nonUS markets on US holidays markets is not contained in the database. As a reference;
If DT is does not fall on a Market Day (for example a Saturday), then then last prior market date is returned.
|
||||||||||||||||||||
Function | DateMath ( interval As String,
number As variant, StartDate as Date) as Variant
If the calculated date would precede the year 100 (that is, you subtract more years than are in date), an error occurs. If number isn't an integer, it is rounded to the nearest whole number before being evaluated. Note: To add days to date, you can use either "d", "y", or "w". Be advised that the term "weekday" ("w") has nothing to do with skipping weekend days; i.e., it is NOT equivalent to "Market Days". The example below always returns a date which is a Market Day.
Error returns:
| ||||||||||||||||||||
Function |
DivAdjPrices ( ByVal symbol As String, optional Delimit as String
="", optional Reserved as string) as Variant
Returns all dividend-adjusted prices as a variant containing either
Examples of usage Power Basic should include this statement in code.
Delimit If Delimit is empty ( "" ) then, the variant returns an array as discussed above. If Delimit is not empty, the function returns a string of prices separated by the characters in Delimit. The first element is the string is the count of prices that follow. Error returns: Only General Errors |
||||||||||||||||||||
Function |
FamDelete(ByVal Family$) as Variant Deletes family files within the FTPath\USERDEF\ folder. Will not delete any families in other folders. FamDelete will delete write-protected files. Files are NOT moved to the trash can. Delete them and they are gone. Error Returns:
|
||||||||||||||||||||
Function | Family(ByVal FamName As String)
as Variant Reads an existing family returning a three part string, each part separated by a Pipe character | String parts:
If the returned string is empty, then the family was not found. Check the family name carefully. The name must be a valid Windows file name. Names can be verified with the NameValid function. Error Returns:
|
||||||||||||||||||||
Event | FamilyChange (ChangedFamily
as Variant) This event fires in your application when a family has been changed/deleted/added by another call in FTShell. The name of the affected family is passed in ChangeFamily. Most programmers will simply ignore this event which, unhandled, will cause no problems for most simple programs. Error Returns: N/A |
||||||||||||||||||||
Function |
Families (ByVal FamType As String) as Variant Returns a two part string separated by | pipe characters. The families will be of the type specified by the FamType string
If the returned string is empty, then no matching families were found. Check the family type carefully. FamType: Families are physical disk files within physical disk folders. Family folders must be contained in the FTPath folder. The name of the folder is the FamType. Standard predefined FamTypes are
Other folders containing families may be within FTPath However, this is an extension of the historical standard operating usage of families and these folders may not be used by legacy applications that do not use FastTrack's DLL's for family access. any folder located anywhere within FTPath will be searched for .FAM files. files which are found to be invalid will not be listed. However, the test is not rigorous. Therefore. it is possible to read a family full of trash. Error Returns: General errors
|
||||||||||||||||||||
Function | FamNameValid(Nam$) as Variant
This routine DOES NOT verify the existence of a family. If a user-defined family of the same name exists, then the Name considered valid. Returns: 32-bit long signed integers
Error Returns: None |
||||||||||||||||||||
Function |
FamWrite(ByVal Fam$) as Variant Writes a file containing a four part formatted string to a FT\USERDEF\. The parts are separated by pipe | characters
Note: FTDir is a FTShell functions specifying the path to the installation of FT4Web's databases Error Returns:
VB 6 Example: Assuming that you have built a string array of ticker symbols in the variant v, the code to make a family is as follows: NX& = ft.FamWrite ("MyStocks|Stocks|" & CStr(UBound(V)) & "|" & Join$(v, "|") | ||||||||||||||||||||
Property | FTAccount as variant
Returns the FastTrack account number licensed to the current user. this property is read only Error returns: None | ||||||||||||||||||||
Property | FTDBOpen as Variant
| ||||||||||||||||||||
Property | FTDir as Variant
| ||||||||||||||||||||
Function | HeadTail(ByVal
Source As String, Optional ByRef Tail as string, ByVal N as Long ) as
Variant Returns:
Programming hint:
Error returns: None | ||||||||||||||||||||
Function | isIssue(ByVal symbol As String) as
Variant Returns: True when
Error returns: General Errors | ||||||||||||||||||||
Property | LastErr() as Variant Returns: The Last Error number. Read Only. A Zero return indicates no error. Other error numbers are clarified by the LastErrText.
| ||||||||||||||||||||
Property | LastErrText (
ErrorNumber as Variant)
as Variant Returns: error text. Read Only. However, the LastErr is a global value that has limited use in multi-threaded environments such as when FTShell3 is used at the web server Windows IIS Application level. Error returns: None | ||||||||||||||||||||
Function | MarketDay2Date(ByVal
vDay As Long) as Variant Returns: Microsoft date type variable.
| ||||||||||||||||||||
Function | MarketDay2Julian(ByVal
vDay As Variant) as Variant Returns: A Julian date. Error returns: None | ||||||||||||||||||||
Function | MaxNumDays as Variant Returns: The number of market days in the most recently updated database. Not all databases may have the same date. Error returns: None | ||||||||||||||||||||
Function | RelIndex(ByVal sym As String) as Variant
Returns: the symbol of a market index or index mutual fund. This is the index which is most closely highly correlated to the Sym (correlation of day to day price change). Error returns: General errors | ||||||||||||||||||||
Function | Shell_Close()
Returns: None Performs and orderly shutdown of FTShell. Generally, not calling close will cause no problems. However, in a programming environment where the DLL is instantiated again and again, memory leaks may develop which can be avoided by doing the Shell_Close. Subsequent calls made to the FTShell object will generate errors. Your program should destroy the FTShell object (set it to nothing) immediately after Close.NEVER CALL SHELL_CLOSE FROM A WEB APPLICATION. When multiple users are using the FTShell via IIS, this call would only be made in the Global.ASA website shut down event handler. VB 6 Example:
Error returns: None | ||||||||||||||||||||
Function | StartMarketDay (ByVal symbol As String) as Variant The starting FastTrack Market Day for the symbol's data in the FastTrack Database. This is the day before the first change in price in the data series. This often differs from the official inception date. Error returns: General errors | ||||||||||||||||||||
Function | StartMarketDay (ByVal symbol As String) as Variant The starting FastTrack Market Day for the symbol's data in the FastTrack Database. This is the day before the first change in price in the data series. This may differs from the official inception date as funds commonly are flat in their early history. Error returns: General errorsl |
||||||||||||||||||||
Function | UpdateStatus(ByRef
Status as string) as Variant
(FTSHell3 only)
Use this function to determine if the databases are all updated to the same date. Returns:
|
Mathematical FunctionsNote: any price arrays passed to these functions must have a 0th element i.e Redim X(0, to last day). On return X(0) and (1) will have the same value. Actual prices begin at the 1st element i.e. X(1). This is for compatibility for languages that require all arrays to start at the 0th element. | |
Function | AccuTrack(ByVal ShortParam as Single, ByVal LongParam as Single, ByRef RedvPrices As Variant, ByRef GreenvPrices As Variant) As Variant The RedvPrices and GreenvPrices may be
Returns:
To match FT4Web AccuTrack values, you must display a chart which starts on the Inception Date and end of the last date of data in the FTDatabase. The RedvPrices data must match the red line's data in FT4Web. The GreenvPrices data must match the green line's data in FT4Web. There is an example of use in C:\FT\FT4WIN\ftdeveloper\FTShell\Excel\ Error returns: General errors
|
Function | AnnReturn(ByRef vPrices As Variant, ByVal
vStartDate As Variant, ByVal vEndDate As Variant) As Variant
vPrices may be
Returns: A 32-bit floating-point as a variant that contains the same Ann= annualized return that FT4Web displays for the period.
Error Returns: General errors
|
Function | Correlation (ByRef vPrices As Variant, ByRef vBasis As Variant, CorLength As Variant, ByVal
vStartDate As Variant, ByVal vEndDate As Variant) As Variant
vPrices and vBasis may be
Returns: A variant containing a single floating point value which is the Correlation of the returns of the vPrice price series compared to the vBasis series. This value should match the Cor= value in FT4Web for the period. Correlation measure the degree to which two different price series exhibit similar movement (daily change).
Error Returns: General errors
|
Function | MovingAvg(ByRef vPrices As Variant, SmoothDays As Variant, ByVal StartDate As Variant, ByVal EndDate As Variant) As Variant
vPrices may be
Returns: A variant containing a 32-bit floating-point
Error Returns:General errors
|
Function | RSI(ByRef vPrices As Variant, NDays As Variant, ByVal
vStartDate As Variant, ByVal vEndDate As Variant) As
Variant
vPrices may be
Returns: A variant containing a 32-bit floating-point array of RSI values. These should be identical to the RSI values produced by FT4Web.
Error Returns: General errors
|
Function | SD(ByRef vPrices As Variant, ByVal
vStartDate As Variant, ByVal vEndDate As Variant) As Variant
vPrices may be
Returns: A variant containing a 32-bit floating point value which is the Standard Deviation of the returns of the vPrices price series. This value should match the SD=value in FT4Web for the period. SD measures the volatility of returns. The calculation is performed on daily prices and adjusted to a monthly-basis.
There is an example of use in C:\FT\FT4WIN\ftdeveloper\FTShell\Excel\ Error Returns: General errors
|
Function | SimpleMovingAvg(ByRef vPrices As Variant,
Byval NDays As Variant, ByVal StartDate As Variant, ByVal EndDate As Variant) As Variant
vPrices may be
Returns: A variant containing a 32-bit floating-point array of prices that are the simple moving average of dividend adjusted prices. Exponential (see above) moving averages are usually favored for use in stock market analysis.
Error Returns: General errors
|
Function | UlcerIndex(ByRef vPrices As Variant, ByVal
vStartDate As Variant, ByVal vEndDate As Variant) As Variant
vPrices may be
Returns: The Ulcer Index. Should provide the same value for the period as shown in the FT4Web spreadsheet. The Ulcer Index is a good statistic for comparing the risk of diversified assets.
Error Returns: General errors
|
Function | UPIndex ( ByRef vPrices As Variant, ByRef vBasis As Variant, ByVal vStartDate As Variant, ByVal vEndDate As Variant) As Variant vPrices and vBasis may be
Returns: The 32-bit floating-point Ulcer performance Index as a variant. Should provide the same value for the period as shown in the FT4Web spreadsheet. Ulcer Performance Index provides a good statistic for comparing the risk and return of diversified assets. The vBasis data will always have a UPI value of 0.00 beaucse its drawdown and return will be the basis upon which all the vPrices UPI will be calculated.
Error Returns: General errors
|
Function | Yield1Y ( ByRef Symbol as string, ByVal vEndDate as variant) As Variant Returns: The Yield1Y value (a percentage) for the year period ending on vEndDate. The implicit Start date and End dates follow vDay rules. The Symbol parameter may not be an array of prices since such an array would not contain distributions qualitying as income for the Yield calculation. Error Return: General errors -118: Yield1Y: The evaluated period must be at least one-year long. |
Brief Programmers Guide to using FTShellThere is a program on your computer in C:\FT\FT4WIN\ftdeveloper\FTShell\VB 6 EXAMPLE\FTShellTest.exe which tests much of the functionality of FTShell (not all or it). This program should run on any machine that has a working FT4Web. The VB6 source file is available in c:\FT\FT4WIN\FTDEVELOPER\FTShell\VB 6 Example\FTShellTest_Source_vb6.frm Visual Basic 6.0 (and VBA) Practical ExampleUsing VBA is the most popular way people use FTShell as VBA is included free in every copy of Microsoft Excel. See the c:\ft\ftdeveloper\ftshell\excel\ folder for several examples. The example below runs with VB6 or within VBA. It doesn't contain any Excel cell/column/row references, but rather just outputs text files.
Visual Basic.Net 2005 (and later) Windows Form
C#.NET 2010 Console Application Example
For C#.NET programmers, below is the heart of the example.
Visual Basic.Net 2005 (and later) for access by Windows IIS web pages
Visual FoxPro Example
|