Main Content

history

数据流Web服务来自再镀金

Description

例子

d=历史(C,,,,retrieves historical Datastream™ Web Services data for a specified security for the last year.

例子

d=历史(C,,,,,,,,字段,,,,dateretrieves historical data for specified fields and a specific date.

例子

d=历史(C,,,,,,,,字段,,,,开始日期,,,,enddate检索日期范围的历史数据。

例子

d=历史(C,,,,,,,,字段,,,,开始日期,,,,enddate,,,,periodretrieves historical data using a period.

[[d,,,,response] =历史(___返回a回应包含错误消息的对象。要访问错误消息,请参阅访问datastream Web服务错误消息

Examples

Collapse all

Use a Datastream Web Services connection to retrieve historical data for the specified security.

使用您的用户名和密码创建DataStream Web服务连接。

用户名='abcdef';password ='abcdef12345';C= datastreamws(username,password)
c =带有属性的datastreamws:用户名:'abcdef'超时:100

Cis theDataStreamwsConnection object with the用户名andTimeOut特性。这用户名property contains the specified user name. TheTimeOutproperty specifies waiting for a maximum of 100 seconds to return historical data before canceling the request.

调整显示格式显示货币。

format银行

检索去年的历史末日数据数据。指定VOD秒urity.dis a timetable that contains the date in the first variable and the end-of-day price in the second variable.

sec ='VOD';d=历史(C,,,,秒);

Display the first few prices.

head(d)
ANS = 8×1时间表时间VOD ______________________________________________________________________00:00:00 202.95 04-May-2017-2017 00:00:00:00 203.70 203.70 05-May-2017 00:00:00:00 204.95 08-May-2017-2017-2017 00:May-2017 00:00:00 205.15 09-May-2017 00:00:00 205.15 10-May-2017-2017 00:00:00:00 206.60 11-May-2017 00:00:00:00:00 206.25 2017年5月12日至2017年5月12日211.05:00 211.05:00

Use the end-of-day prices to make investment decisions for theVOD秒urity.

使用DataStream Web服务连接来检索指定安全性,字段和日期的历史数据。

使用您的用户名和密码创建DataStream Web服务连接。Cis theDataStreamwsConnection object.

用户名='abcdef';password ='abcdef12345';C= datastreamws(username,password);

调整显示格式显示货币。

format银行

Retrieve and display historical end-of-day price data for March 29, 2018. Specify theVOD秒urity and these fields:

  • 开头

  • High price

  • Last closing price

d是第一个变量中的日期和后续变量中的字段的时间表。

sec ="VOD";字段= [“ po”;"PH";"P"];date = datetime('03 -29-2018',,,,'InputFormat',,,,'MM-dd-yyyy');D =历史记录(C,SEC,字段,日期)
d= 1×3 timetable Time PO PH P ____________________ ______ ______ ______ 29-Mar-2018 00:00:00 194.94 196.01 194.22

Use the end-of-day prices for each field to make investment decisions for theVOD秒urity.

使用DataStream Web服务连接来检索指定安全性,字段和日期范围的历史数据。

使用您的用户名和密码创建DataStream Web服务连接。Cis theDataStreamwsConnection object.

用户名='abcdef';password ='abcdef12345';C= datastreamws(username,password);

调整显示格式显示货币。

format银行

Retrieve historical end-of-day price data from April 1, 2018, through April 30, 2018. Specify theVOD秒urity and these fields:

  • 开头

  • High price

  • Last closing price

d是第一个变量中的日期和后续变量中的字段的时间表。

sec ="VOD";字段= [“ po”;"PH";"P"];StartDate = DateTime('04-01-2018',,,,'InputFormat',,,,'MM-dd-yyyy');enddate = dateTime('04-30-2018',,,,'InputFormat',,,,'MM-dd-yyyy');d=历史(C,,,,秒,,,,字段,,,,开始日期,,,,enddate);

Display the first few prices.

head(d)
ans = 8×3 timetable Time PO PH P ____________________ ______ ______ ______ 02-Apr-2018 00:00:00 NaN NaN 194.22 03-Apr-2018 00:00:00 193.70 194.15 193.90 04-Apr-2018 00:00:00 196.64 198.10 197.22 05-Apr-2018 00:00:00 200.45 203.90 203.65 06-Apr-2018 00:00:00 203.15 205.15 204.00 09-Apr-2018 00:00:00 204.35 205.45 203.65 10-Apr-2018 00:00:00 204.45 205.90 205.60 11-Apr-2018 00:00:00 205.50 207.70 206.30

Use the end-of-day prices for each field to make investment decisions for theVOD秒urity.

Use a Datastream Web Services connection to retrieve historical data for the specified security, fields, date range, and period.

使用您的用户名和密码创建DataStream Web服务连接。Cis theDataStreamwsConnection object.

用户名='abcdef';password ='abcdef12345';C= datastreamws(username,password);

调整显示格式显示货币。

format银行

从2017年1月1日到2017年12月31日检索并显示历史结束价格数据。VOD秒urity and these fields:

  • 开头

  • High price

  • Last closing price

Specify a quarterly period.d是第一个变量中的日期和后续变量中的字段的时间表。

sec ="VOD";字段= [“ po”;"PH";"P"];StartDate = DateTime('01 -01-2017',,,,'InputFormat',,,,'MM-dd-yyyy');enddate = dateTime('12 -31-2017',,,,'InputFormat',,,,'MM-dd-yyyy');period ='Q';d =历史记录(C,sec,fields,startdate,enddate,ofende of enec)
d = 4×3时间表时间po ph p ____________________________________________________________________________- 00:00:00 nan nan Nan 199.85 01-apr-2017 00:00:00:00 209.00 209.00 209.10 206.10 206.65 01-JUL-JUL-2017 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00217.65 219.20 218.70 01-OCT-2017 00:00:00 209.35 211.60 210.50

Use the quarterly prices for each field to make investment decisions for theVOD秒urity.

输入参数

Collapse all

DataStream Web服务连接,,,,specified as aDataStreamws目的。

安全性,指定为字符向量,字符向量的单元格数组,字符串标量或字符串数​​组。使用字符向量或字符串标量来指定一个安全性。使用字符向量或字符串数​​组的单元格数组来指定多个证券。对于组成列表,请在例如,输入参数“ LFTSE100”

Example:"VOD"

数据类型:Char|细绳|Cell

字段列表,指定为字符向量,字符向量的单元格数组,字符串标量或字符串数​​组。使用字符向量或字符串标量来指定一个字段。使用字符向量或字符串数​​组的单元格数组来指定多个字段。

Example:[“ pH”,“ po”,“ p”]

数据类型:Char|细绳|Cell

Date, specified as adatetime数组,数字标量,字符串标量或字符向量。Use this date to retrieve historical data for a specific day.

Example:datetime('03 -29-2018','inputformat','mm-dd-yyyy')

数据类型:double|Char|细绳|datetime

Start date of a date range, specified as adatetime数组,数字标量,字符串标量或字符向量。这default start date is the first date of available historical data for the specified security

Example:datetime('04 -01-2018','inputformat','mm-dd-yyyy')

数据类型:double|Char|细绳|datetime

结束日期of a date range, specified as adatetime数组,数字标量,字符串标量或字符向量。默认结束日期是指定安全性的最新可用历史数据可用日期

Example:datetime('04-30-2018','InputFormat','MM-dd-yyyy')

数据类型:double|Char|细绳|datetime

时期,指定为以下值之一:

  • 'D'- 日常的

  • ' W '- 每周

  • 'M'-Monthly

  • 'Q'-Quarterly

  • 'Y'-Yearly

您可以将值指定为字符向量或字符串标量。默认期限取决于指定的安全性

输出参数

Collapse all

历史数据,作为时间表或表格返回。这history功能返回带有数据安全性的时间表。对于多个证券,history函数仅返回第一个语法的时间表和其他语法的嵌套时间表表。要访问其中一个嵌套时间表,请使用点符号,例如d。VOD

响应消息,返回为matlab.net.http.Responsemessage目的。这回应对象包含一个错误消息。要访问错误消息,请参阅访问datastream Web服务错误消息

版本历史记录

在R2018B中引入