即时的
Retrieve Money.Net real-time data
描述
例子
检索一个符号的Money.NET实时数据
Create Money.Net connectionc
使用用户名和密码。
username ='user@company.com';PWD ='999999';C = MoneyNet(用户名,PWD);
检索IBM的Money.NET实时数据更新®象征。
符号='IBM';实时(C,符号)
默认事件处理程序mnrealtimeeventhandler
处理所有实时数据更新。要访问默认事件处理程序的代码,请输入编辑mnrealtimeeventhandler.m
。
mnrealtimeeventhandler
creates the workspace variableIBMRealTime
。这mnrealtimeeventhandler
function populates the tableIBMRealTime
with real-time data updates. To see the real-time data, openIBMRealTime
在变量编辑器中。
Stop the symbol subscription.
stop(c)
mnrealtimeeventhandler
停止处理所有实时数据更新。最后的实时数据更新仍在IBMRealTime
。
Close the Money.Net connection.
close(c)
检索Money.net的多个符号的实时数据
Create Money.Net connectionc
使用用户名和密码。
username ='user@company.com';PWD ='999999';C = MoneyNet(用户名,PWD);
检索Money.NET符号的实时数据更新IBM和Yahoo!®。
符号= {'IBM','YHOO'}; realtime(c,symbols)
默认事件处理程序mnrealtimeeventhandler
处理所有实时数据更新。要访问默认事件处理程序的代码,请输入编辑mnrealtimeeventhandler.m
。
这mnrealtimeeventhandler
函数创建工作区变量IBMRealTime
和YHOORealTime
。这mnrealtimeeventhandler
function populates the tablesIBMRealTime
和YHOORealTime
with real-time data updates. To see the real-time data, open either variable in the Variables editor.
停止所有符号订阅。
stop(c)
mnrealtimeeventhandler
停止处理所有实时数据更新。最后的实时数据更新仍在each workspace variable.
Close the Money.Net connection.
close(c)
使用自定义事件处理程序检索Money.NET实时数据
Create Money.Net connectionc
使用用户名和密码。
username ='user@company.com';PWD ='999999';C = MoneyNet(用户名,PWD);
定义自定义事件处理程序功能myfcn
。这myfcn
function displays real-time Money.Net data to the Command Window. You can write a custom function that processes real-time data updates differently. For details, see编写和运行自定义事件处理程序功能。
myfcn = @(x)disp(x);
检索Money.net使用IBM符号的实时数据更新myfcn
。
符号='IBM';实时(c,符号,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
在命令窗口中显示IBM的实时数据更新。
Stop the symbol subscription.
stop(c)
myfcn
停止在命令窗口中显示实时数据更新。
Close the Money.Net connection.
close(c)
输入参数
c
—Money.net连接
connection object
Money.net连接,指定为使用的连接对象moneynet
。
符号
—Money.Net symbol list
角色向量|细胞array of character vectors|string scalar|字符串数组
Money.net符号列表,指定为字符向量,字符向量的单元格数组,字符串标量或字符串数组。要指定一个符号,请使用字符向量或字符串标量。要指定多个符号,请使用字符向量的单元格数组或字符串数组。
例子:'IBM'
例子:{'ibm','goog'}
数据类型:char
|细胞
|string
EventHandler
—Event handler
'mnRealTimeEventHandler'
(default) |角色向量|string scalar|function handle
事件处理程序,指定为字符向量,字符串标量或指定事件处理程序函数名称的函数句柄。编写自定义事件处理程序功能以处理任何类型的实时货币。此函数必须至少具有一个表格参数。表格式必须类似于输出参数的格式GetData
。这event handler function returns all available fields when it executes for the first time. The event handler function executes every time Money.Net provides a real-time update. For details about custom event handler functions, see编写和运行自定义事件处理程序功能。
例如,要在命令窗口中显示实时数据更新,请输入此代码以定义自定义事件处理程序函数:
符号='IBM';myfcn = @(x)disp(x);实时(c,符号,myfcn)
如果未指定自定义事件处理程序功能,则默认事件处理程序mnrealtimeeventhandler
runs. To access the code for the default event handler, enter编辑mnrealtimeeventhandler.m
。
这mnrealtimeeventhandler
函数创建一个工作区变量。工作区变量名称是符号名称和单词的串联即时的
。例如,mnrealtimeeventhandler
将符号IBM的实时数据填充到IBMRealTime
。This workspace variable is a table with columns for each field. The values in the table change when Money.Net provides a real-time data update. Empty fields from Money.Net populate asNaN
,NaT
, and so on, depending on the data type.
First,mnrealtimeeventhandler
使用当前数据表运行。然后,mnrealtimeeventhandler
每次发生更新时运行。
数据类型:char
|function_handle
|string
Version History
MATLABコマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
matlabコマンドコマンドに入力しててください。。。。ブラウザー
选择一个网站
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:。
您还可以从以下列表中选择一个网站:
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.
美洲
- AméricaLatina(Español)
- 加拿大(英语)
- 美国(英语)