history
Retrieve Quandl historical data
Syntax
Description
Examples
Use a Quandl connection to retrieve historical data for a security within the available date range for the specified security.
Create a Quandl connection using a Quandl API key.
apikey = 'abcdef12345';
c = quandl(apikey)c =
quandl with properties:
TimeOut: 100c is the quandl connection object with the
TimeOut property. The TimeOut property specifies
waiting for a maximum of 100 seconds to return historical data before canceling the
request.
Adjust the display format to display currency.
format bankRetrieve historical data for the CHRIS/ASX_WM2 security within the
available date range for the security. This security provides historical future prices for
Eastern Australian Wheat Futures, Continuous Contract #2. The specified security indicates
the default periodicity (in this case, daily). d is a timetable with the
time in the first variable and the previous settlement price in the second variable.
s = 'CHRIS/ASX_WM2';
d = history(c,s);Display the first few rows of historical prices.
head(d)
ans =
8×1 timetable
Time PreviousSettlement
___________ __________________
28-Apr-2018 294.00
27-Apr-2018 294.00
26-Apr-2018 294.00
25-Apr-2018 287.00
24-Apr-2018 287.00
23-Apr-2018 289.50
21-Apr-2018 291.00
20-Apr-2018 291.00 Decide to buy or sell this contract based on the historical prices.
Use a Quandl connection to retrieve historical data for a security within a specified date range.
Create a Quandl connection using a Quandl API key.
apikey = 'abcdef12345';
c = quandl(apikey);Adjust the display format to display currency.
format bankRetrieve historical data for the CHRIS/ASX_WM2 security from
March 1, 2018, through March 31, 2018. This security provides historical future prices
for Eastern Australian Wheat Futures, Continuous Contract #2. The specified security
indicates the default periodicity (in this case, daily). d is a
timetable with the time in the first variable and the previous settlement price in the
second variable.
s = 'CHRIS/ASX_WM2'; startdate = datetime('03-01-2018','InputFormat','MM-dd-yyyy'); enddate = datetime('03-31-2018','InputFormat','MM-dd-yyyy'); d = history(c,s,startdate,enddate);
Display the first few rows of historical prices.
head(d)
ans =
8×1 timetable
Time PreviousSettlement
___________ __________________
31-Mar-2018 277.50
30-Mar-2018 277.50
29-Mar-2018 277.50
28-Mar-2018 278.50
27-Mar-2018 278.00
26-Mar-2018 278.50
24-Mar-2018 280.00
23-Mar-2018 280.00 Decide to buy or sell this contract based on the historical prices.
Input Arguments
Quandl connection, specified as a quandl
object.
Security, specified as a character vector or string scalar.
Example: "CHRIS/ASX_WM2"
Data Types: char | string
Start date of the date range, specified as a datetime array,
numeric scalar, string scalar, or character vector. By default, the start date is the
date of the first available historical data for the specified security
s.
If you specify the enddate input argument, then you must
specify the startdate input argument.
Example: datetime('03-01-2018','InputFormat','MM-dd-yyyy')
Example: 737121
Data Types: double | char | string | datetime
End date of the date range, specified as a datetime array,
numeric scalar, string scalar, or character vector. By default, the end date is the date
of the last available historical data for the specified security
s.
If you specify the startdate input argument, then you must
specify the enddate input argument.
Example: datetime('03-31-2018','InputFormat','MM-dd-yyyy')
Example: 737181
Data Types: double | char | string | datetime
Web service query parameters, specified as one or more pairs of name-value
arguments. A QueryName argument is a character vector or string
scalar that specifies the name of a query parameter. A QueryValue
argument is a character vector or string scalar that specifies the value of the query
parameter. Specify the name using a character vector or string scalar.
Example: "TICKER","XYZ" returns data for the
XYZ ticker.
Data Types: char | string
Output Arguments
Quandl historical data, returned as a timetable or a matlab.net.http.ResponseMessage object.
If the historical data request is successful, then the history
function returns data as a timetable. The timetable contains the time in the first
variable. The subsequent variables in the timetable correspond to the returned data. The
variables of the returned data depend on the specified security
s.
If the historical data request is unsuccessful, the history
function returns the error message in the
matlab.net.http.ResponseMessage object. To access the error
message, see Access Quandl Error Messages.
Version History
Introduced in R2018b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.
Americhe
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)