FastTrack API
Back to the Main Developer pageThe FastTrack API
IS the interface to the FastTrack
database and FNU files.
|
The FastTrack DLL, FastTrack.dll, provides a Windows 32-bit API to the FastTrack database and FNU files.
It is available to anyone and there are no royalties for
redistribution. However, you must sign our license agreement.
The DLL has been tested under C, C++ and Visual Basic, and uses
standard Windows API-type calls, so any language that can handle
those should have no problem with the DLL. It is not an ActiveX DLL.
Why use FastTrack.dll?
If you use FastTrack.dll in your programming instead of using
the defined data structures we offered in FTLAYOUT.BAS
for the DOS version of FastTrack, then your program can
automatically take advantage of all FastTrack databases, stocks,
mutual funds, indices, and future offerings. Also, you will not
have to change your programs to use any new data structures that
we introduce. When we change the structure, we will also download
a new DLL . . . and you can count on this because FastTrack
itself uses the same DLL you'll be using for its access to the
FastTrack database and FNU files . . . if we send a bad DLL
we're all in trouble.
Of course, we may enhance the features of the DLL and the
databases from time to time. To use any such new features, you
would, of course, have to revise your programs . . . BUT THE
GOAL is to maintain a standard set of features forever so that
your programs will always work with new symbols and databases in
a totally transparent manner.
Standard Disclaimer:
There are no guarantees that you will not have problems. We
will support you as best we can and fix any errors in the DLL
as quickly as we are able to do so. By using the DLL you agree
to hold us harmless and indemnify us with respect to any actions
brought by your users.
|
|
Any 32-bit Windows PC that can actively update the FT databases using
our FTComm to get daily downloads. Users/developers with expired
FastTrack subscription agreements will not be able to use the dll.
There is a sample Visual Basic project in the
vb directory. For C and C++ programmers,
header and library files are supplied (ftapi.h and
FastTrack.lib, respectively) in the c
directory. For Delphi programmers, the delphi
directory includes FastTrack.pas , which gives the
Delphi interface to the FastTrack API, as well as two helper
functions. FastTrack.pas was provided by Richard
Kellogg, a Delphi developer who is using the FastTrack API.
For programmers in other languages, this document and the C/C++
header should give you the information to use the FastTrack API.
|
In addition, there are two
convenience function calls for C
and C++ users, FTjulian2time_t
and FTjulian2tm , that
convert the Visual Basic version of a julian date
into something C and C++ can understand.
Format
The functions in the API are documented in the following format:
Function Name
- VB Declaration:
This is the Visual Basic declaration of the function
- Parameters:
The function parameters go here. The format is:
name - direction - description
where direction is in, out,
or in/out, depending on whether the parameter
is passed to the function (in),
is returned from the function (out),
or both (in/out).
- Note on strings:
- When a string is to be returned from a function,
it must be big enough to hold
the returned value. In Visual Basic, this can
be done either by dimensioning it large enough,
or by filling it with enough characters.
- Examples:
- Dim sym As String * 5
- Dim namesize As Long
Dim name As String
namesize = FTgetNameSize
name = String$ (namesize, " ")
We recommend that the latter method be used,
because then the string sizes can be dynamically
sized (using functions such as
FTgetNameSize)
- Some notes on arrays:
- When a array is to be passed to or from a
function, it must be
dimensioned so that the specified lower
and upper bounds are valid. For example,
the prices array
is specified to be dimensioned
from 0 to
maxnumdays;
therefore, the lower bound must be
at most 0, and
the upper bound must be at least
maxnumdays.
- Also, when an array is passed to or from a
function, pass the first element. For
example, to pass the
prices array
prices, use
prices (0) for the parameter.
- Example:
- maxnumdays& = FTgetMaxNumDays ()
sym = "FMAGX" ' sym is defined above
Dim prices (maxnumdays&) as Single
If FTgetIssue (sym, prices (0)) <>
0 Then
' some kind of error
has occurred
' see
standard error
codes to see what went wrong
End If
- Return value:
Only functions have this section. Generally, functions
return a standard return value.
Most of the "get" functions, however, return a
positive integer on success, representing the
value requested, or a
standard error code
on failure. And some functions merely return
boolean values.
- Purpose:
The purpose of the function goes here.
- Notes:
Some functions may have a notes section. Things that
do not fit in any of the other sections go here.
|
- VB Declaration:
Declare Function FTopen Lib "FastTrack" () As Long
- Parameters:
None
- Return value:
standard return value
- Purpose:
Initialize the DLL
- Notes:
|
- VB Declaration:
Declare Sub FTclose Lib "FastTrack" ()
- Parameters:
None
- Purpose:
Unload the DLL
- Notes:
The FastTrack DLL automatically unloads itself.
FTclose can be used if it doesn't unload
quickly enough. Note that if you decide to use this function
to force unloading, every FTopen must
be followed by an FTclose.
- VB Declaration:
Declare Function FTrebuildSymbols Lib "FastTrack" () As Long
- Parameters:
None
- Return value:
standard return value
- Purpose:
Rebuild the symbols file, and then reset the DLL.
- Notes:
Calling this many times may cause a memory leak.
|
These functions return a prices array.
- VB Declaration:
Declare Function FTgetIssue Lib "FastTrack"
(ByVal sym As String, prices As Single) As Long
- Parameters:
sym - in - the issue
symbol
prices - out - the
prices array
(see Some notes on arrays)
- Return value:
standard return value
- Purpose:
Get the prices for sym
- Notes:
The prices array
must be dimensioned properly (from 0
to maxnumdays), or Bad
Things will happen (that is, a crash, or worse).
These functions return information for a particular issue.
- VB Declaration:
Declare Function FTisFTIssue Lib "FastTrack"
(ByVal sym As String) As Boolean
- Parameters:
sym - in - the issue
symbol
- Return value:
true - sym is
recognized as a FastTrack or user issue
false - sym is not
recognized as a FastTrack or user issue
- Purpose:
Return true if the symbol is either in one of the
databases or is an FNU file
- VB Declaration:
Declare Function FTgetIssueName Lib "FastTrack"
(ByVal sym As String, ByVal name As String) As Long
- Parameters:
sym - in - the issue
symbol
name - out - the issue name
(see Note on strings
- FTgetNameSize returns
the minimum size)
- Return value:
standard return value
- Purpose:
Get the name of sym
- VB Declaration:
Declare Function FTgetName Lib "FastTrack"
(ByVal sym As String, ByVal name As String, ByVal GetShortName As Integer) As Long
- Parameters:
sym - in - the issue
symbol
name - out - the issue name
(see Note on strings
- FTgetNameSize returns
the minimum size)
GetShortName - in - return short name or long (1 for short, 0 for long)
- Return value:
standard return value
- Purpose:
Get the name of sym
- VB Declaration:
Declare Function FTgetNumDays Lib "FastTrack"
(ByVal sym As String) As Long
- Parameters:
sym - in - the issue
symbol
- Return value:
n > 0 - n is
the market day of the
last day of data for sym
n < 0 - n is a
standard error code
- Purpose:
Return the market day of the
last day of data for sym
- VB Declaration:
Declare Function FTgetMaxDaysBySym Lib "FastTrack"
(ByVal sym As String) As Long
- Parameters:
sym - in - the issue
symbol
- Return value:
n > 0 - n is
the maximum number of days that
sym's database can have
n < 0 - n is a
standard error code
- Purpose:
Return the maximum number of days that
sym's database can have
- Notes:
Do not use this function to dimension the
prices array for
FTgetIssue. Use
FTgetMaxNumDays or Bad
Things will happen (that is, a crash, or worse).
- VB Declaration:
Declare Function FTgetStartDateBySym Lib "FastTrack"
(ByVal sym As String) As Long
- Parameters:
sym - in - the issue
symbol
- Return value:
n > 0 - n is
the market day of the start date
for sym
n < 0 - n is a
standard error code
- Purpose:
Return the market day
of the start date for sym
These functions return information about the FastTrack environment
itself.
- VB Declaration:
Declare Function FTgetMaxDays Lib "FastTrack" () As Long
- Return value:
n > 0 - n is
the maximum number of days of data
that any database can have
n < 0 - n is a
standard error code
- Purpose:
Return the maximum number of days of data
that any database can have
- VB Declaration:
Declare Function FTgetMaxNumDays Lib "FastTrack" ()
As Long
- Parameters:
None
- Return value:
n > 0 - n is
the market day
of the last day of data of the most current database
n < 0 - n is a
standard error code
- Purpose:
Return the market day
of the last day of data of the most current database
- VB Declaration:
Declare Function FTgetMarketDay Lib "FastTrack"
(ByVal day As Long) As Long
- Parameters:
day - in
- Return value:
n > 0 - n is the
market day associated
with day is the
julian date array
n < 0 - n is a
standard error code
- Purpose:
Return the market day for day
- VB Declaration:
Declare Function FTgetNumSyms Lib "FastTrack" () As Long
- Return value:
n > 0 - n is
the number of symbols
recognized by the DLL
n < 0 - n is a
standard error code
- Purpose:
Return the number of symbols that are recognized as
FastTrack issues, that is, the number in at least one of
the database files, plus those that are FNUs.
- VB Declaration:
Declare Function FTgetSymSize Lib "FastTrack" () As Long
- Return value:
n > 0 - n is
the number of characters needed to hold an issue symbol
n < 0 - n is a
standard error code
Because this function
can be used even if the DLL is in an error state,
the return value reflects the state of this function only,
and not the DLL as a whole.
- Purpose:
Return the number of characters needed to hold an issue
symbol
- VB Declaration:
Declare Function FTgetNameSize Lib "FastTrack" () As Long
- Return value:
n > 0 - n is
the number of characters needed to hold an issue name
n < 0 - n is a
standard error code
Because this function
can be used even if the DLL is in an error state,
the return value reflects the state of this function only,
and not the DLL as a whole.
- Purpose:
Return the number of characters needed to hold an issue name
- VB Declaration:
Declare Function FTgetPathSize Lib "FastTrack" () As Long
- Return value:
n > 0 - n is
the number of characters needed to hold a directory path
n < 0 - n is a
standard error code
Because this function
can be used even if the DLL is in an error state,
the return value reflects the state of this function only,
and not the DLL as a whole.
- Purpose:
Return the number of characters needed to hold a
directory path
- VB Declaration:
Declare Function FTgetDLLVersion Lib "FastTrack"
(version As Long, major As Long,
minor As Long) As Long
- Parameters:
version - out - the most
significant part of the version
major - out - the major
part of the version
minor - out - the minor part
of the version
- Return value:
n > 0 - n is the
encoded version number of the FastTrack DLL, combining
version, major,
minor and a patch level in one number.
n < 0 - n is a
standard error code
Because this function
can be used even if the DLL is in an error state,
the return value reflects the state of this function only,
and not the DLL as a whole.
- Purpose:
Return the FastTrack DLL version number
- Notes:
It is guaranteed that, if there are two versions of
the FastTrack DLL, FTgetDLLVersion
will return a larger number for the later version.
These functions can be used to iterate through every
symbol recognized by the DLL.
Basically, use these functions like this (Visual Basic code):
Dim iter As Long
Dim sym as String * 5
iter = FTgetIssueIter
While (FTissueNext (iter, sym))
' use sym here
Wend
FTcloseIssueIter (iter)
Note that you can have more than one iterator open at a time.
- VB Declaration:
Declare Function FTgetIssueIter Lib "FastTrack" ()
As Long
- Parameters:
None
- Return value:
an iterator handle
- Purpose:
Initialize and return an iterator
handle
- VB Declaration:
Declare Function FTissueNext Lib "FastTrack"
(ByVal iterno As Long, ByVal sym As String) As Boolean
- Parameters:
iterno - in - an
iterator handle
sym - out - the issue
symbol
(see Note on strings
- FTgetSymSize returns
the minimum size)
- Return value:
true - Operation succeeded
false - Operation failed,
or no more issues
- Purpose:
Return the next issue symbol from the iterator
iterno
- VB Declaration:
Declare Sub FTcloseIssueIter Lib "FastTrack"
(ByVal iterno As Long)
- Parameters:
iterno - in - an
iterator handle
- Purpose:
Free the resources pointed to by iterno
- Notes:
Always close any open iterators.
For this section, since it is intended for C and C++ users only, there are C
and C++ declarations instead of VB ones.
- iterator handle
- A long integer value representing a issue iterator,
which can be used to iterate through the issue in the
FastTrack database files and FNUs.
- julian date
- A long integer value representing a date. This format is
readily understood in Visual Basic. (For other languages,
it is the number of days since December 30, 1899.)
- julian date array
- An array -- from 0 to
maxnumdays -- of
julian dates, one for each day
there is data for in the database files plus 1
(every market day has one,
and only one entry. Zero is not used.) FTgetJulian
indexes into this array, and
FTgetMarketDay
does the reverse -- it returns the index corresponding
to the market day passed to it
(if the market was not open on that day, it returns an
appropriate substitute).
- market day
- A long integer value representing the index (of a
prices array) to the corresponding
julian date in the
database files and FNUs -- if a corresponding date
does not exist, it is the index of the next smallest
date. Note that the market day is between 1 and
maxnumdays. (See also
julian date array.)
- maxdays
- A long integer value representing the maximum number
of days of a particular issue.
- maxnumdays
- A long integer value representing the the market day of the last day of data of
the most current database.
- prices array
- An array of single-precision values, from 0
to maxnumdays, representing
the dividend-adjusted prices of a issue. Note that even
though the array has a lower bound of 0,
there are valid prices only from 1 up.
FTgetJulian can be used
to convert the index of the prices array into its
corresponding julian date.
- symbol
- The (up to) 5 character string uniquely representing
an issue, usually a ticker symbol.
- standard return value
- Either 0 for success, or a
standard error code for failure.
|