CSTM2RPT.C
A program to easily run multiple indicators and systems in parallel
against a data set and then generate a custom report for the user.
Function
|
set_token_ptrs
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void set_token_ptrs( char *input_line )
|
Remarks
|
This is the first major routine used to parse the user's template line into
something meaningful. This routine will init all line parse vars and
tokens[] array. It will then break the input_line into white-space
delimited NULL terminated token strings (this means input_line is changed).
At exit the the array token_cnt is set and the tokens[].str sections look
like a AWK $1 , $2 .. $N token array (this means tokens[ 0 ].str contains
the first token on the line, etc.).
|
Function
|
set_token_flags
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void set_token_flags( void )
|
Remarks
|
Now that the tokens[] array is built, we'll try is see if we can recognize
any of the tokens as special flag verbs. If we do - hit the appropriate
special flag and mark the token as used.
|
Function
|
special_token_saves
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void special_token_saves( void )
|
Remarks
|
Now handle the parentheses and equal sign assignments (and mark as
used). Also update the cur_prc_rec->spec_output_flag if necessary.
|
Function
|
get_first_int_arg
|
Include file
|
CSTM2RPT.H
|
Prototype
|
int get_first_int_arg( void )
|
Remarks
|
Return the first token string after the primary verb that begins with
a digit and don't worry if it has been used yet. Return 0 if none found.
|
Function
|
get_first_unused_int_arg
|
Include file
|
CSTM2RPT.H
|
Prototype
|
int get_first_unused_int_arg( void )
|
Remarks
|
Return the first token string after the primary verb that begins with
a digit and this time check that it hasn't been used yet. Mark it as now
having been used. Return 0 if none found.
|
Function
|
get_first_unused_arg
|
Include file
|
CSTM2RPT.H
|
Prototype
|
char *get_first_unused_arg( void )
|
Remarks
|
Get the first unused argument of any type. If we are parsing a math
operation then we start with the first token str else we skip the primary
verb token and begin searching at the next token. Return NULL if none found.
|
Function
|
get_first_unused_arg_n_mark_used
|
Include file
|
CSTM2RPT.H
|
Prototype
|
char *get_first_unused_arg_n_mark_used( void )
|
Remarks
|
Get the first unused argument of any type. If we are parsing a math
operation then we start with the first token str else we skip the primary
verb token and begin searching at the next token. This time mark the found
one as used. Return NULL if none found.
|
Function
|
get_label_str
|
Include file
|
CSTM2RPT.H
|
Prototype
|
char *get_label_str( void )
|
Remarks
|
Try a number of sources to generate a label str for the cur_prc_rec. First
check if the user gave us one, if so, return a clone of it. Then check if
the cur_prc_rec is something other than a file constant. If it is and the
cur_prc_rec->spec_proc_flag does not have the NO_SIZE bit set then build a
label str consisting df_label[ verb_idx] plus the size value the user gave
us. Else just return the df_label[ verb_idx ].
|
Function
|
get_unused_label_str
|
Include file
|
CSTM2RPT.H
|
Prototype
|
char *get_unused_label_str( void )
|
Remarks
|
Scan the tokens and return the first unused label_str (and mark it as used)
or return NULL.
|
Function
|
get_label_str_secondary
|
Include file
|
CSTM2RPT.H
|
Prototype
|
char *get_label_str_secondary( int src_idx , int size )
|
Remarks
|
Return a copy of the secondary data source's label str. If size != 0
append it to the label str too.
|
Function
|
make_secondary_label_str
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void make_secondary_label_str( char *buffer , char *df_msg )
|
Remarks
|
Check if we have an available user supplied label str and either copy it
(if found) else the df_msg into the caller's buffer.
|
Function
|
set_data_source_n_labels
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void set_data_source_n_labels( int size )
|
Remarks
|
Set the data_source and label_str for the cur_prc_rec. Also hook the
label_str to the right slot in the ref_strs[ output_cnt ].
|
Function
|
chk_4_label_update_with_defaults
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void chk_4_label_update_with_defaults( int size , char *use_this_label )
|
Remarks
|
If the user didn't give us a size on an indicator that has defaults, we
need to update the label_str with the indicator's default size. Also hook
the label_str to the right slot in the ref_strs[ output_cnt ].
|
Function
|
bld_ind_label_str
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void bld_ind_label_str( char *base_str , int df_length )
|
Remarks
|
Build a indicator label str and hook it up to the ref_strs[ output_cnt ]
array.
|
Function
|
get_format_str
|
Include file
|
CSTM2RPT.H
|
Prototype
|
char *get_format_str( void )
|
Remarks
|
Return either the user provided format str else the df_formats[ verb_idx ].
|
Function
|
report_unused_tokens
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void report_unused_tokens( void )
|
Remarks
|
OK everything is parsed, check if we've got anything marked as still
unused. If so, tell the user.
|
Function
|
set_output_formats
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void set_output_formats( void )
|
Remarks
|
Set the default price data output format str (depending on output_places).
|
Function
|
clone_cur_prc_rec
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void clone_cur_prc_rec( char *label_str , int no_out_flag , int no_tsig_flag )
|
Remarks
|
Clone a copy of the cur_prc_rec, update the ref_strs[ output_cnt ] array.
At exit the cur_prc_rec will point to the new PRC_REC.
|
Function
|
inc_cur_prc_rec
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void inc_cur_prc_rec( void )
|
Remarks
|
Since prc_master->prc_rec[] is an array of ptrs a simple cur_prc_rec++
won't work.
|
Function
|
dec_cur_prc_rec
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void dec_cur_prc_rec( void )
|
Remarks
|
ditto
|
Function
|
dump_ticker_str
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void dump_ticker_str( char *ticker )
|
Remarks
|
Dump the ticker str to the report and to the user so he sees that
something is happening.
|
Function
|
rpt_template_error
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void rpt_template_error( char *msg )
|
Remarks
|
Report that a error occured in parsing a template line.
|
Function
|
ln_to_upper_except_in_dquotes
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void ln_to_upper_except_in_dquotes( char *str )
|
Remarks
|
Convert all lower case characters in a str to upper case except the
characters in between double quotes.
exp - this is a "test" becomes THIS IS A "test"
|
Function
|
eat_commas_except_in_dquotes
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void eat_commas_except_in_dquotes( char *str )
|
Remarks
|
Change all commas found in a str to spaces except the ones inside
of double quotes.
|
Function
|
eat_white_space_in_str
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void eat_white_space_in_str( char *src , char *dest ) // do the tighten-up
|
Remarks
|
Delete all white_space from a str.
|
Function
|
is_this_a_number_str
|
Include file
|
CSTM2RPT.H
|
Prototype
|
int is_this_a_number_str( char *target )
|
Remarks
|
Return TRUE is the target str is a number else FALSE.
|
Function
|
strncpy_n_blank_pad
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void strncpy_n_blank_pad( char *dest , char *src , int len )
|
Remarks
|
Do a strncpy then space pad to the caller's request length.
|
Function
|
rpt_memory_left_if_debug_flag
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void rpt_memory_left_if_debug_flag( void )
|
Remarks
|
If the debug_flag == TRUE then report currently available near memory.
|
Function
|
dump_prc_master_if_debug_flag
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void dump_prc_master_if_debug_flag( void )
|
Remarks
|
If the debug_flag == TRUE then dump all the allocated process_records.
|
Function
|
output_cur_prc_rec
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void output_cur_prc_rec( void )
|
Remarks
|
Dump a debug look at the process_record pointed at by cur_prc_rec.
|
Function
|
dump_ref_str_if_debug_flag
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void dump_ref_str_if_debug_flag( void )
|
Remarks
|
If debug_flag == TRUE dump the whole ref_strs[] array.
|
Function
|
clear_the_prc_array
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void clear_the_prc_array( void )
|
Remarks
|
Init all the process_records in the prc_master struct and call their
individual init_routines (if they have one).
|
Function
|
chk_4_post_proc_requests
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void chk_4_post_proc_requests( void )
|
Remarks
|
Check for any post DATA_REC processing special requests.
|
Function
|
save_trade_signal_value
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void save_trade_signal_value( int idx , int store_value )
|
Remarks
|
Update the out_ptr->signal_state[ idx ] with the requested new store_value
and handle forward_time processing.
|
Function
|
save_output_value
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void save_output_value( float store_value )
|
Remarks
|
Update the out_ptr->data[ cur_prc_rec->output_idx ] with the requested
new store_value. Also handle user log requests and forward_time
processing.
|
Function
|
output_str_2_log_file
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void output_str_2_log_file( char *str )
|
Remarks
|
Hook to here to allow support for user requested last N records.
|
Function
|
get_data_value
|
Include file
|
CSTM2RPT.H
|
Prototype
|
float get_data_value( void )
|
Remarks
|
Fetch the current value for the defined data_source for the cur_prc_rec.
This could be either a file constant or a previously calculated process
record. The GLOBAL var last_data_value is also set.
|
Function
|
general_data_store
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void general_data_store( void )
|
Remarks
|
A generalized data store for all the file constants.
|
Function
|
cnvt_tbond_vars_if_necessary
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void cnvt_tbond_vars_if_necessary( void )
|
Remarks
|
If bond_decimal == TRUE, find all process_records with their PRICE_DATA
bit set in spec_proc_flag and convert their output values back to T-Bond
1/32s format.
|
Function
|
init_out_array
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void init_out_array( void )
|
Remarks
|
Init out_array to a double linked circular queue.
|
Function
|
clear_the_out_array
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void clear_the_out_array( void )
|
Remarks
|
Clear all the out_ptr's data and signal_state buckets for all the
process records.
|
Function
|
output_the_out_array
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void output_the_out_array( void )
|
Remarks
|
OK the processing is all done so dump the out_array to output_device and
give the user his report.
|
Function
|
compare_dates
|
Include file
|
CSTM2RPT.H
|
Prototype
|
static int compare_dates( float date1 , float date2 )
|
Remarks
|
A simple compare function that returns values like strcmp, 0 = match,
-1 = date1 date2.
|
Function
|
find_rec_by_date
|
Include file
|
CSTM2RPT.H
|
Prototype
|
int find_rec_by_date( float target_date )
|
Remarks
|
Given a already open data file, search forward with retrys for a target
date. Calls find_rec_by_date2 for each attempt.
|
Function
|
find_rec_by_date2
|
Include file
|
CSTM2RPT.H
|
Prototype
|
static int find_rec_by_date2( float target_date )
|
Remarks
|
This routine will search a file for a target_date.
|
Function
|
test_find_rec_by_date
|
Include file
|
CSTM2RPT.H
|
Prototype
|
int test_find_rec_by_date( void )
|
Remarks
|
|
Function
|
clone_2_far_n_free
|
Include file
|
CSTM2RPT.H
|
Prototype
|
DATA_REC far *clone_2_far_n_free( DATA_REC *src )
|
Remarks
|
Clone a near memory loaded DATA_REC array to far memory and free up the
near heap memory.
|
Function
|
load_secondary_data
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void load_secondary_data( void )
|
Remarks
|
Load any user requested secondary data files into far memory DATA_REC
arrays for the whole program run.
|
Function
|
init_secondary_data_ptrs
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void init_secondary_data_ptrs( void )
|
Remarks
|
Set the cur_sd?_rec and last_sd?_rec ptrs to the beginning of the
secondary data DATA_REC arrays.
|
Function
|
increment_secondary_data_ptrs
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void increment_secondary_data_ptrs( void )
|
Remarks
|
Advanced the secondary data DATA_REC array ptrs.
|
Function
|
init_forward_data
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void init_forward_data( void )
|
Remarks
|
Simulate new data by setting the current data record ptrs back with their
last_dt_rec ptrs.
|
Function
|
set_ptrs_2_next_day
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void set_ptrs_2_next_day( void )
|
Remarks
|
Calculate the next trading forward into time and update the DATA_REC
current data record ptr dates.
|
Function
|
set_file_rec_numbers
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void set_file_rec_numbers( void )
|
Remarks
|
Calculate where to start reading the file based on num_of_days_to_output,
days_needed and maybe start_date & last_date info. Will set
num_of_recs_2_read.
|
Function
|
load_the_data_array
|
Include file
|
CSTM2RPT.H
|
Prototype
|
DATA_REC *load_the_data_array( char *ticker )
|
Remarks
|
Allocate, load and return a near memory DATA_REC array with
num_of_recs_2_read data records.
|
Function
|
cnvt_bond_data_into_decimal
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void cnvt_bond_data_into_decimal( void )
|
Remarks
|
Convert the open,high,low and close fields of the main DATA_REC array
from T-Bond 1/32's into T-Bond decimal if necessary.
|
Function
|
process_the_data_array
|
Include file
|
CSTM2RPT.H
|
Prototype
|
void process_the_data_array( void )
|
Remarks
|
Run the process_records against the data arrays.
|
Function
|
calc_next_trading_date
|
Include file
|
CSTM2RPT.H
|
Prototype
|
float calc_next_trading_date( float last_rec_date )
|
Remarks
|
Convert a given date to the next market day.
|
Function
|
roll_2_tomorrow
|
Include file
|
CSTM2RPT.H
|
Prototype
|
UINT roll_2_tomorrow( UINT last_rec_julian )
|
Remarks
|
A simple (and stupid) advance to the next market day, holiday checking
is not done.
|
Table of Contents
Function Index
generated on 08 February 1998 - 14:44:04
© 1998 Tierra del Fuego Ltd.
|