The master record contains the last 4 dividend actions.
All you have to do is read the master record for each symbol and dump the dividend records.
This code is from the main.cpp example
void PrintDividends( char *sym ) { int erc , j ;
usr_master_def master;
memset( &master, 0, sizeof( usr_master_def ) ); erc = R2_Open_Files( MASTER_FILE , dirbuff );//open the master file
if ( erc != 0 )//if this is true then there was an error { printf( "Error code %d received on open master file\n" , erc ); return; }
//read the master and put the output into the master struct
erc = R2_QP_ReadMaster( QP_EQUAL , QP_SYMBOL, sym, &master );
if ( erc == 0 )//Zero on the previous call means it was successful {
printf( "\nDividends for %s \n" , sym );
for ( j=0 ; j<4 ; j++ ) { printf( "Payable date %02d/%02d/%04d Amount %10.4f Type %c%c\n" , master.divs[j].Pay_date.month , master.divs[j].Pay_date.day , master.divs[j].Pay_date.year , master.divs[j].rate , master.divs[j].flag[0] , master.divs[j].flag[1] ); } }
R2_Close_Files( MASTER_FILE );//close the master file
}
You would have to expand the date print code for each date:
Ex_date; Ex distribution date Rec_date; Record date Pay_date; Payable date Ann_date; Announcement date
Gary
|