timeseries
Retrieve Money.Net intraday and historical data
Description
Examples
Retrieve Intraday Data in Seconds
Create Money.Net connection c
using
a user name and password.
username = 'user@company.com'; pwd = '999999'; c = moneynet(username,pwd);
Retrieve intraday data for the last 5 minutes in 30-second bars
for the symbol IBM® using the Money.Net connection
c
. Specify the date as a
datetime
array containing a date range
with start and end dates. The start date starts 5 minutes after
the current moment. The end date is the current moment. To
specify the current moment, use
datetime('now')
. To specify 5 minutes
earlier, subtract minutes(5)
from the current
moment. To retrieve data in 30-second bars, specify the interval
as '30S'
.
s = 'IBM'; date = [datetime('now')-minutes(5) datetime('now')]; interval = '30S'; d = timeseries(c,s,date,interval);
Display the first three rows of intraday data
d
for all valid Money.Net
fields.
d(1:3,:)
ans = Date High Low Open Close Volume _________________ ______ ______ ______ ______ _______ 05/09/16 13:30:30 147.52 147.48 147.48 147.51 2763.00 05/09/16 13:31:00 147.53 147.50 147.50 147.52 7241.00 05/09/16 13:31:30 147.54 147.51 147.51 147.53 5608.00
d
is a table that contains these columns:
Date timestamp
High price
Low price
Open price
Close price
Trading volume
Close the Money.Net connection.
close(c)
Retrieve Intraday Data in Minutes
Create Money.Net connection c
using
a user name and password.
username = 'user@company.com'; pwd = '999999'; c = moneynet(username,pwd);
Retrieve intraday data for yesterday in 30-minute bars for the
symbol IBM using the Money.Net connection
c
. Specify the date as yesterday using
datetime
. To retrieve data in
30-minute bars, specify the interval as
'30M'
.
s = 'IBM'; date = datetime('yesterday'); interval = '30M'; d = timeseries(c,s,date,interval);
Display the first three rows of intraday data
d
for all valid Money.Net
fields.
d(1:3,:)
ans = Date High Low Open Close Volume _________________ ______ ______ ______ ______ _______ 05/06/16 08:00:00 145.22 145.07 145.07 145.22 2455.00 05/06/16 08:30:00 144.66 144.66 144.66 144.66 300.00 05/06/16 09:00:00 145.00 144.90 144.90 145.00 4758.00
d
is a table that contains these columns:
Date timestamp
High price
Low price
Open price
Close price
Trading volume
Close the Money.Net connection.
close(c)
Retrieve Daily Historical Data for Specified Fields
Create Money.Net connection c
using
a user name and password.
username = 'user@company.com'; pwd = '999999'; c = moneynet(username,pwd);
Retrieve historical data in daily bars for the symbol
IBM using the Money.Net connection
c
. Specify the date range from June 1,
2015, through June 5, 2015, using datetime
.
To retrieve daily data, specify the interval as
'1D'
. Retrieve only the high and low
price fields f
from Money.Net.
s = 'IBM'; date = [datetime('1-Jun-2015') datetime('5-Jun-2015')]; interval = '1D'; f = {'High','Low'}; d = timeseries(c,s,date,interval,f);
Display the first three rows of daily data
d
.
d(1:3,:)
ans = Date High Low _________________ ______ ______ 06/01/15 00:00:00 171.04 169.03 06/02/15 00:00:00 170.45 168.43 06/03/15 00:00:00 171.56 169.63
d
is a table that contains these columns:
Date timestamp
High price
Low price
Close the Money.Net connection.
close(c)
Retrieve Weekly Historical Data for Specified Fields
Create Money.Net connection c
using
a user name and password.
username = 'user@company.com'; pwd = '999999'; c = moneynet(username,pwd);
Retrieve historical data in weekly bars for the symbol
IBM using the Money.Net connection
c
. Specify the date range from June 1,
2015 through June 30, 2015 using datetime
.
To retrieve weekly data, specify the interval as
'7D'
. Retrieve only the high and low
price fields f
from Money.Net.
s = 'IBM'; date = [datetime('1-Jun-2015') datetime('30-Jun-2015')]; interval = '7D'; f = {'High','Low'}; d = timeseries(c,s,date,interval,f);
Display the first three rows of weekly data
d
.
d(1:3,:)
ans = Date High Low _________________ ______ ______ 06/01/15 00:00:00 171.56 167.20 06/08/15 00:00:00 170.44 163.37 06/15/15 00:00:00 168.72 164.25
d
is a table that contains these columns:
Date timestamp
High price
Low price
Close the Money.Net connection.
close(c)
Input Arguments
c
— Money.Net connection
connection object
Money.Net connection, specified as a connection object created
using moneynet
.
s
— Money.Net symbol
character vector | cell array of character vector | string scalar
Money.Net symbol, specified as a character vector, cell array of a character vector, or string scalar to denote one symbol.
Example: "IBM"
Data Types: char
| cell
| string
date
— Date
datetime
array | character vector | cell array of character vectors | double | string scalar | string array
Date, specified as a datetime
array,
character vector, cell array of character vectors, double,
string scalar, or string array. If date
contains one date, this date is the start date. The software
determines the end date to be the last second of the same day.
If date
contains two dates, the first date is
the start date and the second date is the end date.
Example: datetime('yesterday')
Data Types: datetime
| char
| cell
| double
| string
interval
— Interval
character vector | string scalar
Interval between bars, specified as a character vector or string
scalar. Specify the interval as a number followed by one of
these letters: S
, M
, and
D
. These letters indicate seconds,
minutes, and days, respectively. For example,
30S
is 30-second bars and
1D
is daily end-of-day data.
Data Types: char
| string
f
— Money.Net data field list
character vector | cell array of character vectors | string scalar | string array
Money.Net data field list, specified as a character vector, cell array of character vectors, string scalar, or a string array. To specify one field, use a character vector or string scalar. To specify multiple fields, use a cell array of character vectors or a string array.
Specify the field by using the single character or the field definition. For example, to
specify the highest price for the equity during the current trading day, use
a single character "H"
or the corresponding field
definition "High"
. When using the field definition, the
software ignores the case of the definition.
Example: "High"
Example: ["High" "Low"]
Data Types: char
| cell
| string
Output Arguments
d
— Money.Net data
table
Money.Net data, returned as a table. Each row in the table
represents data at different times. The first column
Date
is the timestamp. The remaining
columns contain one column of data for each Money.Net field
f
.
To return data for all available historical fields, use this syntax:
d = timeseries(c,s,date,interval);
Money.Net returns data only for business days with trading activity.
Version History
Introduced in R2016b
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.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- 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)