get_market_data: Download historical market data

Description Usage Arguments Details Local Storage Note Examples

Description

Download historical market data

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
get_yahoo_data(symbol, from, to, split.adjusted = TRUE,
  dividend.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?

dividend.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 'Local Storage' section

code

futures or option code name, e.g. "RIU6"

contract, frequency, day_exp

same as in gen_futures_codes

Details

Use external websites to get desired symbol name for Finam, MOEX, IQFeed, Yahoo and Google sources.

IQFeed

data.table with following data returned:

daily: date, open, high, low, close, volume, open_interest
intraday: date, open, high, low, close, volume
tick: time, price, volume, size, bid, ask, tick_id, basis_for_last, trade_market_center, trade_conditions

See iqfeed specification for details.
Note: from and to can be set as text in format "YYYY-mm-dd HH:MM:SS".

Finam

data.table with following data returned:

daily: date, open, high, low, close, volume
intraday: date, open, high, low, close, volume
tick: time, price, volume

Yahoo

data.table with following data returned:

daily: date, open, high, low, close, adj_close, volume
splits and dividends: date, value, event

Google

data.table with following data returned:

daily: date, open, high, low, close, volume

MOEX

data can be retrieved from local storage only in order to minimize load on MOEX data servers. See 'Local Storage' section.

Local Storage

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.
Only IQFeed, Finam and MOEX data supported.

Note

Timestamps timezones set to UTC.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
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 )

QuantTools documentation built on Oct. 23, 2020, 7:54 p.m.