sig_data.c - SIGnal DATA collection routines
a hack of the routines from sig_dnld.c to data collect under Windows.
Function
|
chk_if_tokens_same_len
|
Include file
|
SIG_DATA.H
|
Prototype
|
int chk_if_tokens_same_len(
char *close_ptr , char *high_ptr , char *low_ptr , char *open_ptr ) ;
int chk_for_null_token( char *target , int err_idx ) ;
void chk_for_reload_from_checkpoint( void ) ;
void test_hook( void ) ;
|
Remarks
|
|
Function
|
ld_ascii_data_file
|
Include file
|
SIG_DATA.H
|
Prototype
|
|
Remarks
|
//void ld_ascii_data_file(
char *file_name , FPTR process_routine , BOOL echo_flag ) ;
void set_system_time( int hour , int min , int sec ) ;
long get_system_time( void ) ;
|
Function
|
init_sig_data_vars
|
Include file
|
SIG_DATA.H
|
Prototype
|
void init_sig_data_vars( void )
|
Remarks
|
Application start-up so init the Signal data collection subsystem.
Allocate the input buffer and set the pointers. Build the initial collection
binary tree and init the time event queue. And lastly open the debug &
market message log file and send a startup msg out the debug port.
|
Function
|
output_sig_data
|
Include file
|
SIG_DATA.H
|
Prototype
|
void output_sig_data( void )
|
Remarks
|
Main call to get the signal data flushed to disk.
|
Function
|
store_input_data
|
Include file
|
SIG_DATA.H
|
Prototype
|
void store_input_data( char *inBuff )
|
Remarks
|
Here is where fresh data from the serial port enters the subsystem.
Move the data character by character in the input buffer. If the current
character is the NEWLINE then we have a complete quote message. So call
store_a_quote_line() to get it added to the tree. And last thing as we are
leaving we check the time event queue.
|
Function
|
output_daily_data
|
Include file
|
SIG_DATA.H
|
Prototype
|
void output_daily_data( char *output_file_name )
|
Remarks
|
Walk the collection tree and output the current values to a disk file
named - output_file_name. And set the dirty flag to FALSE.
|
Function
|
do_special_processing_b4_output
|
Include file
|
SIG_DATA.H
|
Prototype
|
void do_special_processing_b4_output( DT_REC node )
|
Remarks
|
This is a hook routine. Check if we need to do any special processing on
the given ticker before we output it. Current the routine does 2 things.
For TBond data it converts the 1/32's in decimal values. And for user marked
secondary indexes like Value Line and S & P it clones the NYSE volume
to the node.
|
Function
|
convert_tbond_quote
|
Include file
|
SIG_DATA.H
|
Prototype
|
void convert_tbond_quote( DT_REC node )
|
Remarks
|
For this node (which we know is a TBond quote) convert the price from
1/32 style to decimal.
|
Function
|
mins_past_midnight_to_HH_MM
|
Include file
|
SIG_DATA.H
|
Prototype
|
char *mins_past_midnight_to_HH_MM( int bin_time )
|
Remarks
|
Convert a minutes past midnight binary time into a "HH:MM" string and
return it to the caller.
|
Function
|
add_time_convert
|
Include file
|
SIG_DATA.H
|
Prototype
|
void add_time_convert( char *quote_line )
|
Remarks
|
If the last value of the quote looks like a minutes past midnight value
convert it to a user-friendly "HH:MM" string and append it to the quote string.
|
Function
|
store_current_btree_node
|
Include file
|
SIG_DATA.H
|
Prototype
|
void store_current_btree_node( DT_REC node )
|
Remarks
|
This is the main dispatch point to store the current quote string into the
found node. Before the store add a time_convert to the quote. Do a switch
branch for the correct node type. And maybe also echo the quote string out
the data_channel.
|
Function
|
store_current_node_index
|
Include file
|
SIG_DATA.H
|
Prototype
|
void store_current_node_index( DT_REC node )
|
Remarks
|
Validate and maybe store the current index quote into the given node.
|
Function
|
chk_token_size
|
Include file
|
SIG_DATA.H
|
Prototype
|
int chk_token_size( char *target1 , char *target2 )
|
Remarks
|
Compare two price string and if the larger is more than 150 % bigger then
the smaller assume one is a bad quote and return TRUE to signal a bad
tick. (Also log the error to disk and out the debug port.)
|
Function
|
chk_if_tokens_same_len
|
Include file
|
SIG_DATA.H
|
Prototype
|
int chk_if_tokens_same_len(
char *close_ptr , char *high_ptr , char *low_ptr , char *open_ptr )
|
Remarks
|
Check if the quote ptrs are all the same length. If not check the percentage
sizes of the data values with chk_token_size() before deciding that this
is a bad tick. Return TRUE is bad. (And again log the error to the disk file
and out the debug port.)
|
Function
|
store_current_node_future
|
Include file
|
SIG_DATA.H
|
Prototype
|
void store_current_node_future( DT_REC node )
|
Remarks
|
Validate and maybe store the current futures quote into the given node.
This code is for TradeStation version 3.5.
|
Function
|
store_current_node_future
|
Include file
|
SIG_DATA.H
|
Prototype
|
void store_current_node_future( DT_REC node )
|
Remarks
|
Validate and maybe store the current futures quote into the given node.
This code is for TradeStation version 4.0.
|
Function
|
store_current_node_stock
|
Include file
|
SIG_DATA.H
|
Prototype
|
void store_current_node_stock( DT_REC node )
|
Remarks
|
Validate and maybe store the current stock quote into the given node.
|
Function
|
store_current_node_m_fund
|
Include file
|
SIG_DATA.H
|
Prototype
|
void store_current_node_m_fund( DT_REC node )
|
Remarks
|
Validate and maybe store the current mutual fund quote into the given node.
|
Function
|
store_current_node_mrk_msg
|
Include file
|
SIG_DATA.H
|
Prototype
|
void store_current_node_mrk_msg( DT_REC node )
|
Remarks
|
Market messages are a little different. The node is just a hook to get us
here. If the msg_file is open - write the msg to disk and send the msg
out the msg_channel.
|
Function
|
store_scale_factor
|
Include file
|
SIG_DATA.H
|
Prototype
|
void store_scale_factor( DT_REC node , int idx )
|
Remarks
|
Convert the Signal scale character into floats - scale_factor and places and
update the vars in the node.
|
Function
|
set_type_4_virgin_btree_node
|
Include file
|
SIG_DATA.H
|
Prototype
|
void set_type_4_virgin_btree_node( DT_REC node )
|
Remarks
|
Set the type for the new node from the second token in the quote str.
|
Function
|
lc_add_btree_node
|
Include file
|
SIG_DATA.H
|
Prototype
|
DT_REC lc_add_btree_node( char *key_str )
|
Remarks
|
Local add_btree_node(). The only difference from the library routine is
the setting of the node type string by set_type_4_virgin_btree_node().
|
Function
|
lc_add_2_binary_tree
|
Include file
|
SIG_DATA.H
|
Prototype
|
DT_REC lc_add_2_binary_tree( DT_REC node , char *key_str )
|
Remarks
|
Local add_2_binary_tree() - same as the standard routine (except of course
the DT_REC structure :-).
|
Function
|
lc_find_btree_node
|
Include file
|
SIG_DATA.H
|
Prototype
|
DT_REC lc_find_btree_node( DT_REC node , char *key_str )
|
Remarks
|
Local find_btree_node().
|
Function
|
lc_find_btree_node_with_chk
|
Include file
|
SIG_DATA.H
|
Prototype
|
DT_REC lc_find_btree_node_with_chk( DT_REC node , char *key_str )
|
Remarks
|
This is a local find_btree_node() with one important difference. If the
target node is not in the collection tree, then return a pointer to a empty
dummy structure.
|
Function
|
lc_walk_binary_tree
|
Include file
|
SIG_DATA.H
|
Prototype
|
void lc_walk_binary_tree( DT_REC node , FPTR process_routine )
|
Remarks
|
A local walk_binary_tree() .
|
Function
|
output_btree_node
|
Include file
|
SIG_DATA.H
|
Prototype
|
void output_btree_node( DT_REC node )
|
Remarks
|
Output a given node to disk. First copy the node to a temporary DT_REC so
any special scaling or conversion before output will not effect the collecting
node. Then do a switch branch for the different data types.
|
Function
|
output_btree_node_future
|
Include file
|
SIG_DATA.H
|
Prototype
|
void output_btree_node_future( DT_REC node )
|
Remarks
|
Dump a futures quote to disk honoring the calculated places.
|
Function
|
output_btree_node_index
|
Include file
|
SIG_DATA.H
|
Prototype
|
void output_btree_node_index( DT_REC node )
|
Remarks
|
Dump a market index quote to disk honoring the calculated places.
|
Function
|
output_btree_node_stock
|
Include file
|
SIG_DATA.H
|
Prototype
|
void output_btree_node_stock( DT_REC node )
|
Remarks
|
Dump a stock quote to disk honoring the calculated places.
|
Function
|
output_btree_node_m_fund
|
Include file
|
SIG_DATA.H
|
Prototype
|
void output_btree_node_m_fund( DT_REC node )
|
Remarks
|
Dump a mutual fund quote to disk honoring the calculated places.
|
Function
|
dump_ticker_array
|
Include file
|
SIG_DATA.H
|
Prototype
|
void dump_ticker_array( void )
|
Remarks
|
For debugging purposes - dump the collection tree to disk.
|
Function
|
lc_print_btree_node
|
Include file
|
SIG_DATA.H
|
Prototype
|
void lc_print_btree_node( DT_REC node )
|
Remarks
|
Do a debug dump for a given ticker node.
|
Function
|
compress_daily_data_file
|
Include file
|
SIG_DATA.H
|
Prototype
|
void compress_daily_data_file( void )
|
Remarks
|
This is a hook routine to compress the daily output file. For easy parsing
when I first write the file I included lots of white space. Then after the
file has been stored in my databases I rerun TDY_TTY and eat the white space.
(All done automatically via a batch file - you don't expect me to type do you?)
|
Function
|
compress_a_daily_quote
|
Include file
|
SIG_DATA.H
|
Prototype
|
void compress_a_daily_quote( char *quote )
|
Remarks
|
Compress one line.
|
Function
|
store_a_quote_line
|
Include file
|
SIG_DATA.H
|
Prototype
|
void store_a_quote_line( char *input_line )
|
Remarks
|
This is the main routine to actually store the quote string. It will first
echo the quote str out the echo_channel. Then it will set the parsing pointers.
If this is a time stamp msg - it will be processed and the routine will split.
Else if it is long enough it must be a data quote, so check the tree to see if
we have seen it already - if not add a new node to the tree. Then call
store_current_btree_node() to get the actual store done.
|
Function
|
set_token_ptrs
|
Include file
|
SIG_DATA.H
|
Prototype
|
void set_token_ptrs( char *buff )
|
Remarks
|
Process the input quote string buff by walking the buffer and setting
the token ptrs to the beginning of each token string and NULL-ing out
each comma character "," to terminate each token str.
|
Function
|
test_hook
|
Include file
|
SIG_DATA.H
|
Prototype
|
void test_hook( void )
|
Remarks
|
This is a test hook for new development testing.
|
Function
|
init_collection_tree
|
Include file
|
SIG_DATA.H
|
Prototype
|
void init_collection_tree( void )
|
Remarks
|
Initialize the collection tree with a few dummy nodes for tree balancing
and a few special data nodes.
|
Function
|
build_special_data
|
Include file
|
SIG_DATA.H
|
Prototype
|
void build_special_data( void )
|
Remarks
|
Lookup up a bunch of market tickers and update the special dow data
nodes with the combined info.
Dow Data file layouts -
A date , avol , dvol , nyv , adv
B date , adv , tick , trin , decl
C date , 1st hr change , 1st hr vol , last hr change , last hr vol
D date , 0.0 , 0.0 , Adv - Decl , 0.0
normal date , high , low , close , volume
|
Function
|
update_clone_nyse_volume
|
Include file
|
SIG_DATA.H
|
Prototype
|
void update_clone_nyse_volume( void )
|
Remarks
|
Clone the NYSE volume to a bunch of other market index tickers.
|
Function
|
update_dt_rec_with_nyse_volume
|
Include file
|
SIG_DATA.H
|
Prototype
|
void update_dt_rec_with_nyse_volume( char *target )
|
Remarks
|
Update the given ticker with the NYSE volume.
|
Function
|
init_time_event_queue
|
Include file
|
SIG_DATA.H
|
Prototype
|
void init_time_event_queue( void )
|
Remarks
|
Initialize the time event queue.
|
Function
|
chk_time_event_queue
|
Include file
|
SIG_DATA.H
|
Prototype
|
void chk_time_event_queue( void )
|
Remarks
|
Check if we have a time event firing.
|
Function
|
chk_4_special_output_format
|
Include file
|
SIG_DATA.H
|
Prototype
|
void chk_4_special_output_format( DT_REC node )
|
Remarks
|
Check if we want a special output format for the given ticker.
This currently only modifies future tickers.
|
Function
|
chk_if_numeric_str
|
Include file
|
SIG_DATA.H
|
Prototype
|
int chk_if_numeric_str( char *ticker )
|
Remarks
|
A simple check to filter out numbers from being stored as tickers.
|
Function
|
chk_for_null_token
|
Include file
|
SIG_DATA.H
|
Prototype
|
int chk_for_null_token( char *target , int err_idx )
|
Remarks
|
Check if a token ptr that should be pointing to a valid token str is instead
pointing to a NULL str (bad tick).
|
Function
|
chk_if_token_too_long
|
Include file
|
SIG_DATA.H
|
Prototype
|
int chk_if_token_too_long( char *target , int len , int err_idx )
|
Remarks
|
Check if a token str is longer than it should be (bad tick).
|
Function
|
dump_token_ptrs
|
Include file
|
SIG_DATA.H
|
Prototype
|
void dump_token_ptrs( void )
|
Remarks
|
Dump the token ptr array to the debug port.
|
Function
|
cnvt_to_system_time
|
Include file
|
SIG_DATA.H
|
Prototype
|
long cnvt_to_system_time( int hour , int min , int sec )
|
Remarks
|
Convert the given HH:MM:SS value into seconds past midnight.
|
Function
|
get_system_time
|
Include file
|
SIG_DATA.H
|
Prototype
|
long get_system_time( void )
|
Remarks
|
Get the current time in seconds past midnight.
|
Function
|
chk_for_reload_from_checkpoint
|
Include file
|
SIG_DATA.H
|
Prototype
|
void chk_for_reload_from_checkpoint( void )
|
Remarks
|
//
|
Function
|
reload_a_quote
|
Include file
|
SIG_DATA.H
|
Prototype
|
void reload_a_quote( char *str )
|
Remarks
|
//
|
Function
|
eat_trailing_white_space
|
Include file
|
SIG_DATA.H
|
Prototype
|
void eat_trailing_white_space( char *str )
|
Remarks
|
Delete trailing white space from a str.
|
Function
|
cnvt_nl_2_null
|
Include file
|
SIG_DATA.H
|
Prototype
|
void cnvt_nl_2_null( char *str )
|
Remarks
|
Replace all embedded newlines in source str with \000 (yielding
substrings in the main string).
|
Function
|
ld_ascii_data_file
|
Include file
|
SIG_DATA.H
|
Prototype
|
void ld_ascii_data_file(
char *file_name , FPTR process_routine , BOOL echo_flag )
|
Remarks
|
Load a ASCII file and call a process routine for each line of the file.
Set echo_flag to TRUE to get a debug dump to scr. If the process routine
wants to know where it is it should IMPORT and reference ASCII_line_num.
The process routine should expect one parameter, a char *. Lines beginning
with a COMMENT_CHAR (currently defined as "#") will not to sent to the
process_routine.
|
Function
|
set_system_time
|
Include file
|
SIG_DATA.H
|
Prototype
|
void set_system_time( int hour , int min , int sec )
|
Remarks
|
A simple set system time (for Windows 95 only.)
|
Table of Contents
Function Index
generated on 22 September 1998 - 12:55:33
© 1998 Tierra del Fuego Ltd.
|