ghfd_read_file: Reads zip file downloaded from Bovespa ftp (trades or orders)

Description Usage Arguments Value Examples

View source: R/ghfd_read_file.R

Description

Reads zip file downloaded from Bovespa ftp (trades or orders)

Usage

1
2
3
ghfd_read_file(out.file, my.assets = NULL, type.matching = "exact",
  type.data = "trades", first.time = "10:00:00",
  last.time = "17:00:00", type.output = "agg", agg.diff = "15 min")

Arguments

out.file

Name of zip file

my.assets

The tickers (symbols) of the derised assets to import data (e.g. c('PETR4', 'VALE5')). The function allow for partial patching (e.g. 'PETR' for all assets related to Petrobras). Default is set to NULL (download all available tickers)

type.matching

Type of matching for asset names in data ('exact' or 'partial')

type.data

The type of financial data to download and aggregate ('trades' or 'orders').

first.time

The first intraday period to import the data. All trades/orders before this time of day are ignored. As character, e.g. '10:00:00'.

last.time

The last intraday period to import the data. All trades/orders after this time of day are ignored. As character, e.g. '18:00:00'.

type.output

Defines the type of output of the data. The choice 'agg' outputs aggregated data for time intervals defined in agg.diff. The choice 'raw' outputs the raw, tick by tick/order by order, data from the zip files.

agg.diff

The time interval used in the aggregation of data. Only used for type.output='agg'. It should contain a integer followed by a time unit ('sec' or 'secs', 'min' or 'mins', 'hour' or 'hours', 'day' or 'days'). Example: agg.diff = '15 mins', agg.diff = '1 hour'.

Value

A dataframe with the raw (tick by tick/order by order) dataset

Examples

1
2
3
4
5
6
7
my.assets <- c('ABEVA20', 'PETRL78')

## getting data from local file (in practice it would be downloaded from ftp)
out.file <- system.file("extdata", 'NEG_OPCOES_20151126.zip', package = "GetHFData")

df.out <- ghfd_read_file(out.file, my.assets)
print(head(df.out))

GetHFData documentation built on Oct. 11, 2018, 1:03 a.m.