Main Content

news

Search and stream Money.Net latest news stories

Description

n = news(c) returns Money.Net news stories n using the Money.Net connection c.

example

n = news(c,Name,Value) returns news stories with additional options specified by one or more Name,Value pair arguments.

example

news(c,Name,Value) streams news stories in real time using the streaming options.

example

Examples

collapse all

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

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

c = moneynet(username,pwd);

Retrieve news data n for 50 news stories using the Money.Net connection c.

n = news(c);

n returns as a table with 50 rows.

Display the news story title, identifier, and published time for the first news story in the table n.

n(1,1:3)
ans = 

                               ArticleTitle                                ArticleID       PublishedTime  
    ___________________________________________________________________    __________    _________________

    'Stop talking about replacements. Give PC owners something new al…'    3.8917e+09    05/13/16 10:00:02

Close the Money.Net connection.

close(c)

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

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

c = moneynet(username,pwd);

Retrieve news data n for 10 news stories using the Money.Net connection c.

n = news(c,'Number',10);

n returns as a table with 10 rows.

Display the news story title, identifier, and published time for the first news story in the table n.

n(1,1:3)
ans = 

                               ArticleTitle                                ArticleID       PublishedTime  
    ___________________________________________________________________    __________    _________________

    'Stop talking about replacements. Give PC owners something new al…'    3.8917e+09    05/13/16 10:00:02

Close the Money.Net connection.

close(c)

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

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

c = moneynet(username,pwd);

Retrieve news stories in the general finance category. Specify that the news stories mention the term 'Dropbox' and contain the symbol for IBM®.

category = 'General Finance';
term = 'Dropbox';
symbol = 'IBM';

n = news(c,'Category',category,'SearchTerm',term,'Symbol',symbol);

n is a table with one news story.

Display the news story title, identifier, and published time for the news story.

n(1,1:3)
ans = 

                          ArticleTitle                          ArticleID       PublishedTime  
    ________________________________________________________    __________    _________________

    'Hewlett Packard Enterprise (HPE) Teams Up with Dropbox'    4.0002e+09    06/08/16 11:11:05

Close the Money.Net connection.

close(c)

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

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

c = moneynet(username,pwd);

Turn on the subscription to the Money.Net real-time news data stream using the default event handler function mnNewsStreamEventHandler. The function mnNewsStreamEventHandler processes news data events by populating the workspace variable mnNewsStreamLatest with the latest news stories. News stories populate in the mnNewsStreamLatest variable until it contains 10 rows. Then, the latest news stories overwrite the older ones in mnNewsStreamLatest. To access the code for this function, enter edit mnNewsStreamEventHandler.m.

news(c,'Subscription','on')

The workspace variable mnNewsStreamLatest appears in the MATLAB® Workspace.

Display the news story title, identifier, and published time for the first news story.

mnNewsStreamLatest(1,1:3)
ans = 

                               ArticleTitle                                ArticleID       PublishedTime  
    ___________________________________________________________________    __________    _________________

    'Stop talking about replacements. Give PC owners something new al…'    3.8917e+09    05/13/16 10:00:02

To see the latest 10 news stories, explore mnNewsStreamLatest in the Variables editor.

Turn off the real-time news data stream.

news(c,'Subscription','off')

Real-time updates stop in the workspace variable mnNewsStreamLatest.

Close the Money.Net connection.

close(c)

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

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

c = moneynet(username,pwd);

Turn on the subscription to the Money.Net real-time news data stream using the custom event handler function myfnc. Here, define myfnc to display Money.Net news data to the Command Window. You can write a custom event handler function to process streaming news stories differently. For details, see Writing and Running Custom Event Handler Functions.

myfnc = @(x)disp(x);

news(c,'Subscription','on','EventHandler',myfnc)
                               ArticleTitle                                ArticleID       PublishedTime      PublisherCode    PublisherName    ArticleBodyDescription      CategoryName                                URLLink                              SourceCode    Priority    Symbols
    ___________________________________________________________________    __________    _________________    _____________    _____________    ______________________    _________________    __________________________________________________________    __________    ________    _______

    '@ETFcom: The Most Important ETF Of 2016 https://t.co/a5qCYK2o7c …'    3.9089e+09    05/17/16 14:39:10    'TWIT'           'Twitter'        ''                        'Twitter Finance'    'https://twitter.com/41120676/statuses/732641626921672704'    'MN'          '0'         {}     

