GetData
当前数据BloombergConnection V3
句法
Description
Examples
最后和开放价格的安全价格
首先,创建一个彭博桌面连接。这n, request last and open prices for a security. The current data you see when running this code can differ from the output data here.
指定的字段给定的覆盖字段和值
首先,创建一个彭博桌面连接。这n, request data for specific fields for a security using an override field and value. The current data you see when running this code can differ from the output data here.
创建彭博连接。
c = blp;
另外,您可以使用blpsrv
或使用彭博b-pipebpipe
。
Request data for Bloomberg fields'YLD_YTM_ASK'
,,,,'问'
,,,,and'oas_spread_ask'
when the Bloomberg field'oas_vol_ask'
是'14.000000'
。
[d,sec] = getData(c,'030096AF8 CORP',,,,。。。{'YLD_YTM_ASK',,,,'问',,,,'oas_spread_ask',,,,'oas_vol_ask'},。。。{'oas_vol_ask'},{'14.000000'})
d= YLD_YTM_ASK: 5.6763 ASK: 120.7500 OAS_SPREAD_ASK: 307.9824 OAS_VOL_ASK: 14 sec = '030096AF8 Corp'
GetData
返回结构d
with the resulting values for the requested fields.
Close the connection.
关闭(c)
Last Price for Security with Pricing Source
首先,创建一个彭博桌面连接。这n, request the last price for a security. Specify the security using the CUSIP number with a pricing source. The current data you see when running this code can differ from the output data here.
使用日期覆盖的组成重量
首先,创建一个彭博桌面连接。这n, request the constituent weights of an index using a date override. The current data you see when running this code can differ from the output data here.
创建彭博连接。
c = blp;
另外,您可以使用blpsrv
或使用彭博b-pipebpipe
。
截至2010年1月1日,返回道琼斯指数的组成重量,使用所需的日期格式覆盖日期YYYYMMDD
。
d= getData(C,,,,'DJX索引',,,,'INDX_MWEIGHT',,,,'end_dt',,,,'20100101')
d= INDX_MWEIGHT: {{30x2 cell}}
GetData
返回结构d
with a cell array where the first column is the index and the second column is the constituent weight.
Display the constituent weights for each index.
d.indx_mweight {1,1}
ans = 'AA UN' [1.1683] 'AXP UN' [2.9366] 'BA UN' [3.9229] 'BAC UN' [1.0914] ...
Close the connection.
关闭(c)
当前数据和日期为DateTime的表
创建一个Bloomberg®连接,然后为特定字段请求当前数据。这GetData
功能将日期的数据返回datetime
大批。
创建彭博连接。
c = blp;
另外,您可以使用blpsrv
或使用彭博b-pipe®使用bpipe
。
通过设置将数据作为表返回DataReturnFormat
连接对象的属性。如果您不设置此属性,则GetData
Function returns data as a structure.
返回日期datetime
array by setting theDatetimeType
连接对象的属性。In this case, the table contains dates in variables that aredatetime
arrays.
C。DataReturnFormat ='桌子';c.datetimetype ='datetime';
请求这些字段的当前数据:
最后更新日期
最后价格
Number of trades
以前的实时交易日期
s ='IBM我们的权益';F= {'LAST_UPDATE_DT',,,,'LAST_PRICE',,,,。。。'num_trades_rt',,,,'PREV_TRADING_DT_REALTIME'}; d = getdata(c,s,f)
d = 1×4 table LAST_UPDATE_DT LAST_PRICE NUM_TRADES_RT PREV_TRADING_DT_REALTIME ____________________ __________ _____________ ________________________ 21-Dec-2017 00:00:00 152.2 24846 20-Dec-2017 00:00:00
显示最后更新日期。这个日期是datetime
大批。
d。LAST_UPDATE_DT
ANS = DateTime 21-Dec-2017 00:00:00
关闭彭博连接。
关闭(c)
输入参数
s
-安全列表
character vector|string scalar|细胞array of character vectors|字符串数组
安全列表,为一个安全性或字符矢量的单元格数组或字符串数组的单元数组指定为多个证券的字符阵列。您可以按名称或CUSIP以及有或没有定价源指定安全性。
Data Types:char
|细胞
|string
F
-Bloomberg data fields
character vector|string scalar|细胞array of character vectors|字符串数组
彭博数据字段,指定为字符向量,字符串标量,字符矢量的单元格数量或字符串数组。字符向量或字符串表示一个彭博数据字段名称。字符向量或字符串数组的单元格数组表示多个彭博数据字段名称。有关您可以指定的字段的详细信息,请参阅彭博API开发人员指南使用wapi
Example:{'last_price';'open'}
Data Types:char
|细胞
|string
o
-彭博社覆盖场
[[]
(default) |character vector|string scalar|细胞array of character vectors|字符串数组
彭博社覆盖场,,,,specified as a character vector, string scalar, cell array of character vectors, or string array. A character vector or string denotes one Bloomberg override field name. A cell array of character vectors or string array denotes multiple Bloomberg override field names. For details about the fields you can specify, see the彭博API开发人员指南使用wapi
Example:'end_dt'
Data Types:char
|细胞
|string
ov
-彭博社覆盖现场价值
[[]
(default) |character vector|string scalar|细胞array of character vectors|字符串数组
彭博社覆盖场值,指定为字符向量,字符串标量,字符矢量的单元格数或字符串数组。字符向量或字符串表示一个彭博覆盖场值。字符向量或字符串阵列的单元格数组表示多个彭博覆盖字段值。使用此字段值过滤彭博数据结果集。
Example:'20100101'
Data Types:char
|细胞
|string
名称值参数
Specify optional pairs of arguments asName1=Value1,...,NameN=ValueN
,,,,whereName
是参数名称和Value
是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 encloseName
in quotes.
Example:“回归”,是真的
returnEids
-Entitlement identifiers
true|错误的
权利标识符,指定为逗号分隔对'returnEids'
和布尔人。true
将权利标识符(EID)日期的名称和值添加到返回数据。
Data Types:逻辑
returnFormattedValue
-Return format
true|错误的
返回格式,指定为逗号分隔对'returnFormattedValue'
和布尔人。true
Forces all data to be returned as the data type character vector.
Data Types:逻辑
使用时间
-日期时间格式
true|错误的
日期时间格式,指定为逗号分隔对'useUTCTime'
和布尔人。true
返回日期和时间值作为协调的通用时间(UTC)和错误的
默认为彭博社tzdf
Data Types:逻辑
抱怨
-最新的参考数据
true|错误的
最新参考数据,指定为逗号分隔对,由'forceddelay'
和布尔人。true
returns the latest data up to the delay period specified by the exchange for the security.
Data Types:逻辑
Output Arguments
d
- 彭博数据
结构(默认)|表|时间表
彭博数据作为结构,表格或时间表返回。彭博数据的数据类型取决于DataReturnFormatandDatetimeTypeproperties of the connection object. For details about the data, see the彭博API开发人员指南使用wapi
秒
-安全列表
细胞array of character vectors
安全列表,作为相应证券的字符向量的单元格数组返回s
。内容的内容秒
在价值和秩序上相同s
。您可以使用以下任何标识符返回证券:
Buid
猫
CINS
Common
Cusip
isin
sedol1
sedol2
sicovam
svm
股票
(default)WPK
提示
Bloomberg V3 data supports additional name-value pair arguments. To access further information on these additional name-value pairs, see the彭博API开发人员指南使用wapi
彭博终端的选项。 You can check data and field availability by using the Bloomberg Excel®Add-In.
For a Bloomberg B-PIPE connection,
d
返回一个名为的其他字段开斋节
。开斋节
意味着应享的标识符。有关详细信息,请参阅彭博API开发人员指南。
版本历史记录
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
您单击了与此MATLAB命令相对应的链接:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择一个网站
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
选择中国网站(中文或英语)以获得最佳场地性能。其他Mathworks乡村网站未针对您所在的访问进行优化。
美洲
- AméricaLatina(Español)
- 加拿大(English)
- 美国(English)
Europe
- Netherlands(English)
- Norway(English)
- Österreich(Deutsch)
- 葡萄牙(English)
- Sweden(English)
- 瑞士
- United Kingdom(English)