FIDAL - Financial Data Access Library

  Home | Documentation | Download
 

 

C/C++ Application Program Interface

1.0 Introduction

2.0 How to build and link to FIDAL

3.0 Accessing Market Data

4.0 Time/Date Functions

Alphabetical List

horizontal rule

1.0 Introduction

All functions available to the end-user are documented here.

FIDAL provides functionality for your application to access market data. It provides a consistent interface to retrieve market data online, from a local database or from local file.

horizontal rule

2.0 How to build and link to FIDAL

To use the library in C/C++ project, you just need to #include "fidal.h" and link to the static library corresponding to your type of application.

All the required header file are in fidal/c/include. Header files in other directories should never be included by your application directly.

2.1 Windows/Microsoft Visual C++

Here is the list of variant of the static library currently supported:

 Static Library Name

Use runtime DLL?

 Multithreaded?

 debug info?

 fidal_csr.lib

No

No

No

 fidal_csd.lib

No

No

Yes

 fidal_cmr.lib

No

Yes

No

 fidal_cmd.lib

No

Yes

Yes

 fidal_cdr.lib

YesYesNo

 fidal_cdd.lib

YesYesYes

Pre-compiled version of these libraries is part of the MSVC package. If you wish to re-build yourself the static libraries, makefiles can be found in fidal/c/make/<ENV>/win32/msvc.

The <ENV> is a 3 letter sub-directories (cmd, cmr, csd, csr, cdd and cdr) allowing to select the "standard library runtime" setting for your application).

Just type "nmake" or "nmake /A" to build all targets. The generated targets will be found in fidal/c/lib and fidal/c/bin.

To rebuild from scratch do "nmake clean" and then "nmake" again.

bullet

The application without debug info are the speed optimized version. They cannot be trace for debugging though.

bullet

Some VC++ 6.0 project files can be found in fidal/c/ide/msvc

bullet

If you observe link errors on Windows, verify that the "Use runtime library" setting in the C/C++ Code generation tab is the same as your choice of static libraries.

bullet

Link errors will show up if your application does not links with wininet and odbc32. These are provided with MSVC and Borland and should be found on your system.

2.2 Windows/Free C++ Borland Compiler

bullet

Same as for Microsoft Visual C++, except: Makefiles are in fidal/c/make/<ENV>/win32/borland and the cdd and cdr static library are not available.

bullet

Execute the Borland "make" instead of the Microsoft "nmake".

bullet

To build from scratch, do "make clean". This is needed particularly if you are switching between Borland and MSVC compiler because the object file formats are different (COFF=MSFT, OMF=Borland)

2.3 Linux

Pre-compiled library are not provided for Linux. You must build these yourself with the makefiles found in fidal/c/make/<ENV>/linux/g++.

The <ENV> is a 3 letter sub-directories (cmd,cmr,csd,csr) allowing to select an environment of development applicable to your application (see section 2.1). The cdd and cdr type does not apply to Linux.

Just type "make clean" and "make" to build all targets. The generated targets will be found in fidal/c/lib and fidal/c/bin.

You need libCurl to be installed (to provide internet access functionality).

2.4 Regression Testing (All Platform)

When building the complete source tree, an application called "fd_regtest" is created in the fidal/c/bin directory. This is a suite of tests to validate that the library you did compiled is behaving as expected within your environment.

Whenever you re-compile the FIDAL libraries, it is suggested to re-run fd_regtest. An internet connection is required since web data fetching is one feature being tested.

horizontal rule

3.0 Accessing Market Data

The interface can be found in fidal/c/include/fidal.h

Make sure FD_Initialize is called once (and only once) prior to any other API functions. Once your application is finished with FIDAL, call FD_Shutdown to free all resources.

Create one or many unified database with FD_UDBaseAlloc. When not needed anymore an unified database can be freed with FD_UDBaseFree.

Data source can be added to an unified database by using FD_AddDataSource. Without adding any data source, an unified database is totally empty!

For each unified database, the index of the available categories and symbols can be extract by using respectively FD_CategoryTableAlloc and FD_SymbolTableAlloc. These tables are simply an "array" of strings. Once these index are not needed anymore, they can be freed using FD_CategoryTableFree and FD_SymbolTableFree. The caller can allocate as much tables as needed.

By specifying the category and the symbol string, the historical data can be obtained using FD_HistoryAlloc. Once the data is not needed anymore, it can be freed using FD_HistoryFree. The historical data is stored in the structure FD_History.

Some listing of the content of the unified database can be done with FD_Report. The report can be sent to the console (stdout) or to a file.

horizontal rule

4.0 Time / Date Functions

Both date and time manipulated by the FIDAL are encoded within a FD_Timestamp (encoded on 64 bits).

Timestamps can cover all dates between the year 1600 to 9999 down to a precision of 1 seconds.

You can extract basic information from a FD_Timestamp with:

FD_GetYear
FD_GetMonth
FD_GetDay
FD_GetHour
FD_GetMin
FD_GetSec
FD_GetDayOfTheWeek
FD_GetWeekOfTheYear
FD_GetDayOfTheYear


A timestamp can be initialized or changed with:

FD_SetDate
FD_SetTime
FD_SetDefault
FD_SetDateNow
FD_SetTimeNow
FD_TimestampCopy


Timestamp can be compared with:

FD_TimestampEqual
FD_TimestampGreater
FD_TimestampLess.


You can conveniently modify a date using:

FD_NextDay
FD_NextWeekday
FD_JumpToEndOfMonth
FD_JumpToDayOfWeek
FD_PrevDay
FD_PrevWeekday
FD_BackToBeginOfMonth
FD_BackToDayOfWeek.


FD_TimestampValidate allows to double-check if a timestamp variable is well encoded.

See fidal/c/include/fd_common.h for more information.

Google  SourceForge Logo
  Web FidalSoft.org
 

Copyright? 2006 TicTacTec LLC. All Rights Reserved. Last Update: 07/21/06, Unique Visitor: