Learn R Programming

QuantTools (version 0.5.3)

get_market_data: Download historical market data

Description

Download historical market data

Usage

get_yahoo_data(symbol, from, to, split.adjusted = TRUE)
get_yahoo_splits_and_dividends(symbol, from, to = from)
get_google_data(symbol, from, to = from)
get_finam_data(symbol, from, to = from, period = "day", local = FALSE)
get_iqfeed_data(symbol, from, to = from, period = "day", local = FALSE)
get_moex_options_data(code, from, to = from, period = "tick", local = TRUE)
get_moex_futures_data(code, from, to = from, period = "tick", local = TRUE)
get_moex_continuous_futures_data(contract, from, to, frequency, day_exp)

Arguments

symbol
symbol name
from, to
text dates in format "YYYY-mm-dd"
split.adjusted
should data be split adjusted?
period
candle period tick, 1min, 5min, 10min, 15min, 30min, hour, day, week, month
local
should data be loaded from local storage? See 'Details' section
code
futures or option code name, e.g. "RIU6"
contract, frequency, day_exp

Details

Use external websites to get desired symbol name for Finam, MOEX, IQFeed, Yahoo and Google sources. Note: Timestamps timezones set to UTC. It is recommended to store tick market data locally. Load time is reduced dramatically. It is a good way to collect market data as e.g. IQFeed gives only 180 days of tick data if you would need more it will cost you a lot. See store_market_data for details. See iqfeed return format specification. MOEX data can be retrieved from local storage only in order to minimize load on MOEX data servers. Read store_market_data for information on how to store data locally.

Examples

Run this code

get_finam_data( 'GAZP', '2015-01-01', '2016-01-01' )
get_finam_data( 'GAZP', '2015-01-01', '2016-01-01', 'hour' )
get_finam_data( 'GAZP', Sys.Date(), Sys.Date(), 'tick' )

get_iqfeed_data( 'MSFT', '2015-01-01', '2016-01-01' )
get_iqfeed_data( 'MSFT', '2015-01-01', '2016-01-01', 'hour' )
get_iqfeed_data( 'MSFT', Sys.Date() - 3, Sys.Date() , 'tick' )

get_google_data( 'MSFT', '2015-01-01', '2016-01-01' )
get_yahoo_data( 'MSFT', '2015-01-01', '2016-01-01' )

get_moex_futures_data( 'RIH9', '2009-01-01', '2009-02-01', 'tick', local = T )
get_moex_options_data( 'RI55000C9', '2009-01-01', '2009-02-01', 'tick', local = T )
get_moex_continuous_futures_data( 'RI', '2016-01-01', '2016-11-01', frequency = 3, day_exp = 15 )


Run the code above in your browser using DataLab