Main Content

Retrieve Current and Historical Money.Net Data

This example shows how to retrieve current data for symbols, historical data, and current data for option symbols from Money.Net.

To run this example, you need a Money.Net user name and password. To request these credentials, contact Money.Net.

To access the code for this example, enter edit MoneyNetDataWorkflowExample.m.

Create Money.Net Connection

Create Money.Net connection c using a user name and password.

username = 'user@company.com';
pwd = '999999';

c = moneynet(username,pwd);

Retrieve Money.Net Current Data

Retrieve Money.Net current data d for the symbol IBM® using the Money.Net connection c. Specify the Money.Net data fields f for ask and bid price.

symbol = 'IBM';
f = {'Ask','Bid'};

d = getdata(c,symbol,f);

Display Money.Net current data. d is a table that contains the variables for symbol, ask price, and bid price. The row contains Money.Net data values for each variable.

d
d = 

    Symbol     Ask       Bid  
    ______    ______    ______

    'IBM'     145.00    143.85

Retrieve Money.Net current data for the symbols list that contains these symbols: IBM, Google®, and Yahoo!®.

symbols = {'IBM','GOOG','YHOO'};

d = getdata(c,symbols,f);

Display Money.Net current data. d is a table that contains the variables for symbol, ask price, and bid price. The rows contain Money.Net data values for each symbol in the symbol list.

d
d = 

    Symbol     Ask       Bid  
    ______    ______    ______

    'IBM'     145.00    143.85
    'GOOG'    700.50    700.05
    'YHOO'     37.50     37.41

Retrieve Money.Net Historical Data

Retrieve historical data in daily bars for the symbol IBM. 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.

d is a table that contains these variables:

  • Date timestamp

  • High price

  • Low price

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

Determine the average high price in the date range.

mean(d.High)
ans =

        170.51

Retrieve Money.Net Option Symbol Data

Retrieve option symbols o for the symbol IBM. o is a cell array of character vectors. Each character vector is an option symbol.

s = 'IBM';

o = optionchain(c,s);

Display the first three option symbols.

o(1:3)
ans =

  3×1 cell array

    'O:IBM\16F24\131 .0'
    'O:IBM\16R24\135 .0'
    'O:IBM\16F24\142 .0'

Retrieve the current data for the first option symbol o(1) and display it. Specify fields f for describing the option symbol:

  • Option symbol description

  • Option symbol strike

  • Option symbol expiration date

  • Option symbol ask price

  • Option symbol bid price

d is a table with one row of data. The data contains the option symbol name in the first variable and a variable for each specified field f.

symbol = o(1);
f = {'Description','Strike','Expiration','Ask','Bid'};

d = getdata(c,symbol,f)
d = 

           Symbol                   Description            Strike    Expiration     Ask      Bid 
    ____________________    ___________________________    ______    __________    _____    _____

    'O:IBM\16F24\131 .0'    'IBM Call 06/24/2016 131.0'    131       06/24/16      23.75    21.75

Close Money.Net Connection

close(c)

See Also

| | | |

Related Topics

External Websites