hist_stock_data - only 2 decimals with currency

조회 수: 3 (최근 30일)
Alex 2012년 7월 11일
편집: Walter Roberson 2018년 7월 2일
Hello!
I have a very simple code for downloading the historical prices from yahoo finance. If I use:
%--------
start_date = '01032012';
end_date = '11072012';
stocks = hist_stock_data(start_date, end_date, '^GSPC');
stocks.Date=datenum(stocks.Date);
% reverse vectors old -> new
stocks.Date = stocks.Date(end:-1:1);
stocks.Close = stocks.Close(end:-1:1);
Prices=stocks.Close
%---------
then the vector prices has 4 decimals. However, if I instead of '^GSPC' use 'EURUSD=X', then the 3rd and 4th decimals are always 0, i.e. the numbers are rounden. HOwever, on the website http://finance.yahoo.com/q?s=EURUSD%3DX&ql=0
the quotes have 4 decimals. Is there a way to download currency data with 4 decimals instead of 2?
Thank you very much for your time and consideration!
Alex

댓글을 달려면 로그인하십시오.

채택된 답변

Javier 2012년 9월 13일
편집: Walter Roberson 2018년 7월 2일
Hello Alex
Procedure to Get Price (EURUSD) with 4 decimals here.If yahoo doesnt allow you go the data , you can go to fred page to get the data (Federal Reserve Economic Data - FRED - St. Louis Fed data manager). Please read the communicate with Data Serve help information in Matlab.
Solution done in Matlab R2012a.
conn=fred;
Instrument='DEXUSEU';
DateIni='Jan 01 2002';
DateEnd='Jan 01 2012';
Field='Close';
Price=fetch(conn,Instrument,Field,DateIni,DateEnd);
How did I identify the name of the instrument ? Go to the FRED Graph section and search the instrument. For the EURO I put EURO and get the result:
DEXEUS, D, USD, \$ to 1, USA, NSA.
This means that data are daily, dollar price NSA.
Javier

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Financial Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by