Вот коды, которые я использую
library(quantmod)
library(timetk)
library(dplyr)
library(tibble)
library(tidyr)
mdate <- "2019-05-01"
edate <- "2019-05-03"
tickers <- c("ABG","ACH","ADM","AEG","AEM","AGQ","AGRO","APO","ARCO","ASA","ASGN","AU","AUY","AXR","BBL","BCH","BGH","BH","BHP","BIO","BMA","BSAC","BWX","BX","BZQ","CAJ",
"CBB","CCJ","CCU","CDE","CEA","CEL","CEM","CHIQ","CIB","CKH","CLF","CMRE","COPX","CORN","CRH","CRY","CUB","DBA","DBO","DBP","DDG","DGAZ","DGL","DGP","DMO","DOG","DRD",
"DRQ","DRV","DUG","DXD","ECT","EDF","EDV","EDZ","EEV","EFT","EFU","EGO","EIRL","EIS","ELJ","ENV","EPAM","EPV","ERY","EVG","EVR","EXK","FAZ","FDP","FMC","FN","FNV","FOE",
"FRO","FSM","FXE","FXF","FXY","GCI","GDX","GDXJ","GEL","GLD","GLOG","GLTR","GPX","GSH","GSL","HAL","HDB","HDGE","HHC","HIL","HL","HLF","HMY","HTGC","HTY","HVT","IAG","IAU",
"IIM","INT","IRS","ISD","JOE","KB","KEP","KFS","KGC","KMI","KOF","KOL","KOLD","KTF","LAD","LEE","LEMB","LFC","LPI","LUB","MCC","MCY","MG","MHF","MLR","MOD","MPLX","MPV","MR",
"MUX","MX","MYF","MYY","MZZ","NBR","NEM","NMI","NOAH","NTG","NUGT","NUS","PACD","PAM","PBT","PDI","PER","PGP","PHD","PHK","PHYS","PKE","POST","PPLT","PSLV","PSQ","PVG","PZN",
"QID","REK","RES","REW","RIG","RIO","RLH","RM","RWM","SBB","SBM","SBR","SCL","SDD","SDOW","SDP","SDRL","SDS","SEF","SGOL","SGU","SH","SHG","SID","SIJ","SIL","SJM","SKF","SMDD",
"SMN","SOXS","SPXS","SPXU","SRS","SRTY","SSG","SSI","SSTK","STK","STNG","SUI","SWM","SXC","SZK","TAP","TDW","TECS","TEO","TISI","TM","TMF","TRI","TTI","TWM","TYD","TYG","TZA",
"UAG","UAN","UBG","UCO","UDN","UGL","ULE","USO","UVXY","VCRA","VIPS","VIXM","VIXY","VMI","VPG","VPV","WES","WF","WMK","XBI","XEC","XPP","YCL","YINN","ZNH","ZROZ","ACP","ADC",
"AFB","AGCO","AGG","AGM","AHT","AIN","AIR","ARI","AVA","AVD","AVK","AWK","BBF","BBK","BBX","BCM","BDX","BERY","BFO","BGB","BGR","BGX","BIV","BKK","BKN","BKT","BLW","BME","BNO",
"BRFS","BSL","BTAL","BTZ","BWZ","BYM","CAE","CBD","CCO","CEW","CHEP","CHIX","CIT","CLDT","CLNY","CLW","CMF","COP","COR","CORP","CPK","CROP","CTR","CUBE","CXH","DBC","DBE","DBS",
"DFJ","DPZ","DUC","EBND","EDD","EFR","EFZ","EGPT","ELD","EMO","EOT","ETM","EUM","EWJ","EWY","EXR","EZA","EZJ","F","FCN","FEI","FGB","FLO","FOR","FSD","FTK","FXC","FXI","GBAB",
"GBF","GCC","GFY","GSG","GSP","GUNR","GXC","HHS","HIX","HYI","IDX","IO","IP","JE","JJA","JJE","JRI","KEM","KYN","LEO","LZB","MAIN","MBI","MCA","MCS","MFD","MFG","MFL","MFT",
"MFV","MMD","MPA","MQT","MTN","MUA","MUH","MXF","NAD","NMFC","NMY","NSP","NUM","OCN","PALL","PBH","PCQ","PFIG","PHX","PMF","PML","PMM","PMO","POL","PPR","PRLB","PSB","PSF",
"PYN","QLTA","RE","REMX","RJI","RJN","RXD","SA","SCHP","SCHR","SCHZ","SIVR","SMFG","SOYB","SPB","SQNS","STPZ","STWD","STZ","T","TDE","TDTF","TIP","TLH","TLI","TLK","TPZ","TR",
"TROX","TRQ","TSN","TVE","UBT","USCI","UST","USV","VEGI","VGM","VKQ","VMO","VOC","WAT","WEA","WEAT","WHG","WIW","WOR","XOM","ABT","AFC","AFK","AFT","AG","AIZ","AM","AMLP","AMT",
"AN","APD","AZZ","BAB","BAF","BBN","BCE","BGS","BIL","BLL","BNY","BOND","BPT","BQH","BSD","BSV","BUD","BWA","BXC","CAF","CANE","CBL","CIG","CMBS","CMG","CMO","CNK","CNP","CNS",
"COG","CRDb","CRL","CVE","CYB","DAN","DE","DEO","DJP","DX","EBF","EIDO","EL","EMD","EPU","EQM","ETJ","EVF","EXG","FDD","FFC","FLC","FLM","FLTR","FM","FRA","FWDB","GCV","GEN",
"GER","GIS","GNK","GNR","GRU","GRX","GSY","GXG","GYLD","HAE","HAP","HES","HPF","HPP","HYG","IHY","INGR","IPG","IQI","IVC","IX","JHS","JNK","JPS","JSD","KRO","LTC","LXP","LXU",
"MAV","MFM","MFO","MGM","MHI","MIN","MOM","MQY","MSD","MTT","MUB","MUE","MUJ","MUNI","MUS","MVC","MXI","MYI","NAN","NAZ","NBB","NCA","NDP","NEV","NGG","NHI","NI","NLY","NMM",
"NSL","NUO","NXC","NXQ","NYF","OI","PBE","PCK","PGX","PHT","PICB","PII","PM","PNI","PSA","PSK","PVI","PWZ","PYS","PZA","QEP","RALS","RCS","RDN","RLY","SCHO","SCU","SHM","SJB",
"SLG","SMMU","SPFF","SSL","SUB","TAC","TBF","TDI","TDJ","TEL","TEN","TFI","TGP","THD","TKR","TNC","TPX","TRGP","TRP","TSI","TU","TV","TVC","TWO","UCI","UL","UN","UZA","VAC",
"VAR","VGI","VLT","CPI","CPT","CQQQ","CRT","CS","CTB","CUZ","CVS","CVY","CWI","CWT","CX","CXW","DBV","DCO","DD","DEI","DEW","DGS","DIM","DIN","DLR","DLS","DNL","DOL","DOO",
"DRW","DSU","DTE","DTF","DTH","DWM","DWX","ED","EDI","EELV","EEM","EFA","EGF","ELS","EME","EMLP","EPOL","EQT","ERF","ETB","ETO","ETW","EVN","EVT","EWD","EWK","EWL","EWO","EWP",
"EWQ","EWU","FAF","FAM","FCT","FDL","FDX","FEO","FEZ","FF","FGD","FMN","FNF","FR","FRI","FRT","FXG","FXP","GBL","GDL","GLT","GOF","GRES","GTS","HDG","HEQ","HGH","HIO","HP",
"HPI","HPS","HR","HSY","HYEM","HYLD","HZO","ICE","IDLV","IEMG","IEV","IEZ","IFF","IGR","IHI","ILTB","ING","INKM","IRL","IRR","IXC","IXP","IYE","IYR","JEQ","JFR","JHI","JLS",
"JPC","JXI","KO","KR","KSM","KXI","LDL","LDP","LII","LPL","LXFR","MATX","MCD","MCI","MCK","MCO","MCR","MCRO","MDT","MFA","MKC","MLI","MLPA","MLPG","MLPI","MMP","MMU","MNA",
"MNP","MOO","MORT","MSI","MTDR","MTL","MUC","MUR","MVO","MYC","MYJ","NAC","NGS","NJR","NL","NMT","NNA","NNN","NPK","NPTN","NQP","NRP","NUV","NXN","OFC","OIH","OLP","PANW",
"PBJ","PBP","PCEF","PCM","PCN","PDM","PDN","PFL","PFXF","PHB","PKO","PLD","PLT","PNF","PRA","PSO","PTR","PUK","PXD","PXF","PXJ","PZT","QAI","QUAD","RBA","REV","REZ","RFI",
"RGA","RHS","RJZ","RLGY","RLJ","RPT","RQI","RWO","RWR","RWX","RY","RYE","SAR","SCD","SCHF","SCHH","SCI","SDIV","SJNK","SMP","SO","SOIL","SPH","SPLP","SRC","SRE","SRT","SRV",
"STC","SUP","SYY","TBT","TGH","THS","TKC","TMV","TRNO","TUP","UBS","UFI","UGA","UNM","USM","UTL","UVV","VALE","VBF","VDE","VEA","VEU","VGK","VNQ","WCN","WIT","WPC","WPS","WRI",
"WSR","WTM","XLP","Y","YXI","ABR","ALB","ALG","ALL","AMX","ANTM","AOA","AP","APA","ATI","AXJL","AXS","BAP","BAX","BBVA","BMI","BMY","BNS","BRF","BWG","BXP","CGA","CGW","CHE",
"CII","CIR","CLX","CMS","COO","CR","CTL","CYD","D","DB","DDT","DEF","DEM","DFE","DHT","DNI","DTN","DUK","DVN","DVYA","ECL","EDIV","EEA","EHI","ELY","EMF","EMN","ENB","ENR",
"EOS","EQR","ESS","ETG","ETV","ETY","EWA","EWC","EWN","EWW","EWX","FFR","FMO","FMS","FRAK","FRC","FSS","FUL","G","GAB","GES","GII","GIM","GM","GMF","GNT","GOL","GPI","GTN",
"GUT","GVA","GWX","HDV","HMC","IAE","IEX","IFN","IHC","IHG","IOO","IPHI","IYK","IYM","JBT","JHX","JOF","JQC","KAMN","KMB","KOS","KRC","LEA","LVS","MANU","MGF","MHD","MLPY",
"MMT","MO","MRK","MSB","MTD","MTRN","MUI","MVT","MYE","MYN","NCZ","NFJ","NLR","NORW","NSC","O","OFG","OHI","PBS","PCF","PCG","PDT","PEJ","PEO","PFE","PGR","PMX","PRU","PSR",
"PTY","PZC","RAD","RCI","RENN","REX","RGR","RMD","ROOF","RRC","RTL","RTM","RYN","RYU","SAH","SBS","SCCO","SCHC","SCM","SHO","SJI","SLX","SNA","SWN","SWZ","TCO","TDF","THG",
"TLTD","TLTE","TOK","TS","TWN","UHT","UPS","UUP","VAW","VEGA","VMW","VSS","VTA","VTR","VWO","WNC","WSO","WTI","XIN","XLB","XLU","YANG","YPF","ZTR","PEAK","AES","AGD","ALE",
"ALV","ALX","AMG","AOD","AOS","ARE","ARW","ASX","AVB","AWP","AWR","AZO","B","BAM","BC","BCS","BDJ","BEN","BG","BHE","BHK","BIF","BKH","BMO","BP","BRC","CACI","CAT","CBZ","CCI",
"CCL","CDR","CF","CHL","CLI","CMC","CMP","CNQ","CNX","CPA","CPB","CPE","CRS","CSV","CUK","CUT","CWB","DBD","DBJP","DDF","DES","DEX","DGT","DIG","DIS","DLN","DON","DOV","DRE",
"DSX","DTD","DXC","DXJ","EDC","EES","EET","EFO","EFX","EIG","EOI","EPR","EWH","EXI","FBT","FC","FCG","FDM","FET","FIW","FNI","FOF","FT","FVD","FXO","FXU","FXZ","GHL","GIL",
"GMED","GPN","GREK","GSK","H","HEP","HON","HQH","HRB","HST","HTD","HUN","HXL","IBM","IDU","IID","IJR","IJS","ILF","IMAX","ITW","IVE","IVV","IWC","IWD","IWM","IWO","IWS","IWV",
"IWX","IXG","IXJ","IYH","IYY","JCE","JKD","JKF","JTD","KEX","KF","KIE","KIM","KKR","KMPR","KMX","LYB","LYV","MA","MBT","MCN","MD","MDU","MGC","MGV","MKL","MMM","MPC","MPW",
"MT","MTX","MXE","MXL","NAT","NCV","NEE","NEU","NFG","NGL","NIM","NNI","NNY","NP","NPO","NRG","NS","NVO","NWE","NYCB","OEF","OGE","OII","OIS","OKE","PBA","PBI","PKX","PLOW",
"PNM","PPT","PRF","PRO","PWC","PWV","PXH","PXQ","PZD","RCL","RHI","RHP","RLI","RMT","ROL","RPAI","RPV","RS","RSP","RST","RVT","RWL","RXI","RYH","SCHB","SCHD","SCHV","SCHX",
"SDOG","SDY","SFE","SFL","SJW","SLF","SLY","SNP","SON","SPHD","SPLV","SPY","SPYV","SQM","SRI","SWK","SWX","TD","TDC","TPC","TREX","TRV","TTP","TWI","TYL","TYO","UBP","UGP",
"UJB","UMH","UNG","UNL","UNT","UPV","URE","UTF","UYM","VHT","VIG","VIOG","VIOO","VIOV","VIV","VOE","VOO","VOOV","VPU","VT","VTI","VTV","VV","VVI","VXF","VYM","WELL","WM",
"WMB","WMC","WRB","XLG","XLV","XPO","XRX","YUM","ZSL","AA","ACC","ACM","ACN","ADS","ADX","AEE","AEP","AFG","AI","AIG","AIT","AIV","AJG","ALEX","ALK","AMP","AMRC","AON","ASH",
"AXP","BDC","BDN","BHLB","BIG","BK","BOE","BRO","BTE","BTO","BYD","CAH","CAPE","CBRE","CBU","CEE","CHK","CHT","CHU","CIA","CNI","COF","CPAC","CSD","CSL","CXO","CYH","CZA",
"DCI","DFS","DGZ","DHR","DLB","DNR","DPG","DRI","DRN","DSI","DTO","DTQ","DVA","EFC","EIX","EMR","EPD","EQL","ERJ","ERUS","ERX","ES","ETN","ETR","EUO","EUSA","EW","EWI","EWT",
"EWZ","EZM","FDS","FENG","FFA","FIS","FLR","FMX","FPX","FVL","FXH","FXL","FXR","GAM","GDOT","GE","GEF","GF","GFI","GGB","GGG","GLW","GNRC","GPM","GRA","GS","HBM","HCA","HCI",
"HE","HLX","HQL","HSC","HUM","IAK","IBN","IDA","IGA","IGD","IGM","IHF","IJH","IJJ","IJK","IRM","IT","ITOT","ITT","IVOG","IVOO","IWF","IWN","IWP","IWR","IWY","IXN","IYC","IYF",
"IYW","JCI","JJM","JKE","JKG","JKH","JKK","JNJ","JTA","KAI","KAR","KBE","KEY","KOP","KRG","L","LEG","LGI","LH","LLY","MDP","MDY","MDYV","MEI","MFC","MGK","MLM","MN","MNR",
"MOS","MRO","MSCI","MSM","MTB","MTZ","NC","NE","NGVC","NIE","NMR","NTZ","NVS","ODC","OMI","OXY","PEG","PEI","PFS","PHI","PIN","PJP","PNR","PNW","POR","PPA","PSJ","PSX","RBS",
"RFP","RGI","ROK","ROP","RPG","RPM","RWJ","RWK","RYT","RZG","RZV","SCHA","SCHM","SCS","SF","SFUN","SHW","SIG","SLB","SLYG","SLYV","SMM","SNE","SNN","SPHB","SPHQ","SSD","STAG",
"STN","STT","SYK","SZC","TFX","TRC","TSM","TSU","TTC","TY","UA","UAA","UBA","UFS","UGE","UMC","USA","USB","UTI","VAL","VB","VBK","VCR","VFH","VGT","VIS","VLO","VMC","VOT",
"VUG","WAB","WBK","WFC","WHR","WMT","WNS","WRE","XLF","XLI","XLK","XLY","XOP","XSW","XTL","XYL","ZBH","AAN","AAP","AB","ABM","ACCO","AEO","AGN","AL","ALSN","AME","ANF","APH",
"APTV","ARC","AWI","AZN","BA","BAC","BAH","BAL","BBD","BBW","BBY","BGY","BITA","BKD","BKE","BLX","BOIL","BVN","BXS","C","CALX","CATO","CE","CEO","CFR","CHA","CHS","CLB","CLR",
"CM","CMI","CNO","CO","CODI","CRI","CRK","CURE","CW","CZZ","DAC","DAL","DDM","DDS","DHI","DK","DKL","DKS","DRH","DY","DZZ","EBS","EDU","EE","EGY","ELP","ENS","EOD","EPI","ESE",
"ESI","ETH","EV","EVC","EXP","FAS","FHN","FICO","FIX","FL","FLS","FNB","GBX","GCAP","GCO","GFF","GLL","GME","GNC","GNE","GPC","GWW","HBI","HEIa","HFC","HI","HIG","HJV","HNI",
"HNP","HOG","HOV","HPQ","HRC","HRL","HTH","IIF","INCO","ITUB","IYG","JBL","JBN","JCP","JJC","JKJ","JNPR","JPM","JWN","KBR","KCE","KMF","KMT","KNL","KNX","KRE","KSS","KTP","KW",
"KWR","LAZ","LB","CMU","CXE","DBL","DJCI","DNP","DSM","E","ECON","EMLC","EWV","FMY","FUD","FXB","GEO","GSC","HYB","HYMB","IBND","IGI","IVR","JPI","JRO","LTPZ","MAC","MEN",
"MRC","MYD","NIB","NLSN","NPV","NR","NXP","OIA","ORN","PAI","PFD","PFN","PFO","PKI","PMT","RJA","RNR","RZA","SAM","SCJ","SKT","SLV","STIP","TDTT","TEF","TIPZ","TMO","TOT",
"UNF","USL","VVR","VZ","WD","WIP","EVRG","A","AGZ","ASEA","AXE","BLV","BOX","CTS","DAR","EC","EOG","ET","EWM","EWS","EXD","FAN","FLRN","FLY","FTI","FUN","FXA","GDO","HYS",
"HYT","IBA","IGT","K","KSA","KT","LIT","LQD","MHN","MIC","MINT","MIY","MNE","MSA","NUW","NWN","NXR","OMC","PAA","PAC","PCY","PGF","PRGO","PSP","RBC","RSG","RWT","SAN","SEM",
"SOR","SPG","SRF","TBX","TCP","TNK","VCV","XLE","XME","ASR","CNA","CSU","CVA","DHF","DHS","DHX","DVYE","DZK","ECNS","EPHE","EPP","EWG","FCX","FE","FXN","GAL","GTY","GXF","HIW",
"HMN","HTA","IDT","INN","JLL","JMP","KSU","MAA","MGA","MMC","NYT","OXM","PAG","PHG","PIM","PKG","PPG","PPL","PST","RNP","SAP","SCHE","SJR","SPE","STON","SXT","TDS","TEI","TEX",
"TTT","UDR","VDC","WEC","WU","CNC","DIA","EGP","EPS","FBC","FCF","FDN","FFG","FIF","FLT","FXD","GDV","GGT","GIB","GPK","HEDJ","HT","IAI","IAT","IDE","IHD","IHE","IVW","IVZ",
"IWB","IWL","JDD","JKL","KFY","LM","LNN","LRN","MDYG","MET","MGU","MTOR","MTW","NBHC","NHF","NLS","NOA","NOC","NOV","NX","ORI","OSK","PBD")
data <- do.call(cbind.data.frame, lapply(tickers, function(x)
getSymbols(x, from = mdate, to = edate, auto.assign = F)))
# Transpose data.frame:
td_data <- within(data.frame(price_var = row.names(t(data)), t(data), row.names = NULL),
{
ticker_cd <- as.factor(gsub("[.].*", "", price_var))
price_var <- as.factor(gsub(".*[.]", "", price_var))
}
)
# Reshape:
abc <- do.call("cbind", split(td_data, td_data$price_var))
Когда я запускаю эти коды с тысячами тикеров, я получаю сообщение об ошибке:
«Было 50 или более предупреждений (используйте предупреждения ( ), чтобы увидеть первые 50) "
Когда я пишу" warnings () ", тогда
в read.table (file = file, header = header, sep = sep, ... : Последняя неполная строка, найденная readTableHeader в 'https://query2.finance.yahoo.com/v7/finance/download/ABG?period1=1556668800&period2=1556841600&interval=1d&events=history&crumb=RJ9UrFQvTtW'
Это нормальная ошибка? Или есть лучший способ импортировать эти тысячи данных акций?