Money.Net news stories stream to the Command Window.

Turn off the real-time news data stream.

news(c,'Subscription','off')

Real-time updates stop in the Command Window.

Close the Money.Net connection.

close(c)

Input Arguments

collapse all

Money.Net connection, specified as a connection object created using moneynet.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: n = news(c,'Number',10);

Note

The name-value pair arguments in the searching and streaming groups are independent. If you combine these name-value pair arguments, you receive this error: Invalid combination of Name-Value pairs. Type HELP MONEYNET/NEWS to see the valid syntax.

Searching News Stories Options

collapse all

Number of news stories, specified as the comma-separated pair consisting of 'Number' and a numeric scalar. The maximum number of news stories that the Money.Net API can return is 500.

The number of news stories returned can be fewer than the specified number because Money.Net provides only available news stories. When you specify this option by itself, news does not filter the story content.

Example: n = news(c,'Number',10);

Data Types: double

Search term, specified as the comma-separated pair consisting of 'SearchTerm' and a character vector or a string scalar. news returns available news stories that contain the search term in the title or body of the news story.

Example: n = news(c,'SearchTerm','Windows 10');

Data Types: char | string

Symbol, specified as the comma-separated pair consisting of 'Symbol' and a character vector, cell array of character vectors, string scalar, or a string array. To specify one symbol, use a character vector or string scalar. To specify multiple symbols, use a cell array of character vectors or a string array. news returns news stories related to the specified symbols.

Example: n = news(c,'Symbol',{'IBM,'YHOO'});

Data Types: char | cell | string

News category, specified as the comma-separated pair consisting of 'Category' and a character vector or a string scalar. news returns stories only in the news category specified.

Example: n = news(c,'Category','General Finance');

Data Types: char | string

Streaming News Stories Options

collapse all

Money.Net real-time news subscription, specified as the comma-separated pair consisting of 'Subscription' and the values 'on' or 'off'. To turn on the Money.Net real-time news subscription, specify the value 'on'. To turn off the subscription, specify the value 'off'.

By default, the sample event handler function mnNewsStreamEventHandler processes the retrieval of news stories during real-time news subscription. To access the code for this function, enter edit mnNewsStreamEventHandler.m. The mnNewsStreamEventHandler function creates the workspace variable mnNewsStreamLatest. Then, mnNewsStreamEventHandler populates the table mnNewsStreamLatest with the latest 10 news stories from Money.Net. Then, the mnNewsStreamEventHandler function updates the list to display the latest news stories.

To specify a custom event handler function, use the name-value pair argument 'EventHandler'.

Example: news(c,'Subscription','on')

Example: news(c,'Subscription','on','EventHandler',myFcn)

Custom event handler function, specified as the comma-separated pair consisting of 'EventHandler' and a character vector, string scalar, or function handle. To process the latest news stories, you can write your own custom event handler function. This function must have an input argument specified as a table. Each new news story from Money.Net is a single row in a table. For details about working with custom event handler functions, see Writing and Running Custom Event Handler Functions.

Specify this name-value pair argument only with the name-value pair argument 'Subscription' and value 'on'.

Example: news(c,'Subscription','on','EventHandler',myFcn)

Data Types: char | function_handle | string

Output Arguments

collapse all

News stories, returned as a table with these variables. Each row in the table represents one news story.

News Story VariableData TypeVariable Description

ArticleTitle

cell array of character vectors

News story title

ArticleID

double

Internal Money.Net identifier of the news story

PublishedTime

datetime array

Date and time the news story was published

PublisherCode

cell array of character vectors

Publisher four-digit code

PublisherName

cell array of character vectors

Publisher name

ArticleBodyDescription

cell array of character vectors

Body excerpt or short description of the news story

Category

cell array of character vectors

Internal Money.Net category of the news story

URLLink

cell array of character vectors

Website that contains the full news story

Source

cell array of character vectors

News stream source code

Priority

cell array of character vectors

Priority of news story with these values:

  • 0 is Normal

  • 1 is Breaking

  • 2 is Major Hot

Symbols

cell array

Symbols, or tickers, associated with the news story with these values:

  • An empty cell array for no symbols

  • A cell array that contains the symbol as a character vector for one symbol

  • A nested cell array that contains symbols as character vectors for multiple symbols

Version History

Introduced in R2016b