フィルターのクリア

Function convert - yahoo to alpha vantage.

2 ビュー (過去 30 日間)
Andrew Czeizler
Andrew Czeizler 2019 年 3 月 14 日
回答済み: Yesid Fonseca Vargas 2021 年 3 月 30 日
Hi All,
I am trying to transpose a scritpt from using yahoo to alpha vantage. I am getting errors and I am not sure why.
Alpha vantage function is -
I know I am asking for a lot, but any help would be very much appreciated.
Script below-
disp('Request data for a number of sybmols and calculate covariance matrix');
q=F_Alphavantage('time_series_intraday', 'symbol', 'MSFT', 'interval', '60min');
clear marketData;
d = datetime('today');
initDate = datetime(addtodate(datenum(d),-5,'year'),'ConvertFrom','datenum');
symbols = {'^GSPC', 'DAX', '^N225', 'GLD', 'QQQ', 'GOOGL', 'AMZN'};
for k = 1:length(symbols)
%this is my change but i am not sure how to change the script
%data = getMarketDataViaYahoo(symbols{k}, initDate);
data = F_Alphavantage('time_series_daily','symbols','symbols{k}', 'interval', 'daily');
ts(k) = timeseries(data.Close, datestr(data(:,1).Date));
tsout = resample(ts(k),ts(1).Time);
marketData(:,k) = tsout.Data;
end
marketData(isnan(marketData)) = 0; %# In case resample() introduced NaNs
normalizedPrice = (marketData - mean(marketData))./std(marketData);
normalizedPrice = normalizedPrice - normalizedPrice(1,:);
tscomb = timeseries(normalizedPrice);
tscomb.TimeInfo = ts(1).TimeInfo;
tscomb.Name = 'normalized';
figure, plot(tscomb);
legend(symbols, 'interpreter', 'none', 'Location', 'best');
covMat = corrcoef(marketData);
covMat(eye(8) == 1) = 0;
figure, heatmap(covMat,'Colormap', parula(3), 'ColorbarVisible', 'on');
ax = gca;
ax.XData = symbols;
ax.YData = symbols;

回答 (1 件)

Yesid Fonseca Vargas
Yesid Fonseca Vargas 2021 年 3 月 30 日
Alpha Vantange free version has a limited number of access per minute (5) and limited number of access per day (500). Maybe this is the problem, then you must to add a delay to asure 5 access per minute.

カテゴリ

Help Center および File ExchangeString Parsing についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by