FIDAL - Financial Data Access Library |
|
FIDAL User FAQWhat is FIDAL?
The financial data (open/high/low/close/volume/open interest) is the input common to most trading application software. This data is sold and distributed in a variety of ways. Changing of data source provider means often to change your software for a new API.
From the point of view of the FIDAL user, all the data source are merged within ONE virtual database. Each of the instrument gets an entry in this database regardless of which data source it is coming from. The unified database provides access only to price bars. The volume and the open-interest can be also stored for each bar. Although it could be tempting to store more information this projects currently focus only on price market data.
See the API Documentation :
#include <stdlib.h>
#include <string.h>
#include "ta_libc.h"
int main( void )
{
FD_UDBase *unifiedDatabase;
FD_History *data;
FD_RetCode retCode;
FD_AddDataSourceParam addParam;
FD_HistoryAllocParam historyParam;
unsigned int i;
/* Initialize the access to the library. */
if( FD_Initialize() != FD_SUCCESS )
exit( -1 );
/* Create an unified database. */
if( FD_UDBaseAlloc( &unifiedDatabase ) != FD_SUCCESS )
{
FD_Shutdown();
exit( -2 );
}
/* Indicate where to get the data and put it in
* the "US.NASDAQ.STOCK" category. By default
* the name of the file determine the name of
* the symbol. (Wildcards '*' can be used to
* include multiple files/symbols in one call).
*/
memset( &addParam, 0, sizeof( FD_AddDataSourceParam ) );
addParam.id = FD_ASCII_FILE;
addParam.location = "c:\\my_data\\LNUX";
addParam.info = FD_DOHLCV;
addParam.category = "US.NASDAQ.STOCK";
retCode = FD_AddDataSource( unifiedDatabase, &addParam );
/* Now, display all daily close price available
* for the LNUX symbol.
*/
if( retCode == FD_SUCCESS )
{
memset( &historyParam, 0, sizeof(FD_HistoryAllocParam) );
historyParam.category = "US.NASDAQ.STOCK";
historyParam.symbol = "LNUX";
historyParam.period = FD_DAILY;
historyParam.field = FD_CLOSE|FD_VOLUME;
retCode = FD_HistoryAlloc( unifiedDatabase, &historyParam, &data );
if( retCode == FD_SUCCESS )
{
for( i=0; i < data->nbBars; i++ )
printf( "%f %d\n", data->close[i], data->volume[i] );
FD_HistoryFree( data );
}
}
/* Clean-up and exit. */
FD_UDBaseFree( unifiedDatabase );
FD_Shutdown();
return 0;
}
How are the split/dividend handled? The unified database assume all the data source are split adjusted to the latest date. If the data source provides split/adjustment information, the user can choose to retrieve adjusted or non-adjusted data.
Which data source are supported by FIDAL?
What happen if the same symbol is provided from multiple data source? All the data source belonging to the same unified database are always merged together. The order in which the data source where added with FD_AddDataSource did determined which data takes precedence on the other. The first added data source is the "least important" one, and the data provided by the last one cannot be override by the others. Example 1: You have a local database and you want an online data source to provide the missing data. You will add the online data source last. The merging is independently performed down to each price bar. Think about it... that's a lot of flexibility for managing your data! Example 2: You have a local read-only CD with an error on a couple of price bars. You can "cover" the erroneous data by putting the correct price bars in a file on your hard disk. Build the unified database by adding first the CD data source and then add the hard disk data source. That way, the price bars from the hard disk data will override the wrong price bar from the CD. This will effectively correct the error.
Is the library multithread safe? Yes. The makefiles generates both a single thread and multi-thread static library. |
|