Main Content

Retrieve Current and Historical Money.Net Data Using Money.Net Web Socket Interface

This example shows how to retrieve current data for symbols, historical data, and current data for option symbols from Money.Net using the Money.Net web socket interface.

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

Create Money.Net Connection

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

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

c = moneynetws(username,pwd);

Retrieve Money.Net Current Data

Retrieve Money.Net current data d for the symbol IBM® using the Money.Net connection c. The table d contains the variables for all Money.Net fields.

symbol = "IBM";
d = getdata(c,symbol);

Retrieve Money.Net current data for the symbols list that contains the IBM and Google® symbols. Specify the Money.Net data fields f for highest and lowest prices for the current trading day.

symbols = ["IBM" "GOOG"];
f = ["high" "low"];
d = getdata(c,symbols,f);

d is a table that contains the variables for high and low prices. The rows contain Money.Net data values for each symbol in the symbol list.

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 timetable 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);

Determine the average high price in the date range.

avghigh = mean(d.high);

Retrieve Money.Net Option Symbol Data

Retrieve option symbols o for the symbol IBM. o is a table. Each row of the table is an option symbol.

s = "IBM";
o = optionchain(c,s);

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

  • Option symbol description

  • Option symbol ask price

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

symbol = o.symbol(1);
f = ["description" "askPrice"];
d = getdata(c,symbol,f);

Close Money.Net Connection

close(c)

See Also

| | | | |

Related Topics

External Websites