FIDAL - Financial Data Access Library

  Home | Documentation | Download
 

 

CSI Data Source

1.0 Introduction

2.0 FD_AddDataSource Parameters Details

horizontal rule

1.0 Introduction

This data source gives access to files of type CSI and CSIM (old metastock). These files can be exported/imported by some technical analysis or data provider software. You can recognize these files with names like "Qmaster", "Qmaster2", "Master", "F001.dta"...

The data sources have been tested with the product "Unfair Advantage" from Commodity Systems Inc.

All the symbols are placed in the category "CSI_ID". The symbols are numbers, as defined by the master/index file provided by the data vendor. For Commodity Systems customer this number is called the "CSI #".

These data sources work both on Linux and Windows.

Example:

  FD_AddDataSourceParam param;
  FD_HistoryAllocParam  histParam;
  FD_History           *history;
  FD_UDBase            *udb;
  FD_RetCode            retCode;

  /* Initialize FIDAL and create a unified database. */
  retCode = FD_Initialize( NULL );
  if( retCode != FD_SUCCESS )
     return -1;

  retCode = FD_UDBaseAlloc( &udb );
  if( retCode != FD_SUCCESS )
  {
     FD_Shutdown();
     return -2;
  }

  /* Add the data source to the unified database. */
  memset( param, 0 , sizeof(FD_AddDataSourceParam) );
  param.id = FD_CSI;
  param.location = "C://MyData";
  retCode = FD_AddDataSource( udb, &param );
  if( retCode == FD_SUCCESS )
     printf( "CSI data source successfully added" );
  else
  {
     FD_UDBaseFree(udb);
     FD_Shutdown();
     return -3;
  }
 
  /* You can now start to get historical data. */
  memset( &histParam, 0, sizeof( FD_HistoryAllocParam ) );
  histParam.category = "CSI_ID";
  histParam.symbol = "5159"; /* IBM Stock on NYSE. */
  histParam.period = FD_DAILY;
  retCode = FD_HistoryAlloc( udb, &histParam, &history );

  /* Display each day with its close price. */
  if( retCode == FD_SUCCESS )
  {
    if( history->nbBars == 0 )
      printf( "No data available" );
    else
    {
      for( int i=0; i < history->nbBars; i++ )
      {
         printf( "%d-%d-%d", FD_GetMonth(&history->timestamp[i]),
                             FD_GetDay(&history->timestamp[i]),
                             FD_GetYear(&history->timestamp[i]) );
         printf( ",%.2f", history->close[i] );
      }
    }
    /* Free the data once done. */
    FD_HistoryFree( history );
  }

 /* Clean-up if you are done with FIDAL */
 FD_UDBaseFree( udb );
 FD_Shutdown();
 

This example will work starting with release 0.1.2

horizontal rule

2.0 FD_AddDataSource Parameters Details

Here are a quick overview of how each FD_AddDataSource parameters are used for this data source:

'param.id'
Must be FD_CSI or FD_CSIM

'param.location'
The path where the files will be find. Do not specify the name of the index file, just provide the path to the directory. You can use forward or backward slash in the path, these will be adapted to the platform on which FIDAL is running (Unix vs Win32). Leave to NULL for current directory.

'param.info'
Unused. Must be NULL.

'param.category', 'param.country', 'param.exchange', 'param.type'
Unused. Must be NULL.

'param.username', 'param.password'
Unused. Must be NULL.

'param.flags'
Unused. Must be FD_NO_FLAGS (0).

Google  SourceForge Logo
  Web FidalSoft.org
 

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