Main Content

Retrieve Real-Time Money.Net Data

This example shows how to retrieve real-time data from Money.Net for a symbol. It explains how to subscribe to real-time updates, stop subscription, and process real-time updates using a custom event handler function.

To process real-time data updates, you can use the default event handler function. Or, for a different approach, you can write a custom event handler function. For writing custom event handler functions with Money.Net data, see realtime. For custom event handler functions, see Writing and Running Custom Event Handler Functions.

This example requires 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 Real-Time Data for One Symbol

Retrieve Money.Net real-time data updates for the IBM® symbol.

symbol = 'IBM';

realtime(c,symbol)

The default event handler mnRealTimeEventHandler processes all real-time data updates. To access the code for the default event handler, enter edit mnRealTimeEventHandler.m.

The mnRealTimeEventHandler function creates the workspace variable IBMRealTime. The mnRealTimeEventHandler function populates the table IBMRealTime with real-time data updates. To see the real-time data, open IBMRealTime in the Variables editor.

Stop Real-Time Data Updates

Stop the symbol subscription.

stop(c)

mnRealTimeEventHandler stops processing all real-time data updates. The last real-time data update remains in IBMRealTime.

Retrieve Real-Time Data Using Custom Event Handler Function

Define a custom event handler function myfcn. The myfcn function displays Money.Net real-time data to the Command Window.

myfcn = @(x)disp(x);

Retrieve Money.Net real-time data updates for the IBM symbol using myfcn.

symbol = 'IBM';

realtime(c,symbol,myfcn)
    Symbol             Description              Yesterday    YesterdayDateTime     Bid       Ask      ExchangeOfTheCurrentBidPrice    ExchangeOfTheCurrentAskPrice     High      Low        Volume      YearHigh    YearHighDateTime    YearLow    YearLowDateTime    Dividend    DividendYield     EPS        EPSDateTime       EPSDiluted    EPSDilutedDateTime    PERatio    BidSize    AskSize    LastTradeDate    LastTradeTime     Open     MarketCap    Exchange    TimeOfLastUpdatetoBidAskOrTrade    LastTradeCondition    QuoteBidAskCondition    AverageVolume    CurrencyCode    ShortInterest    PricetoBookRatio    SharesOutstanding    Beta     VWAP     LastOutsideOfMarketHours    LastTradeDateOutsideOfMarketHours    LastTradeTimeOutsideOfMarketHours    LastTradeDirection    LastTradeSize    LastTradeExchange     Last     SecurityType
    ______    ______________________________    _________    _________________    ______    ______    ____________________________    ____________________________    ______    ______    __________    ________    ________________    _______    _______________    ________    _____________    _____    _________________    __________    __________________    _______    _______    _______    _____________    _____________    ______    _________    ________    _______________________________    __________________    ____________________    _____________    ____________    _____________    ________________    _________________    ____    ______    ________________________    _________________________________    _________________________________    __________________    _____________    _________________    ______    ____________

    'IBM'     'INTERNATIONAL BUSINESS MACHS'    148.31       05/24/16 00:00:00    151.65    151.67    ''                              ''                              151.67    148.50    2476783.00    173.78      07/20/15            116.90     02/11/16           5.60        3.77             13.30    02/29/16 00:00:00    13.25         02/29/16 00:00:00     11.18      6.00       3.00       05/25/16         13:44:52         148.93    142371.96    'NYSE'      13:44:52                           ''                    ''                      4141081.00       'USD'           20241776.00      9.44                959962000.00         0.70    150.72    148.79                      05/25/16                             09:30:00                             '='                   100.00           'OMDF'               151.66    NaN         

myfcn displays real-time data updates for IBM in the Command Window.

Stop the symbol subscription.

stop(c,symbol)

myfcn stops displaying real-time data updates in the Command Window.

Close Money.Net Connection

close(c)

See Also

| | |

Related Topics

External Websites