[R-SIG-Finance] GetSymbols & Weekend Data

Mark Harrison harrisonmark1 at gmail.com
Tue Apr 3 22:39:28 CEST 2012


Running into an issue when trying to use hourly FX data from
Interactive Brokers with getSymbols.  I have R all setup with
iBrokers, Quantmod, FI, etc so that I can run a script to grab hourly
FX data and save it to a file.

The problem is that I see the weekend data in my dataset from IB and
when I save my data to file I see a data file for the weekend day -
e.g. 4/1/2012 - but when I retrieve the data using getSymbols the
weekend data is ignored.

Is ignoring weekend data just a design issue in getSymbols and if so
how do I get around it or is there another way I can load multiple rda
files into one object.  I have tried to figure out a different way to
load the data but am not finding any answers in the help archives or R
books I have.

Any help would be appreciated.

Thanks,
Mark



My info and code examples are below:

# Session Info

R version 2.14.0 (2011-10-31)
Platform: x86_64-pc-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] datasets  grDevices utils     graphics  stats     methods   base

other attached packages:
 [1] blotter_0.8.4              fTrading_2110.77
fBasics_2110.79
 [4] MASS_7.3-16                timeSeries_2140.93
timeDate_2150.95
 [7] twsInstrument_1.3-1        IBrokers_0.9-3             qmao_1.1.6
[10] FinancialInstrument_0.10.9 quantmod_0.3-17            TTR_0.21-0
[13] Defaults_1.1-1             xts_0.8-4                  zoo_1.7-7

loaded via a namespace (and not attached):
[1] grid_2.14.0      lattice_0.20-3   quantstrat_0.6.1 tools_2.14.0


# Hourly Data straight from IB for USDCHF
2012-03-30 14:00:00     0.902875     0.902950    0.902375      0.902725
2012-03-30 15:00:00     0.902725     0.902825    0.902225      0.902525
2012-04-01 16:15:00     0.901075     0.901275    0.900900      0.901175
2012-04-01 17:00:00     0.901175     0.901400    0.900375      0.900575
2012-04-01 18:00:00     0.900575     0.901475    0.900550      0.901400

# Save above data to disk
saveSymbols.days("USCHF", base_dir="~/Hour", extension='rda')

# Load data from disk
getSymbols.FI("USCHF", dir = "~/Hour"  )

# Hourly Date retrieved from disk - note the data goes from 3/30 to
4/2 skipping 4/1
2012-03-30 14:00:00     0.902875     0.902950    0.902375      0.902725
2012-03-30 15:00:00     0.902725     0.902825    0.902225      0.902525
2012-04-02 00:00:00     0.902650     0.902875    0.901975      0.902875
2012-04-02 01:00:00     0.902875     0.903125    0.901600      0.902350



More information about the R-SIG-Finance mailing list