count_functions {RITCH}R Documentation

Counts the messages of an ITCH-file

Description

Counts the messages of an ITCH-file

Usage

count_messages(
  file,
  add_meta_data = FALSE,
  buffer_size = -1,
  quiet = FALSE,
  force_gunzip = FALSE,
  gz_dir = tempdir(),
  force_cleanup = TRUE
)

count_orders(x)

count_trades(x)

count_modifications(x)

count_system_events(x)

count_stock_directory(x)

count_trading_status(x)

count_reg_sho(x)

count_market_participant_states(x)

count_mwcb(x)

count_ipo(x)

count_luld(x)

count_noii(x)

count_rpii(x)

Arguments

file

the path to the input file, either a gz-file or a plain-text file

add_meta_data

if the meta-data of the messages should be added, defaults to FALSE

buffer_size

the size of the buffer in bytes, defaults to 1e8 (100 MB), if you have a large amount of RAM, 1e9 (1GB) might be faster

quiet

if TRUE, the status messages are supressed, defaults to FALSE

force_gunzip

only applies if file is a gz-file and a file with the same (gunzipped) name already exists. if set to TRUE, the existing file is overwritten. Default value is FALSE

gz_dir

a directory where the gz archive is extracted to. Only applies if file is a gz archive. Default is tempdir().

force_cleanup

only applies if file is a gz-file. If force_cleanup=TRUE, the gunzipped raw file will be deleted afterwards.

x

a file or a data.table containing the message types and the counts, as outputted by count_messages

Details

Value

a data.table containing the message-type and their counts for count_messages or an integer value for the other functions.

Examples

file <- system.file("extdata", "ex20101224.TEST_ITCH_50", package = "RITCH")
count_messages(file)
count_messages(file, add_meta_data = TRUE, quiet = TRUE)

# file can also be a .gz file
gz_file <- system.file("extdata", "ex20101224.TEST_ITCH_50.gz", package = "RITCH")
count_messages(gz_file, quiet = TRUE)

# count only a specific class
msg_count <- count_messages(file, quiet = TRUE)

# either count based on a given data.table outputted by count_messages
count_orders(msg_count)

# or count orders from a file and not from a msg_count
count_orders(file)

### Specific class count functions are:
count_orders(msg_count)
count_trades(msg_count)
count_modifications(msg_count)
count_system_events(msg_count)
count_stock_directory(msg_count)
count_trading_status(msg_count)
count_reg_sho(msg_count)
count_market_participant_states(msg_count)
count_mwcb(msg_count)
count_ipo(msg_count)
count_luld(msg_count)
count_noii(msg_count)
count_rpii(msg_count)

[Package RITCH version 0.1.26 Index]